---
title: "Exchange API key for tokens"
url: https://docs.truemarkets.co/api/auth/exchange-api-key-token
description: "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."
---

Docs index: https://docs.truemarkets.co/llms.txt

# Exchange API key for tokens

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](https://docs.truemarkets.co/developer-resources/rate-limits).

## Request

```
POST https://api.truemarkets.co/v1/auth/api-key/token
```

### Body

`application/json`, required

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `key_id` | string (uuid) | yes | The API key ID |
| `timestamp` | integer (int64) | yes | Current Unix timestamp (must be within ±30s of server time) |
| `signature` | string | yes | Base64url-encoded ECDSA P-256 signature of `{key_id}.{timestamp}` |

## Responses

Every error status returns the same body, described in [Errors](https://docs.truemarkets.co/developer-resources/errors.md).

### 200

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

Type: one of: object \| object

### 400

Invalid request (missing fields)

### 401

Invalid API key, expired, revoked, invalid signature, or timestamp out of range

### 403

An operator has disabled the account, so no token is issued for it

### 500

Internal server error
