/v1 endpoints requires a Bearer token in the Authorization header. The API accepts two token types.
Token types
Most integrations use an API key. The OAuth flow is only for MCP clients. Tokens that start with
sapi_key_ are treated as API keys; any other token is treated as an OAuth 2.1 access token.
API keys
API keys are the primary authentication method for external integrations.Format
Passing the key
Include the key in theAuthorization header:
Creating keys
Keys are created in the dashboard under Keys > New Key, or via the API:raw_key. Store it immediately. Subsequent reads only show a truncated preview like sapi_key_a1b2c....
By default a key has full access to every brand and operation. To hand out a least-privilege or client-scoped key, pass scopes and brand_ids when you create it. See Scoped API keys.
Rotating keys
Issue a new secret for an existing key without changing its id, name, or restrictions:raw_key is shown once, and the old secret stops working immediately. To change a key’s name or restrictions in place without issuing a new secret, use PATCH /v1/keys/<key-id>.
Revoking keys
Listing keys
preview (suffix only), is_active, last_used_at, and each key’s scopes and brand_ids restrictions (both empty means full access). See Scoped API keys.
OAuth 2.1 access tokens (MCP clients)
MCP clients (Claude, ChatGPT, Cursor) authenticate through the API’s built-in OAuth 2.1 authorization server instead of a static API key. After the user completes the OAuth flow (see the OAuth guide), the client receives an access token to send as its Bearer token. Access tokens expire after 1 hour. The client uses its refresh token to obtain a new access token without asking the user to re-authorize.Authentication error codes
The API returns a consistent set of error codes when a request cannot be authenticated. Useerror.code for programmatic handling.
See Error reference for the complete list including OAuth-specific codes.
Security best practices
- Never expose keys in frontend code. Keys must only be used server-side.
- Use environment variables. Do not hardcode keys in source code.
- Create one key per service. Revoke individual keys if compromised without disrupting others.
- Grant least privilege. Restrict a key to the scopes and brands it actually needs, so a leaked key cannot cross clients or perform actions it never should.
- Monitor
last_used_at. Unused keys should be revoked. - Rotate OAuth refresh tokens. The API enforces refresh token rotation. Each refresh grants a new token pair.