API tokens
An API token lets a script, a CI job or a coding agent call the Ampbase API as you, or as your org. This page covers the two kinds, how to mint one, how long it lives, and how to rotate and revoke it.
The two kinds
| Personal | Service | |
|---|---|---|
| Acts as | You | The org |
| Use it for | A coding agent or a script you run yourself | A CI pipeline or a shared integration |
| Role | Viewer, Editor or Admin, never above your own | Viewer, Editor or Admin |
| Default expiry | 90 days | 1 year |
| Longest expiry | 1 year | 1 year |
| Channels | At least one, chosen when you mint it | All, or the ones you choose |
| Who can rotate it | You | Admins and Owners |
| Who can see and revoke it | You, and the org's Owners | Admins and Owners |
Pick personal for an agent working on your behalf. Its changes are recorded as yours, it can do no more than you can, and it stops working if you leave the org. Pick service for automation that must keep running whoever comes and goes, such as a deploy pipeline.
Give a token the least it needs. A Viewer token can read everything in its channels and change nothing. An Editor token can also save configs, work in tracks and soundcheck them on a few hosts, and changes nothing agents are served beyond those hosts. An Admin token can also deploy and run rollouts. A personal token starts at Editor, the role a coding agent needs to propose changes. Naming channels confines the token to them: a call about any other channel is refused. The API page lists the least role each method needs.
Minting a token
Every member of the org mints their own personal tokens on the dashboard's API tokens page, at /dashboard/<your-org>/settings/tokens. Admins and Owners mint service tokens there too. Give the token a name you will recognise later, such as laptop agent or deploy pipeline, then choose its role, channels and expiry, and its kind if you can mint both.
The token is shown once, when you mint it. Copy it into your secret store straight away: Ampbase keeps only a record of it and cannot show it again. If you lose it, revoke it and mint another.
Each member holds at most 20 personal tokens. Revoked and expired tokens don't count, and neither does a token you have rotated while its replacement's overlap runs. At 20, revoke one you no longer use to mint another. Rotating a token is never refused, and service tokens have no such limit.
A token cannot mint, list, rotate or revoke tokens: those actions are in the dashboard only, so a leaked token cannot make more of itself.
Using a token
Send it as a bearer token:
Authorization: Bearer amp_live_...
Add an Ampbase-Run header naming the task, and the audit log can show which run made each change. See Authentication for both.
Expiry
A token stops working at its expiry, and the call is refused with unauthenticated. Nothing renews it: mint a new token, or rotate the old one, before it expires. The token list shows each token's expiry.
Rotation
Rotating a token mints its replacement with the same kind, role, channels and expiry, and shows you the new token once. Both work for 24 hours, so you can put the new one everywhere the old one runs before the old one stops. Once they end, the old one is refused within about an hour.
Rotate a token that already has a live replacement, and the rotation is refused with the reason ALREADY_ROTATED, naming the replacement. Revoke the replacement first if you have lost it, then rotate again.
Revocation
Revoking a token stops it within a minute, or a little longer if Ampbase is recovering from an outage. Revoking either token during a rotation's 24 hours revokes both: a rotation is no reason to keep a leaked secret alive.
When a member leaves or changes role
A personal token is tied to its owner's place in the org. So when a member is demoted, removed from the org, or deletes their account, every personal token they hold stops working. A member who returns, or is promoted back, mints new tokens. Their old ones do not come back.
Service tokens act as the org, not as a member, so they keep working when the member who minted them leaves.
The audit log shows a change made with a token beside the member it is recorded under, naming the token as a personal or a service token. For a service token, that member is the one who minted it. Changes made before the audit log recorded the token's kind name only "token".
If your org signs in with SAML, a member removed at your identity provider but not in Ampbase keeps their membership, and so their tokens, until the tokens expire. Remove them in Ampbase as well, on the Members page.
Stopping every token at once
Rotating the org's signing key (the Kill switch on a channel's settings page, or CredentialService/RotateOrgSigningKey) stops every API token in the org at once, along with every agent credential. Agents re-enroll by themselves; every script and pipeline needs a new token. Keep it for when you cannot tell which token leaked. To stop one token, revoke it. To stop one person's, remove them or change their role.
What Owners and Admins can see
Admins and Owners see every service token. Owners also see every member's personal tokens, so they can revoke one for a member who is away. For each token the list shows its name, kind, role, owner, last use, expiry, and the first characters of the token, enough to match it against one you hold. Nobody can see a token's secret after it is minted, Owners included.
Recognising a token
Every Ampbase API token starts with amp_live_. If you find one in a log, a commit or a chat, treat it as leaked: match its first characters against the token list, revoke it, and mint a replacement.