Named, expiring, revocable tokens for CI, scripts and the CLI: how to create, use and revoke them, and what a token cannot do.
A personal API token is a named credential for programmatic access: a CI job, a script, an unattended agent. It acts as your account until it expires or you revoke it.
On your own machine, mlcl login is still the simplest path. Use a token where nobody is there to approve a browser prompt.
In the app, open the settings panel, expand API tokens, name the token, pick an expiry (30, 90, 180 or 365 days) and choose Create token. From the CLI, signed in with mlcl login:
mlcl token create ci --expires-in-days 90
mlcl token create nightly-backup --json | jq -r .token # only the token, for scriptsThe token is shown once, when it is created. Put it in your CI secret store right away. If you lose it, revoke it and create a new one.
The CLI and the MCP server read MOLECULE_TOKEN ahead of any stored login:
export MOLECULE_TOKEN=<token>
mlcl deploy --project <id> --followAnything that speaks HTTP sends it as a bearer token to the platform API:
curl -H "Authorization: Bearer $MOLECULE_TOKEN" https://api.molecule.dev/api/projectsIn GitHub Actions or GitLab CI, store the token as a secret and expose it to the job as MOLECULE_TOKEN.
mlcl token list # id, name, created, expires, last used (also --json)
mlcl token revoke ci # by name or idOr choose Revoke next to the token under API tokens in the settings panel. A revoked token stops working within seconds.
mlcl login), not a token. Your account email must be confirmed.A stolen token should not be able to take the account over or outlive its revocation, so a request made with a token is refused when it tries to:
mlcl login;Do those from the app while signed in. Everything else your account can do, the token can do, so treat it like a password.