ankra tokens
Commands to list, create, rotate, revoke, and delete API tokens. By default they act on your personal tokens.--service acts on the
organisation’s service tokens instead: tokens that belong to a service
account rather than a person, for pipelines and other automation. Managing
them needs the members.manage permission.
ankra tokens create
Create a personal API token named <name>. With--service, <name> is a service account of the organisation instead, and
the token belongs to that account rather than to you: it keeps working when
you leave the organisation, and acts with the account’s role, not yours.
The account is created with --role when the organisation has none of that
name; for an existing account --role must be the role it already holds.
--label names the token itself (default: a timestamp). The role may not
carry permissions you lack, and creating one needs members.manage.
The global --project <slug|name|id> pins the token to that project: it then
acts only there and cannot be pointed elsewhere. A token with MCP scopes is
always pinned - to the project you pass, else to the project you are acting
in; a REST token created without --project acts in the organisation’s
default project (a project-only member’s token: the first project they reach),
never in the project its owner switches to, and reaches another project only
through the X-Ankra-Project-Id header, which --project / ANKRA_PROJECT send
per command.
The token value is shown once.
ankra tokens delete
Delete an API token. The token must be revoked first.--service deletes a revoked organisation service token instead of a personal
one. It needs members.manage (exit 7 without it). Deleting a service
account’s last token takes the account’s role away, but the account stays a
member of the organisation; the command then prints the
“ankra org remove <account_id>” that removes it. The account_id of every
service token is in “ankra tokens list --service -o json”.
ankra tokens list
List your API tokens with when each one expires. A live token that expires within 7 days reads “Expiring” in the Status column and an expired one “Expired”; the Expires column shows the date and how many days are left. Renew an expiring token before it stops working with “ankra tokens rotate <id>”.--service lists the organisation’s service tokens instead, with the service
account each belongs to and the role it holds; renew one with
“ankra tokens rotate <id> --service”. It needs members.manage (exit 7
without it).
ankra tokens revoke
Revoke an API token: it stops working at once. Delete it afterwards with “ankra tokens delete <token_id>”.--service revokes an organisation service token instead of a personal one;
find its id with “ankra tokens list --service”. The service account and its
other tokens keep working. It needs members.manage (exit 7 without it).
ankra tokens rotate
Issue a new token to replace one that is about to expire, with the same name and scopes. The old token keeps working for an overlap window so you can update every place it is used, then it stops by itself. The new token value is shown once. When stdout is not a terminal the command prints only the value on stdout, so this works in scripts:--service to rotate an organisation service token instead of a personal
one. --overlap-hours sets how long the old token keeps working, from 0 (stops
at once) to 168; the platform default is 24 hours.