API keys
API keys
Manage operator API keys used by backend services.
Endpoints
| Method and path | Required scope | Parameters |
|---|---|---|
GET /api/operator/api-keys | api_keys:read | No query parameters or body. |
POST /api/operator/api-keys | api_keys:write | JSON body documented below. |
POST /api/operator/api-keys/{id}/revoke | api_keys:write | id is a required positive API key ID. No body. |
Create request
{
"name": "backend-prod",
"scopes": ["launch:write", "users:read", "markets:read", "trades:read"]
}
| Field | Type | Requirement | Notes |
|---|---|---|---|
name | string | Required | Non-empty after trimming. |
scopes | string | Required | Non-empty. Every scope must be valid and assignable by the caller. |
Create response
tokenis returned once.- The token has exactly three dot-separated parts:
pma.<key-id>.<secret>. key_prefixcontainspma.plus the first eight key-id characters for operator recognition; it is not an authentication credential.
{
"item": {
"id": 1,
"name": "backend-prod",
"key_id": "<opaque-key-id>",
"key_prefix": "pma.<first-8-key-id-chars>",
"scopes": ["launch:write", "users:read", "markets:read"],
"last4": "abcd",
"revoked_at": null,
"created_at": "2026-06-18T00:00:00.000Z",
"updated_at": "2026-06-18T00:00:00.000Z"
},
"token": "pma.<key-id>.<secret>"
}
List response fields
List returns { items: [...] }, including revoked keys, newest creation time first (then highest ID). It is not paginated and never returns raw tokens. Nullable usage metadata may not update on every request because activity recording is asynchronous.
idnamekey_idkey_prefixscopeslast4last_used_atlast_used_iplast_used_user_agentrevoked_atcreated_atupdated_at
Rules
["*"]grants full scope.- Only a caller that already has
*may create a key with*. - A non-wildcard caller may assign only scopes it already has.
- API key scopes can include
markets:write,wallet_adapter:read, andwallet_adapter:write. - API key scopes cannot include
staffs:readorstaffs:write; staff management requires a staff session. - Invalid scopes ->
400 INVALID_SCOPES - Empty name ->
400 INVALID_NAME - Unknown revoke target ->
404 NOT_FOUND - Raw token must never be persisted outside secret storage.
API keys are not accepted by private market requests or support tickets, even when they have markets:write or *. Granting a scope does not override an endpoint's staff-session requirement.
Revocation returns { "ok": true, "id": 1 }. Revoked keys fail subsequent authentication; revoking an already-revoked owned key is permitted. Revocation is not logout: the logout route does not revoke API keys. For rotation, create a replacement, distribute its one-time token through server-side secret storage, then revoke the old key.
An API-key create request does not automatically add read scopes for write scopes (unlike staff scope assignment). Include each needed scope explicitly.
