POST /v1/client-tokens
Mint a short-lived token that lets a browser act for one consumer.
| Access | |
|---|---|
| Keys | secret only |
| Plan | every plan |
| Environment | live and sandbox |
| Acts for | the account |
| While the account is suspended | works |
| During a data stop | works |
Body
| Field | Type | Description |
|---|---|---|
clientId |
string | Your own opaque ID for the consumer: 1 to 64 characters of letters, digits, _ and -. Never an email address or a phone number. |
expiresInMinutes |
integer | (optional) How long the token lasts. 15 when left out; at most 60. |
{
"clientId": "u_8f2k",
"expiresInMinutes": 15
}
Answers
201: The token, and when it stops working
The answer is { data, meta }; meta holds requestId and environment.
data:
| Field | Type | Description |
|---|---|---|
token |
string | Send it as the X-Client-Token header, with your publishable key. |
expiresAt |
string | Mint a new one before this. |
{
"data": {
"token": "eyJ…",
"expiresAt": "2026-11-02T12:15:00.000Z"
},
"meta": {
"requestId": "req_7Hk2mT1xKp7Zc2Nf5Rb9Wd",
"environment": "test"
}
}
Errors
| Status | Codes |
|---|---|
| 400 | client_id_must_be_opaque, validation_failed |
| 401 | invalid_api_key, key_revoked, missing_api_key |
| 403 | account_pending, origin_not_allowed, secret_key_in_browser, secret_key_required |
| 429 | rate_limited |
| 500 | internal_error, temporarily_unavailable |
Every error has the same body, and says how to fix it (responses and errors).
More
Call it from your server. It mints a short-lived token that lets your website act for one
consumer with your pk_ key.
Request:
{ "clientId": "u_8f2k", "expiresInMinutes": 15 }
clientId: required; your opaque ID for the consumer, 1–64 characters ofA-Z a-z 0-9 _ -. Missing is400 validation_failed. An email address, a phone number or other characters get400 client_id_must_be_opaque.expiresInMinutes: optional, default 15, at most 60. A larger value is400 validation_failed, never silently shortened.
Works while the account is suspended, so your consumers can still read and delete what they saved.
Response 201:
{ "data": { "token": "eyJ…", "expiresAt": "2026-11-02T12:15:00.000Z" }, "meta": { "requestId": "req_…", "environment": "test" } }
The browser then sends Authorization: Bearer pk_… and X-Client-Token: eyJ…. The token is
bound to your account and environment; it is 401 client_token_account_mismatch with another
account's pk_ key and 401 client_token_invalid across environments. Mint a new one when it
expires (401 client_token_expired).
This page is made from the route's own declaration by npm run openapi. To change it, change the declaration or its explanation, never this file.