For AI agents: the documentation index is at /llms.txt, and this page is available as Markdown at /api/auth/exchange-api-key-token.md.

Exchange API key for tokens

POST
/api-key/token

Verify an ECDSA P-256 signature and issue JWT tokens. The client signs the message {key_id}.{unix_timestamp} with their private key using ES256. The timestamp must be within ±30 seconds of the server time.

A personal key returns an access token and a refresh token. An organization key returns an access token only, with no refresh_token field: mint a new token from the key before expires_in.

Rate limit: counts against the Sign-in verification limit, 30 a minute (per ip address, for every caller). See Rate limits.

Request Body

application/json
  1. body
key_id*string

The API key ID

Formatuuid
timestamp*integer

Current Unix timestamp (must be within ±30s of server time)

Formatint64
signature*string

Base64url-encoded ECDSA P-256 signature of {key_id}.{timestamp}

Response Body

Tokens issued successfully. A user key yields an access and refresh token; an organization key yields an access token only.

application/json
  1. response
access_token*string

JWT access token

refresh_token*string

JWT refresh token

expires_in*string

Access token expiration timestamp

Formatdate-time
token_type*string

Token type (always "Bearer")

device_token?string

Marks this client as signed in to the inbox by email; send it back as X-Device-Token. Present only on an email sign-in.

turnkey_session?

A Turnkey session on the public key a provider sign-in sent. Absent when none was asked for or none could be issued.

Example Request
curl -X POST 'https://api.truemarkets.co/v1/auth/api-key/token' \  -H 'Content-Type: application/json' \  -d '{  "key_id": "1e779c8a-6786-4c89-b7c3-a6666f5fd6b5",  "timestamp": 0,  "signature": "string"}'
Example Response
{  "access_token": "string",  "refresh_token": "string",  "expires_in": "2019-08-24T14:15:22Z",  "token_type": "Bearer",  "device_token": "string",  "turnkey_session": {    "expires_at": 0  }}