Skip to main content
The Platform API accepts two credentials, both sent as a bearer token in the Authorization header:
  • An API key (rk_...) is a long-lived secret. It works on every endpoint your key’s roles allow. Keep it on a server.
  • A session token is a short-lived JWT that you mint from an API key with POST /tokens. It works only on /sessions and /clips, and only for the models and sessions you name. Give it to a browser, a mobile app, or any client you do not control.
Server exchanges API key for a token, passes token to browser, browser connects to Reactor

API keys

Create an API key

Create keys in the Dashboard: click your user icon, then open API Keys. The full key appears only once, when you create it, so store it in a secret manager. Each key is bound to one account: the account that was selected when you created it. To create a key for a team, switch to the team first. See API keys and billing. A key acts with your roles in that account, or with a subset you choose when you create it. If you lose a role later, keys that relied on it lose it too.
You cannot create an API key with the Platform API using another API key or a session token. A credential that leaked cannot be used to create a replacement for itself. The reactor auth login command creates a key for the CLI through a browser sign-in; that key expires after 90 days.

Send an API key

The API tells an API key from a JWT by its rk_ prefix. Older clients may send the key in a Reactor-API-Key header instead. The API reads that header only when there is no Authorization header. Do not use it in new code. Some endpoints accept only an API key: everything outside /sessions and /clips, including /me, /accounts, /models, /projects, POST /tokens, and POST /files.

Revoke an API key

Revoke keys in the Dashboard. A key can also revoke itself:
$USER_ID is the id from GET /me. Revocation takes effect at once, and it also invalidates every session token minted from the key.
Treat an API key like a database password. Never put it in a browser, a mobile app, an edge worker, or source control. Rotate keys from time to time, and revoke a key as soon as you suspect it leaked.

Session tokens

A session token lets a client start sessions without holding your API key. It can call these endpoints and nothing else:
  • POST /sessions, to start a session on a model the token allows.
  • Every /sessions/{session_id}/... endpoint, for sessions the token created or was bound to. That covers reading and ending a session, WebRTC signaling, uploads, and step results.
  • GET /clips, for recordings of those sessions, also after a session ends.
Other endpoints reject session tokens with 403, except POST /tokens and POST /files. Those two endpoints return 401.

Mint a session token

Send your API key to POST /tokens. With no body, the token can start up to 5 sessions on any model your key may use, for 1 hour:
The field is jwt, not token. expires_at is a Unix timestamp in seconds. An empty constraints object means the defaults apply, including the limit of 5 sessions.

Limit what a token can do

Before you hand a token to a client, limit it to what that client needs. Pass one authorization_details entry:
This token lives 15 minutes. It can start one session, only on reactor/helios, and that session ends after 10 minutes. The response repeats authorization_details in canonical form: model names are resolved, sorted, and deduplicated. It includes max_sessions when you supply a limit or bind sessions. Otherwise, it omits max_sessions, and the default limit of 5 sessions applies.

Use a session token

Send the token exactly as you would an API key:
Each session the token starts is bound to it at once, so the same token can then negotiate transport, upload files, and end that session.

Share a session with another client

A token can act only on the sessions it started. To let a second client join a session that already exists, mint a separate token for that client and bind the session to it:
  • Each bound session must be open and must belong to your key’s account and user.
  • Each bound session must run a model listed in resources.models.match.
  • Bound sessions count toward max_sessions. When you omit max_sessions, the limit equals the number of bound sessions, so the token cannot start new sessions. Set max_sessions higher to let it start more.
A session that is closed, belongs to someone else, or does not exist returns 403. The three cases look the same, so the endpoint never reveals whether a session ID exists.

Errors

A session token that has expired, or whose API key was revoked, returns 401 on every call. A session token used outside its limits returns 403: another session, a model it does not allow, or a new session beyond max_sessions. Other endpoints reject session tokens with 403, except POST /tokens and POST /files, which return 401.

Accounts and roles

Every request acts in one account: the account the API key is bound to. Session tokens inherit it. To act in another account, use a key created in that account. What a credential may do depends on its roles in that account: Each endpoint page names the roles it needs. A credential without them gets 403.

Next steps

Mint a session token

The full POST /tokens reference, with a playground.

Client authentication

Mint tokens from a server and hand them to the JavaScript, Python, and mobile SDKs.