API tokens
API tokens let the CLI, scripts and AI agents act in a workspace without a
console session. A token looks like myd_….
Token rules
Section titled “Token rules”- A token belongs to one workspace, and optionally to one project.
- A token has scopes:
read,write,destroy,admin(see the table below). - A token’s scopes are capped by its creator’s current role. If the creator is demoted, the token loses what the new role lacks.
- A token stops working when its creator leaves the workspace or is removed from it.
- A token created with another token keeps that token’s project, never outlives it, and stops working when it is revoked.
- If the workspace requires two-step sign-in or single sign-on, a token works only if its creator’s session met that rule when the token was created. See Workspace security.
- The secret is shown once, when the token is created. Mayadyn stores only a hash.
Scopes
Section titled “Scopes”| Scope | Console label | Allows |
|---|---|---|
read |
View | Listing and reading everything: connections, machines, apps, releases, logs, operations, members, audit log, catalog. |
write |
Create, start, stop | Creating, starting and stopping machines; syncing and checking connections; creating, deploying and rolling back apps; setting app secrets. |
destroy |
Delete | Deleting machines and apps; deleting connections (with admin). |
admin |
Manage accounts, tokens and members | Adding connections and replacing their credentials; inviting and managing members; creating projects; creating and revoking tokens. |
Give each token the least it needs. A token for a read-only dashboard needs
only read; a deploy agent needs read and write.
Create a token
Section titled “Create a token”You need the admin scope (Admin or Owner). You can grant only scopes you
have.
Console
- Open API tokens and choose Create token.
- Enter a Name (“Who is it for? e.g. deploy agent”), up to 100 characters.
- Tick the Permissions.
- Pick a Project, or All projects.
- Pick Expires after: 7, 30, 90 (the default) or 365 days, or Never expires.
- Choose Create token, then copy the token. “This is the only time the token is shown.”
The dialog also shows the MCP endpoint for agents.
CLI
mayadyn tokens create --name "deploy agent" --scopes read,write --expires-days 30mayadyn tokens create --name "ci" --scopes read,write --project <project id> --expires-days 90--scopes defaults to read. --expires-days takes any number of days;
0 (the default) means the token never expires. The CLI prints the secret
on standard output and the “only time” warning on standard error.
Project tokens
Section titled “Project tokens”A token limited to a project:
- sees only that project’s connections, machines, apps, operations and tokens;
- cannot manage members or projects, or read the audit log;
- can create tokens only for its own project.
See Projects.
List tokens
Section titled “List tokens”- Console: API tokens shows Name, Permissions, Owner, Last used and Status (Active, Expired or Revoked).
- CLI:
mayadyn tokens listshows the id, name, the first characters of the secret, scopes, owner, last use and status.
Listing tokens needs the admin scope.
Revoke a token
Section titled “Revoke a token”A revoked token stops working at once, and so do tokens created with it.
- Admins can revoke any token in the workspace.
- Any member can revoke their own tokens.
- A token can revoke itself.
Console: API tokens → Revoke.
CLI: mayadyn tokens revoke <id>.
Keep tokens safe
Section titled “Keep tokens safe”- Store tokens in a secret manager or the CLI’s config file (readable only by you), not in code.
- Prefer an expiry. Rotate long-lived tokens.
- Use separate tokens per tool or agent, so you can revoke one without the others. Last used shows which are still in use.
- Every action a token takes is recorded in the audit log as its owner, marked via token.