Skip to content

API: API keys

Collect the key of an approved link

Poll every `interval` seconds. status is pending until the person decides, then approved with the key (shown once and made at that moment), denied, or expired. A link that never existed reads as expired.

POST/api/v1/device-links/token

Authentication#

No key is needed: the codes in the exchange are the credential. This route is limited per address. See Authentication.

Request body#

Content type application/json.

NameTypeRequiredDescription
device_codestringyesThe device_code from the call that started the link. min length 1; max length 128

Responses#

200 OK#

Content type application/json. Schema: LinkToken.

NameTypeRequiredDescription
abilitiesarray of string-What the key may do. Only when approved
expires_atstring (date-time) or null-When the key stops working. Only when approved
idstring-The key id, used to revoke it. Only when approved
statusstring-Pending, approved, denied or expired. A link that never existed reads as expired
tokenstring-The secret key, shown once. Only when approved
typestring-The authorization scheme, always Bearer. Only when approved

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/device-links/token" \
  -H "Content-Type: application/json" \
  -d '{
  "device_code": "kV3x0Zp8mQ1sT9nL2aR7wYc4HbU6eGdJ5oFiNtX-AqE"
}'

Response examples

{
  "abilities": [
    "image:convert",
    "pdf:compress"
  ],
  "expires_at": "2026-02-04T10:00:00Z",
  "id": "k_7f3c1b9e",
  "status": "approved",
  "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.