Message reference
Every message is a JSON object with a type field.
Messages you send
type | Purpose | Example |
|---|---|---|
subscribe | Subscribe to market data channels | {"type":"subscribe","channels":["orderbook:CC/USDCx"]} |
unsubscribe | Stop receiving channels | {"type":"unsubscribe","channels":["orderbook:CC/USDCx"]} |
auth | Re-authenticate an open connection (usually not needed) | {"type":"auth","api_key":"your-api-key-here"} |
ping | Check the connection | {"type":"ping"} |
place_order | Place an order | {"type":"place_order","id":"c-1","symbol":"CC/USDCx","side":"buy","quantity":10,"price":0.15} |
cancel_order | Cancel one order, by order_id or request_id | {"type":"cancel_order","id":"c-2","request_id":51234} |
cancel_all_orders | Cancel all open orders, optionally for one symbol | {"type":"cancel_all_orders","id":"c-3","symbol":"CC/USDCx"} |
Fields for the order commands are on Placing and cancelling orders.
Messages you receive
type | When | Example |
|---|---|---|
subscribed | After subscribe | {"type":"subscribed","channels":["orderbook:CC/USDCx"]} |
authenticated | After a successful auth | {"type":"authenticated","user_id":12345} |
pong | After ping | {"type":"pong"} |
data | Market data on a channel you subscribed to | {"type":"data","channel":"trades:CC/USDCx","data":{...}} |
user_data | An event on your account | {"type":"user_data","event":"user_order","user_id":12345,"data":{...}} |
order_ack | place_order was queued | {"type":"order_ack","id":"c-1","request_id":51234} |
cancel_ack | cancel_order was queued | {"type":"cancel_ack","id":"c-2","order_id":"51234","already_queued":false} |
cancel_all_ack | cancel_all_orders was queued | {"type":"cancel_all_ack","id":"c-3","canceled_count":2,"already_queued_count":0,"order_ids":["ord_a","ord_b"]} |
auth_expired | Your credential is no longer valid; the connection then closes with 4008 | {"type":"auth_expired","reason":"api_key_revoked","message":"API key revoked or regenerated, please re-authenticate"} |
error | Something was refused or went wrong | {"type":"error","code":"MAX_SUBSCRIPTIONS","message":"Maximum subscriptions reached"} |
Payloads for data and user_data are on Market data channels and User events.
Errors
{"type":"error","id":"c-1","code":"VALIDATION_FAILED","message":"Validation failed","fields":{"quantity":"quantity must be greater than 0"}}| Field | Description |
|---|---|
code | Machine-readable error code (below) |
message | Human-readable description |
id | The order command's id, when the error answers one |
fields | For VALIDATION_FAILED, a message per field, by JSON field name |
A command with a missing id, or one longer than 64 bytes, is not run and gets VALIDATION_FAILED with no id.
Connection, authentication and subscriptions
| Code | Meaning |
|---|---|
INVALID_MESSAGE | The message could not be read or its type is not known |
MAX_SUBSCRIPTIONS | The connection already has 50 subscriptions |
RATE_LIMITED | Too many messages (see Rate limits) |
AUTH_REQUIRED | The connection is not authenticated for what you sent, or its credential is no longer valid and it is closing |
INVALID_API_KEY | The API key was not found |
API_KEY_REVOKED | The API key was revoked |
INVALID_TOKEN, TOKEN_EXPIRED, SESSION_REVOKED | Web-app login (JWT) connections only |
ACCOUNT_LOCKED | The account is locked or suspended |
ACCOUNT_WITHDRAW_ONLY | The account is restricted to withdraw-only access |
IP_ALLOWLIST_DENIED | Your IP address is not on the account's allowlist |
MAINTENANCE_MODE | Trading is halted for maintenance |
INSUFFICIENT_SCOPE | The API key lacks the scope needed |
INTERNAL_ERROR | On API-key authentication, the key could not be checked (retry later), not that it is invalid. On an order command, see below. |
Order commands
Order command errors carry the command's id. Each matches a REST rejection unless marked WebSocket only.
| Code | Meaning |
|---|---|
VALIDATION_FAILED | A field is missing or invalid (REST 400); see fields |
INVALID_SYMBOL | The trading pair does not exist |
MINIMUM_QUANTITY_NOT_MET | The quantity is below the pair's minimum |
MAX_DECIMALS_EXCEEDED | The quantity or price has more decimals than the pair allows |
PRICE_OUTSIDE_COLLAR | WebSocket only: the limit price is outside the matching engine's price collar; the message gives the bound |
SELF_CROSS | The order would only cross your own resting orders |
INSUFFICIENT_BALANCE | Not enough balance for the order |
INSUFFICIENT_FEE_BALANCE | Not enough prepaid trading fees |
ORDER_LIMIT_EXCEEDED | Max open orders reached |
ORDER_RATE_LIMIT_EXCEEDED | Orders per minute reached (per pair, or across the account if it has an account-wide limit) |
RATE_LIMITED | The cancel limit, too many refused orders in the current second, or a key whose rate limit is 0 |
BUSY | WebSocket only: too many commands in progress; retry shortly |
TRADING_PAUSED | Trading is paused (REST 423); cancels still work |
ORDER_NOT_FOUND | Cancel of an order that is not yours, does not exist, or has already left the book (for example filled) |
ORDERS_NOT_ALLOWED | The connection cannot trade: it needs a user's API key with the write scope |
ACCOUNT_LOCKED, ACCOUNT_NOT_AVAILABLE, USER_NOT_KYC_APPROVED, USER_EMAIL_NOT_VERIFIED, NOT_ONBOARDED | The account cannot trade |
INTERNAL_ERROR | Something failed on our side. See the table below. |
INTERNAL_ERROR on place_order. The message tells you whether the order can exist:
message | Was the order placed? |
|---|---|
Order entry is starting; retry shortly | No |
Order entry is not available | No |
Failed to create order request | No, in practice. Nearly all of these come from a check failing before the order is saved. Only a database connection failing at the exact moment of the save can leave the order saved, which is very rare and the same as with a 500 from REST. To be certain, check your open orders (see "Commands with no reply" on Placing and cancelling orders). |
Internal error | Unknown. Treat it like a command with no reply. |
Updated 3 days ago
Did this page help you?

