Start · Guide
Authentication and tokens
How API tokens work: creating, scoping, limiting, rolling and revoking them, and how to keep them safe.
How it works
Every request carries a token in the Authorization header:
Authorization: Bearer clsm_4kT9mQ2xW7vB1nLc8dRz5HyJ3sFgPaE6uKtN0wVq7YxQa1bA token belongs to an organisation and is made by a person. It can do what that person can do, limited further by the permissions, projects, addresses and time you choose. Nothing else is needed: there is no secret to pair with it, and no separate sign-in.
A token is only ever accepted in the Authorization header. A request that puts a token in the URL (?token=, ?access_token=) is refused with token_in_url, because addresses end up in logs, browser history and referrer headers.
The token format
| Part | Meaning |
|---|---|
clsm_ | A fixed prefix. It tells people and secret scanners that this is a Colossium token. If you find one in the open, revoke it. |
| 40 characters | Random, from a cryptographically secure source. About 238 bits. |
| 6 characters | A checksum. A string with a wrong checksum is refused at once without a lookup, and scanners can tell a real token from a random string. |
The whole token is 51 characters. Colossium stores only a SHA-256 hash of it, the first nine characters (so you can recognise it in a list) and the last four. Nobody at Colossium can read your token, and it cannot be shown again.
Create a token
Open API access in the console and choose Create token. You can create tokens if you are an organisation owner or administrator, and an organisation can have up to 50 active tokens.
| Setting | What it does | Advice |
|---|---|---|
| Name and description | Shown in the list and in the audit log | Name it after what uses it, so you know what breaks if you revoke it. |
| Permissions | The scopes the token holds. Reference | Only what the job needs. Prefer Read only or Developer. |
| Projects | All projects, or only the ones you pick | Limit a pipeline to its own project. |
| Allowed addresses | IP addresses or ranges the token may be used from | Use it for servers with fixed addresses. Not for shared CI runners, whose addresses change. |
| Expiry | 30 days to 1 year, or none | 90 days. Short tokens limit the harm of a leak. Put a reminder in the calendar and roll before it ends. |
What a token can do
A token holds scopes, and the API checks the scope on every call. A token can never hold a permission its creator does not hold, and the check is made again on every request using the creator's role as it is now:
- If the creator is demoted, the token narrows at once to what the new role allows.
- If the creator leaves the organisation, the token stops working (
invalid_token). - If the organisation is closed, every token stops (
organisation_closed).
The /token/verify endpoint shows both lists: granted_scopes (what you gave it) and scopes (what it can use now).
Some permissions can never be given to a token: managing members, changing billing, closing the organisation, and managing tokens. A leaked token therefore cannot take over the account or mint more tokens.
Limit where it works
Projects
A token limited to some projects sees only those. It cannot create projects, and it cannot read the audit log, which covers the whole organisation. When it asks for something it must name a project it may use, and a project it may not use looks the same as one that does not exist (404).
Addresses
With an allow list, a request from any other address is refused with ip_not_allowed. Entries are single addresses or ranges (203.0.113.7, 198.51.100.0/24, 2001:db8::/32), IPv4 or IPv6, up to 20. A range that matches every address is refused, because it limits nothing.
Time
A token can expire between 1 minute and 400 days from now. After expiry it answers token_expired. You can edit the expiry later.
Rolling and revoking
Roll a token to replace its secret without changing its permissions or limits. The old secret keeps working for a grace period you choose (none, 15 minutes, 1 hour, 4 hours or 24 hours), so you can deploy the new one without a gap. Choose no grace period if the old secret has leaked.
Roll in the console
Choose Roll next to the token. Copy the new secret. The list shows the old one as Rolling, with the time it stops.
Deploy the new secret
Put it in your secrets manager and redeploy. Check that calls succeed with it. last used in the console shows when each secret was last seen.
Let the old one end
It stops by itself at the end of the grace period. Revoke it earlier if you are sure nothing uses it.
Revoke stops a token immediately and permanently. Anything using it receives token_revoked. Revoked and expired tokens stay in the list, without their secret, as part of your record.
Everything you do to a token is written to the organisation's audit log: creating, editing (what was added or removed), rolling and revoking. The log never contains the secret.
Keeping a token safe
A token is a password. If it appears in a repository, a chat, a ticket, a screenshot or a log, treat it as leaked and roll it with no grace period.
| Do | Do not |
|---|---|
| Keep it in a secrets manager or your pipeline's secret store | Put it in source code, a config file in a repository, or a container image |
| Pass it to your program in an environment variable | Put it in a URL or a query string |
| Give each system its own token, so you can revoke one without disturbing the rest | Share one token between a pipeline and a person's laptop |
| Use the smallest set of permissions, and a project and address limit where you can | Give a token delete rights "just in case" |
| Log the request id and the error code | Log the Authorization header, or the whole request |
| Call the API from a server or a pipeline | Call it from a web page, a mobile app or a browser extension |
The reference client already does the right thing: it reads the token from the environment, refuses a malformed one before sending anything, and never writes it to a log or an error. What to do when one leaks is in Security.
Personal data and tokens
A token's record holds its name and description, the person who made it, when and from which address it was last used, and when it was created, edited and revoked. That is personal data about the creator and about whoever used the token. It is kept as part of the organisation's audit trail and removed when the organisation is deleted or the creator's account is. Do not put personal data in a token's name or description.
This page as MarkdownReport a problem with this pageOlympus Group Holdings, Inc.