Search documentation

Search every page of the Trade Wzrd docs

API

Authentication & Keys

API keys, scopes and plan entitlements for the Trade Wzrd API.

The API accepts two credential types on the same surface:

CredentialUsed byHeader
API keybots, scripts, MCP, serversAuthorization: Bearer tw_live_...
Session JWTthe Trade Wzrd web appAuthorization: Bearer eyJ...

A session JWT is the account owner and is never scope-limited. A key is delegated authority: it holds an explicit scope list, its own rate limit, and can be revoked without touching your account.

Key format

text
tw_live_<8 hex keyId>_<43 char urlsafe secret>tw_test_<8 hex keyId>_<43 char urlsafe secret>

The server stores only a SHA-256 hash. The raw key is returned once, by the create or rotate response, and can never be retrieved again. Everything else shows the prefix (tw_live_ab12cd34...).

Key lifecycle

ActionEndpointAuth required
CreatePOST /api/v1/keysSession
List (prefixes only)GET /api/v1/keysSession
Rotate secretPOST /api/v1/keys/{keyId}/rotateSession
RevokeDELETE /api/v1/keys/{keyId}Session
Verify a keyPOST /api/v1/keys/self-testThe key itself

Key management always requires an interactive session. A key can never create, rotate, or revoke keys - that is the one authority a leaked key must not carry.

Create one in the Developers section of your dashboard, or via the API with your session:

http
POST /api/v1/keys{  "name": "my-bot",  "scopes": ["accounts:read", "rooms:read", "trades:read"],  "environment": "live",  "ipAllowlist": [],            // optional  "expiresAt": null,            // optional, epoch ms  "rateLimitRpm": null          // optional, clamped to the plan's rpm}

The response contains the full key once, under key. Store it immediately.

Verify a key

http
POST /api/v1/keys/self-testAuthorization: Bearer tw_live_...
json
{  "success": true,  "data": {    "via": "api_key",    "keyId": "ab12cd34",    "scopes": ["accounts:read", "rooms:read"],    "canTrade": false,    "entitlement": { "enabled": true, "maxKeys": 3, "rpm": 120, "ws": true, "wsConns": 3, "trade": false }  }}

Call this first whenever something returns 403 - it tells you whether the problem is the key, the scope, or the plan.

Revocation

Revocation takes effect on the next request. Any open WebSocket using the key is closed with 1008 KEY_REVOKED. Rotation issues a new secret under the same keyId, so your logs and dashboards keep their grouping - and closes open sockets the same way.

Scopes

ScopeGrants
accounts:readList/get accounts, symbols, connection status; notifications; account WS channels
accounts:writeRename, reconnect, disconnect, sync symbols
accounts:tradePlace / modify / close orders (REST + WS commands + close-all)
rooms:readCopy rooms, dashboards, historical trades, copy events
rooms:writeCreate/pause/resume/archive/edit rooms and receivers
automations:readAutomations, execution logs, dry-run test
automations:writeCreate/update/delete automations and session filters
trades:readTrade events, portfolio analytics, trades SSE channel
profile:readOwn profile
keys:writeNever grantable - key management is session-only

Rules:

  • A key may only hold scopes its plan allows (403 scope_not_in_plan otherwise).
  • accounts:trade additionally requires the plan's trade flag. Even with the scope, the call fails 403 trade_scope_not_in_plan when the plan forbids it.
  • Read/write separation is deliberate: a key that manages copy rooms must not be able to fire orders.

Plan entitlements

Whether an account may use the API at all is decided by its plan, not by the key. API access and MCP are included on Scale and Unlimited:

PlanKeysRequests/minuteSocketsTrading
Scale31203Yes
Unlimited1060010Yes

Behaviour when a subscription lapses:

  • Existing keys are not deleted - they return 403 api_disabled. Re-subscribing restores them instantly.
  • Open WebSockets are not dropped mid-session; new connections are refused.
  • Rate limits tighten on the next request.

Related