Use an API token
Section titled “Use an API token”This page is for developers who connect a script, a service or an automation tool to OSOS without a person signing in. You will get an API token, send it with your requests, keep its access narrow, and rotate it without downtime.
An API token is the simplest credential the platform offers: no login screen and no
token exchange. Send it in the x-app-token header on every request. Each request
then runs as the token’s application user, with exactly that user’s permissions.
When to use an API token
Section titled “When to use an API token”| Your caller | Use |
|---|---|
| A person in a browser or mobile app | OAuth sign-in (authorization code) — see Authentication & OAuth |
| A trusted first-party script that holds a user’s password | The OAuth password grant |
| A service, script or automation acting as itself | An API token. Not OAuth client credentials: that token has no user, so it can reach almost nothing |
The full decision, including what an API token cannot express, is in Choosing a credential.
Get a token
Section titled “Get a token”A tenant administrator creates the token: they add an application user, and the platform emails the token to them once. There is no API to create a token and no screen that shows one. Ask your administrator to follow Create an API token for an integration, and to give the application user access to exactly the data your integration needs.
You receive from them:
- the token — a 64-character hexadecimal string;
- the tenant’s host, for example
https://acme.example.com; - what the application user is allowed to read and change.
Store the token in a secret store or an environment variable, never in source code.
Send the token
Section titled “Send the token”Put the token in the x-app-token header and call the tenant’s own host:
export BASE="https://acme.example.com"export TOKEN="<your-api-token>"
curl -s "$BASE/api/v2/entities/<entity>/entries/count" \ -H "x-app-token: $TOKEN"{ "success": true, "result": { "count": 42 } }The tenant comes from the host you call; you never send a tenant id. Every other convention — paths, versions, the response envelope, errors — is the same as for any credential: see Calling the HTTP API, and the Backend quickstart for a guided first call.
What the token can do
Section titled “What the token can do”A token has no scopes of its own. It authenticates as its application user, and the platform then applies that user’s system level, space membership and permissions, exactly as for a person. So:
- To limit an integration, limit its application user. For data you only read, ask
for a view shared with the application user, and read through it
(
/api/v1/v/{viewId}/…, see Calling the HTTP API). View on the entity itself is not enough: it shows the design, not the records, and listing the entity’s records then returns an empty list, not an error. Ask for Edit only where you write. - Give each integration its own application user and token. You can then revoke one without touching the others, and the record history shows which integration made each change.
- A token never grants more than its user has. A
403on a request, or an empty list where you expect records, means the application user lacks access to that data, not that the token is wrong.
Expiry
Section titled “Expiry”The administrator chooses, per application user, whether the token never expires or expires on a date. The token stops working at the end of the expiry date. An expired token is refused like any other invalid token (see Errors); the fix is for the administrator to extend the Expiry date on the application user, not to regenerate.
Since 1.10 administrators can set the expiry date. Before 1.10 the field was hidden
and every token was created without an expiry.
Rotate a token without downtime
Section titled “Rotate a token without downtime”An administrator with the system Admin level can regenerate the token. The
application user, its permissions and its history stay the same; only the secret
changes. Since 1.8
- The administrator selects Regenerate Token on the application user. The new token is emailed to that administrator — it is never returned by the API.
- Both tokens work during a grace period — 24 hours by default; your operator may change it.
- Deploy the new token to your integration within that window. After it, the old token is refused.
Design your integration to read its token from configuration, so a rotation is a configuration change, not a release. If the email with the new token is lost, regenerate again before the old token’s grace period ends.
Regeneration is refused for an archived application user. Rotation for a function’s own token works differently: the new token goes straight to the function — see Functions.
Revocation and its delay
Section titled “Revocation and its delay”A token stops working when the administrator deactivates or archives its application user, or when it expires.
The gateway remembers a successful check for a short time — five minutes by default — so a revoked token can keep working until that time runs out. Plan for this delay when you revoke a leaked token: rotate or revoke first, then watch for calls that still succeed within the window.
How this delay interacts with OAuth sessions, and how to design around it, is in Token lifecycle.
Errors
Section titled “Errors”| Status | error.code | Meaning | What to do |
|---|---|---|---|
400 | INVALID_APP_TOKEN_API_ERROR | The token is unknown, expired, deactivated or archived. | Do not retry. Check the token value and ask the administrator about the application user. |
403 | depends on the operation | The token is valid, but its application user lacks access to this data. | Ask the administrator to grant the access. |
500 | APP_TOKEN_VALIDATION_REQUEST_FAILED | The gateway could not reach the identity service to check the token. | Retry with backoff. |
Errors use the platform’s standard error body. The full catalogue and the retry policy are in Errors and retries.
Technical details
- The token is a 64-character hexadecimal secret. The platform stores only a hash of it, which is why no one can show it again.
- A request with
x-app-tokenis authenticated by that header. A request without it falls back to the normalAuthorization: Bearerpath, so the two credentials never conflict. - Each time the platform checks the token (not on every cached request), it records a “last used” time.
Good to know
Section titled “Good to know”- Shown once, by email only. If the token is lost, the administrator regenerates it; there is no way to read it again.
- No per-token scopes. All authorization comes from the application user.
- Acting for a person is a different mechanism. An API token always acts as its own application user. For one person acting for another during an absence, see Delegation; for a third-party app acting for a signed-in user, use OAuth.
Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27