- API keys — long-lived tokens for your own use, limited to the scopes you give them
- Scoped JWTs — short-lived, scope-limited tokens you can issue to third parties
API keys
Get your API keys from the Dashboard. Use them in theAuthorization header:
Scopes
Each API key has scopes that say what it may do, or is unrestricted. You choose them when you create the key and can change them at any time on the key’s page in the dashboard. A new key starts withinference, models:read, account:read, lora:read and voice:read: enough to run and look up models.
Where an area has two scopes, the :read one only reads and the full one also creates, changes and deletes. The full one includes its :read scope, so a key never needs both.
Speaking with a voice runs a model, so it needs
inference as well as voice:read.
Each endpoint’s page in the API Reference names the scope a key needs to call it. The interactive API explorer can also filter endpoints by scope.
A request the key’s scopes do not allow is refused with 403 and names the missing scope:
Unrestricted keys
A key can be unrestricted instead of scoped: it has every scope that is not sensitive, including whatever scopes DeepInfra adds later. Choose Unrestricted when you create the key or on its page in the dashboard, which then shows it asunrestricted. Through the API, set scopes to ["unrestricted"], on its own: combined with other scopes it is refused with 422.
Keys created before scopes existed are unrestricted. To limit one, choose Scoped on the key’s page and pick its scopes.
Sensitive scopes
A sensitive scope grants power over the account itself, so it is off by default. Today the only one isaccount_api_key.
- It can be set on a key only once the account owner has enabled it. Until then the dashboard does not offer it, and setting it through the API is refused with
422(scopes not enabled for this account: account_api_key). unrestricteddoes not grant it. A key that needs it must be scoped and hold it by name.- An API key can never grant it: not to a key it creates, nor to a key it changes. A key created by another API key can never hold it, even when changed from the dashboard. Such requests are refused with
422:
Enable account_api_key
Only the account owner can enable it, signed in to the dashboard. For a team, that is the team owner. No API key can enable it, whatever its scopes.
- Open Account → Danger zone.
- Tick Allow API keys to manage API keys and confirm.
- Confirm your password when asked. An account without a password (Google, GitHub or SSO sign-in) is asked to sign in again if its last sign-in was more than 10 minutes ago.
POST /v1/api-tokens and PATCH /v1/api-tokens/id/{token_id} accept it in scopes.
To turn it off, untick the box. The dashboard lists the keys that hold the scope: turning it off deletes them, and anything using them stops working.
Manage API keys with an API key
A key withaccount_api_key:read may list the account’s API keys (GET /v1/api-tokens) and read one key’s details (GET /v1/api-tokens/id/{token_id}). Neither ever returns a key’s secret. Every unrestricted key has this scope, and so does every key holding account_api_key.
A key with account_api_key may also create keys (POST /v1/api-tokens), change their scopes (PATCH /v1/api-tokens/id/{token_id}) and delete them (DELETE /v1/api-tokens/id/{token_id}), for every key of the account. When an API key creates a key:
scopesis required. Any scopes that are not sensitive may be given,unrestrictedincluded.- The new key has no IP allow-list, whatever the creating key’s.
Scoped JWT
Scoped JWT tokens let you grant limited inference access to third parties without sharing your API key. You can restrict the token by:- Models allowed — specific model(s) only
- Expiration — time-limited (up to 1 year)
- Spending limit — maximum USD spend
account_scoped_jwt scope and inspecting one needs account_scoped_jwt:read. A JWT signed by a key without inference cannot run models.
Create a scoped JWT
deepseek-ai/DeepSeek-V4-Flash-0731, expiring in 1 hour, with a $1.00 spending limit.
Optional fields (omit to remove restriction):
models— allow any modelexpires_delta— no expiration (defaults to 1 year)spending_limit— no spending limit- Use
expires_at(unix timestamp) instead ofexpires_deltaif preferred
api_key_name is deprecated. It used to choose the signing key. Omit it: a JWT is signed by the key that creates it, and naming a different key will be refused.Inspect a JWT
Use a scoped JWT
Use it exactly like a regular API key in theAuthorization header: