Manage API tokens programmatically
Create, list, update, and revoke API tokens using the API instead of the dashboard. Automate key provisioning and rotation for your integrations.
You can manage the same API tokens available under Developers > API Tokens in the dashboard through the /api/{account_id}/api-tokens endpoints: create, list, get, update, and delete.
Managing tokens requires the Developer permission. Listing and getting tokens need view access; creating, updating, and deleting tokens need edit access.
Token types
Each API token bundles two credentials:
Both live and sandbox accounts use the _prod_ prefix in production. The token record itself is identified by an id with the tkn_ prefix (e.g., tkn_prod_a1b2c3d4e5f6g7h8).
The full secret token is only returned once, in the response to the create request. Store it securely — it cannot be retrieved again. Subsequent responses only include secret_token_preview (the first 12 characters, e.g. st_prod_secr...) for identification.
Authentication
All requests use your existing secret token:
Replace {account_id} with your account’s external id (e.g., acc_prod_...).
Create a token
Generate a new API token. The response includes the full secret_token — this is the only time it is returned, so store it securely.
Body parameters (both optional):
Response (ApiTokenWithSecret):
List tokens
Retrieve a paginated list of tokens for the account. The secret_token is never included — only secret_token_preview.
Query parameters:
The response is a paginated envelope: an items array of token objects, plus total (the total match count) and has_more.
Get a token
Fetch a single token by its id. The response is the token object (without the secret token).
A token that does not exist, or that belongs to another account, returns 404.
Update a token
Update a token’s description or toggle its is_active status. Only the fields you include in the request body are changed; omitted fields keep their current values. The response is the updated token object (without the secret token).
Body parameters (both optional):
Deactivating a token (is_active: false) immediately stops it from authenticating requests — any call using its secret token is rejected with 401 — while keeping the token in your list for audit purposes. Set is_active: true to re-enable it.
Revoke a token
Permanently delete a token. This is a hard delete and cannot be undone.
Response:
To disable a token temporarily instead of deleting it, update it with is_active: false. You can re-enable it later by setting is_active: true.
Rotate a token
There is no dedicated rotate endpoint. Rotate a credential by creating a replacement and then retiring the old one:
- Create a new token and deploy its
secret_tokento your integration. - Verify the new token works in production.
- Deactivate the old token by sending
PATCHwithis_active: false(reversible), or delete it (permanent).
Deactivating first and deleting only after a grace period lets you roll back quickly if the new token was misconfigured.
Set an expires_at when creating a token to enforce a rotation schedule automatically.