Skip to content

API: API keys

Issue an API key

Exchanges email and password for an API key limited to the abilities asked for. The secret is returned once and never stored: only its SHA-256 hash is.

POST/api/v1/tokens

Authentication#

No key is needed: the account's email and password are the credential, and the account's email must be verified. The key you get carries only the abilities you ask for. This route is limited to 5 calls a minute per address. See Authentication.

Request body#

Content type application/json.

NameTypeRequiredDescription
abilitiesarray of stringyesWhat the key may do; GET /api/v1/abilities lists the accepted values. at least 1 items; at most 16 items
codestringnoA two-factor code, for accounts with two-factor authentication. max length 16
device_namestringyesA label for this key, shown when listing keys. min length 1; max length 100
emailstring (email)yesThe account's email address. min length 1
passwordstringyesThe account's password. min length 1
recovery_codestringnoA two-factor recovery code, instead of code. max length 32

Responses#

201 Created#

Content type application/json. Schema: TokenIssued.

NameTypeRequiredDescription
abilitiesarray of string-What this key may do
expires_atstring (date-time) or null-When the key stops working, or null when it never expires
idstring-The key id, used to revoke it
tokenstring-The secret key. It is shown once; store it now
typestring-The authorization scheme to use, always "Bearer"

422 Unprocessable Content#

Content type application/problem+json. Validation failed; errors maps each field to its messages and issues lists each problem with its code, key and params. Schema: Problem.

The error follows RFC 9457. See Errors.

Any other status#

Content type application/problem+json. Error (RFC 9457 problem details). Schema: Problem.

The error follows RFC 9457. See Errors.

curl -X POST "http://localhost:3000/api/v1/tokens" \
  -H "Content-Type: application/json" \
  -d '{
  "abilities": [
    "image:convert",
    "pdf:compress"
  ],
  "device_name": "cli",
  "email": "you@example.com",
  "password": "your-account-password"
}'

Response examples

{
  "abilities": [
    "image:convert",
    "pdf:compress"
  ],
  "expires_at": "2026-02-04T10:00:00Z",
  "id": "k_7f3c1b9e",
  "token": "vk_7f3c1b9e.replace-this-with-the-key-you-receive",
  "type": "Bearer"
}

The examples are built from the schemas, so every value is a placeholder of its type. The tables above hold the fields that carry the real values.