Skip to navigation

Authentication

Exchange an API key for an access token that lasts at most 30 minutes.

Create a v2 API key

In the app, open Settings, then API Access, and create a key or edit an existing one.

  1. Turn on Allow this key to use API v2.
  2. Choose the key’s permissions, for example cards:read or cards:write. Each operation in the reference needs specific permissions; a call outside them returns PERMISSION_DENIED.
  3. Choose the role. ReadOnly keys can hold read permissions only.
  4. Optionally restrict the key to specific IPs or CIDR ranges.

The secret is shown once, so store it immediately. Keep it on a trusted server and never ship it in a browser or mobile app.

A key created with v2 access works only with v2. An existing v1 key that you enable for v2 keeps its v1 access, which its v2 permissions do not limit. Changing a key’s permissions, role or IP allowlist ends its current access tokens.

Get an access token

Send the API key as a bearer credential to POST /access-token. This is the only operation that accepts the API key.

curl -X POST "https://$API_HOST/api/v2/access-token" \
-H "Authorization: Bearer $API_KEY"
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6ImF0K2p3dCIsImtpZCI6InYyLTIwMjYxMDEyIn0...",
"tokenType": "Bearer",
"expiresIn": 1800,
"expiresAt": 1791820800000
}

expiresIn is in seconds and expiresAt is in Unix epoch milliseconds. The request takes no body; send none or {}.

Use the token

Send the token on every other operation:

Authorization: Bearer <token>

To refresh, exchange the API key again before expiresAt. An access token never creates another access token. Never log a token or put it in a URL.

A platform key also names the account holder it acts on:

Account-Holder: <accountHolderId>

Authentication errors

StatusCodeMeaning
401INVALID_API_KEYThe API key is missing or invalid, or not allowed from this address.
401INVALID_ACCESS_TOKENThe access token is missing, invalid or expired. Exchange the API key again.
403API_KEY_NOT_ENROLLEDThe key is not enabled for v2.
403PERMISSION_DENIEDThe key lacks a permission this operation needs.
403ACCOUNT_HOLDER_NOT_ACCESSIBLEThe key cannot act on the account holder you named.
400ACCOUNT_HOLDER_REQUIREDA platform key called an account holder operation without Account-Holder.

A 401 response carries WWW-Authenticate: Bearer, with error="invalid_token" when a credential was sent and refused.