Errors
Every JSON-RPC error code the ATLAS API returns, grouped by area, with what each means and what to do, plus WebSocket close codes and HTTP statuses.
On this page
Errors use the standard JSON-RPC error object. code tells you exactly what went wrong. message is a short human-readable name for the code. data, when present, carries the order's client id or how long to wait.
{
"jsonrpc": "2.0",
"id": 41,
"error": {
"code": 61,
"message": "Margin exceeded",
"data": { "clOrdId": "0x5f1c9a7e3b2d4c6e8a0b1d3f5e7c9a2b" }
}
}error
codeErrorCode (integer)required- What went wrong. Each code means one thing on every endpoint. See Error codes.
messagestringrequired- The code's name, for example
"Margin exceeded". Do not match on it: branch oncode. dataErrorData- Optional detail, absent when there is none. See Error data.
Error data
error.data is a closed object with at most two fields. Tolerate it being absent.
ErrorData
clOrdIdClientOrderId- The order request's own client id:
clientOrderIdofplaceOrder,cancelOrderorreplaceOrder. Present only once the action decoded, so it is always well formed. The JSON-RPCidis still the correlation key. retryAfterMsinteger- Milliseconds to wait before sending again, when the server knows it: on a rate-limit error (
-20001), on-20015(Venue busy), on65(Open order limit exceeded), and on-10007(Ingress unavailable), which is returned only when the request was not submitted. See Rate limits.
Results, refusals and unknown outcomes
A signed write answers in one of four ways.
| Answer | What it means | What to do |
|---|---|---|
A result with type ending in Accepted or Applied, {"status": "ok", "transferId"} from a transfer or a withdrawal, or {"status": "ok"} from stake, unstake, moveIsolatedMargin, createSubAccount, createSignerPolicy or a key remove | The action took effect. A withdrawal is booked on ATLAS, not yet arrived on the destination chain; an unstake has started its unstaking period | Track it |
An error with a definite code (-32602, -20009, -10013, a protocol refusal and so on) | Refused. Nothing changed, and the nonce was not consumed | Fix the cause. The signed bytes stay admissible until their nonce is used or expires, so sign the corrected request with the same nonce: then only one of the two can ever apply |
-10010 (Trading write timeout), -10011 (Publication unknown), -32603, -20003 (Service unavailable), a code you don't recognise, or no reply | Unknown. It may still apply | Look the txId up with atlas.getTransactionReceipt: committed means it applied. A null receipt proves nothing: check atlas.getTransactions for a recorded refusal, and if there is none, resend the identical signed request. A txId applies at most once |
Resending a signed request that already applied is refused by the nonce check, 290 (Nonce not next) or 21 (Nonce stale): it never applies twice while its key stays bound. See Nonce for the one exception, a gapless key bound again before its old requests expire.
Error codes
Branch on code, never on message. New codes may be added: treat one you don't recognise as non-fatal to the session, and on a signed write as an unknown outcome. A protocol refusal, a signed write the venue refused, uses a small positive code such as 61 (Margin exceeded).
Standard JSON-RPC
| Code | Meaning | What to do |
|---|---|---|
-32700 | Parse error: the body or frame is not valid JSON | Fix the encoding |
-32600 | Invalid request: not a valid JSON-RPC object, an oversized body, or a binary frame | Check jsonrpc, id and method |
-32601 | Method not found | Check the method name and that you are on the right endpoint |
-32602 | Invalid params: wrong types, missing fields, unknown fields, bad enum values, uppercase hex ids, a decimal past its signed scale, bad statements, or a params array of the wrong shape | Fix the params |
-32603 | Internal error. On a signed write, the outcome is unknown | Retry a read with backoff. For a write, look up its txId first |
Shared
| Code | Message | Meaning |
|---|---|---|
-20001 | Rate limit exceeded | Wait data.retryAfterMs. See Rate limits |
-20002 | Authentication required | A private read without a bearer token, or a private stream without sign-in. See HTTP sessions |
-20003 | Service unavailable | The service can't answer right now. Retry with backoff |
-20004 | Subscription not found | atlas.unsubscribe for an id this connection doesn't hold |
-20005 | Subscription limit exceeded | Unsubscribe from something first |
-20006 | Slow consumer subscription killed | Sent as a stream.closed reasonCode: read faster, then resubscribe |
-20007 | Slow consumer connection killed | The connection was closed for reading too slowly. Reconnect with jittered backoff |
-20008 | Symbol not found | Check the symbol |
-20009 | Invalid signature | The signature doesn't verify: high s, v not 0/1, an unknown scheme byte, or a statements text other than the one signed. A digest mode the command doesn't allow is 18 instead. Don't retry as-is |
-20010 | Unknown terms | The terms id or version isn't published. Re-read atlas.getTerms |
-20011 | Terms hash mismatch | The contentHash doesn't match the published document |
-20012 | Terms not in force | That version isn't the one in force |
-20013 | Terms purpose mismatch | The terms document named isn't one this request accepts |
-20014 | Restricted region | Builder onboarding, atlas.getBuilderPayouts and atlas.getBuilderUsers from a restricted or undetermined region. Trading and the public Builder and tier reads are not affected |
-20015 | Venue busy | The venue is at capacity: HTTP 503. Wait data.retryAfterMs (1 second) and retry with backoff. Cancels and reduce-only orders are never refused this way |
Trading gateway
| Code | Message | Meaning |
|---|---|---|
-10003 | Sender mismatch | The signing key is neither the account's owner key nor a key bound to it. Bind the key, or sign with one that is |
-10006 | Ingress busy | Not submitted. Retry with backoff |
-10007 | Ingress unavailable | Not submitted. Retry after data.retryAfterMs |
-10008 | Outcome unavailable | Not submitted. Retry with backoff |
-10009 | Auth unavailable | The account is unknown: on the /seq/ws handshake, onboard over HTTP first. Otherwise retry with backoff |
-10010 | Trading write timeout | No outcome in time. Unknown: look up the txId before resending |
-10011 | Publication unknown | Submission may or may not have happened. Unknown: look up the txId, or resend the same request |
-10013 | Unsupported command | The envelope holds a command this method doesn't take, for example anything but a setInstructionKey bind in atlas.sendWalletReadyRequest |
-10015 | Command disabled | The command is switched off. Don't retry it |
-10017 | Duplicate request id | A JSON-RPC id reused while still in flight on this connection |
-10018 | Handshake timeout | No /seq/ws handshake within 10 seconds |
-10019 | Handshake expired | The handshake's ts_ms is outside the ±60-second window |
-10022 | Market closed to new orders | A new order, a replace, or creating or updating a TP/SL or TWAP on a market closed to new orders. Cancels still go through. Nothing was submitted; don't retry until the market reopens |
Protocol refusals
A signed write the venue refused gets one of these. Nothing changed and the nonce was not consumed. The pre-trade checks page explains the order checks in detail.
Signature, authority and nonce
| Code | Message | Meaning |
|---|---|---|
1 | Envelope malformed | The envelope doesn't decode: a missing proof, or command bytes that aren't the canonical encoding of the command their selector names |
3 | Transaction type not found | The envelope's transaction type byte names no transaction type |
12 | Signature malformed | A signature that isn't in its one canonical form |
16, 17 | Verification scheme not found, Digest mode not found | The scheme byte's low nibble names no verification scheme, or its high nibble no digest mode |
18 | Suite not permitted | The scheme byte names a digest mode this command doesn't take |
218 | Selector not found | The command selector names no command |
246 | Atlas chain id mismatch | The transaction's chainId, or the chainId of a sign-in or login, isn't this deployment's Atlas chain ID (33003) |
329 | Authority mismatch | The transaction's authority isn't the account whose authority its command exercises: the account it names, or that account's Main for an owner-key command |
-11111 | Trading grant required | The signer may not make this request for the account, such as an advanced-order request from a key the account hasn't allowed |
24 | Signer key not found | The signer has no authority on this account or wallet |
28 | Signer key not permitted | The signer's key kind or scope doesn't allow this command, for example the owner key placing an order, or an INSTRUCTION_KEY_SCOPE_REDUCE_ONLY key opening a position, turning the dead-man switch off or lengthening it |
27 | Power row not found | The command named a sub-account where it needs Main |
-11095 | Unauthorized | The signer isn't the key this command needs |
20 | Nonce malformed | The nonce's form doesn't match the slot's mode, or an increasing nonce is zero or has its top bit or reserved bits set. Also a bind of an already bound key that names another nonce mode than its slot's |
290 | Nonce not next | A gapless nonce that isn't exactly last + 1 |
21 | Nonce stale | An increasing nonce not above the channel's last applied one |
22 | Nonce too old | A gapless expires_at that has passed, or an increasing nonce 60 seconds or more behind |
23 | Nonce too far ahead | A gapless expires_at more than 14 days ahead, or an increasing nonce 10 seconds or more ahead |
30 | Wallet pending | The wallet hasn't completed Enable Trading |
219 | Wallet exit only | The wallet may only reduce and exit |
157 | Wallet state transition invalid | Onboarding an exit-only wallet |
115 | Wallet not found | A signed message for an address with no wallet yet: onboard with the bind |
102 | Account not found | A named account doesn't exist, or isn't Main where Main is needed |
-11114 | Not activated | The account isn't activated |
330, 331 | Signer policy not found, Signer policy single signature not permitted | A policy signature for a wallet no policy owns, or a single-key signature for a wallet a policy owns. See atlas.getSignerPolicy |
332, 333, 334 | Signer policy member index invalid, Signer policy signature required, Signer policy member mismatch | A policy proof with an entry out of member order, fewer signatures than the threshold, or a signature that doesn't recover to its member |
Orders
| Code | Message | Meaning |
|---|---|---|
34 | Market not found | The market isn't listed |
44 | Order not found | The target isn't a live order of the account (cancel, replace) |
33 | Client order id already set | A live order of the account already uses this clientOrderId |
32 | Order malformed | The order fails its shape, for example a missing time in force or a malformed clientOrderId |
38 | Order type invalid | Post-only with ioc or fok, or reduce-only with fok on a perp |
40 | Price tick invalid | Price off the tick grid |
42, 43 | Order size out of range, Order size exceeded | Size off the lot grid, or a size or notional below the minimum or above the maximum |
55 | Price collar exceeded | The limit price is outside the band around the last mark |
176 | Close price bound exceeded | A limit order that closes or flips a position is priced past its margin unit's bankruptcy price |
59 | Post only take not permitted | A post-only order would have taken |
69 | Match visit cap exceeded | The order would cross too many resting orders: reduce its size. A GTC or FOK order is refused and nothing changed; an IOC order fills up to that point and expires its remainder |
60 | Open interest cap exceeded | The order could take the market's open interest past its cap |
203 | Account flag mismatch | The market is open only to wallets holding an access flag yours doesn't hold. Reduce-only orders, and spot sells of what you hold, still pass |
326, 328 | Order id exceeded, Book slots exceeded | The market can't take another resting order right now |
47 | Reduce only invalid | reduceOnly on a spot market |
288 | Reduce only budget exceeded | The reduce-only orders would exceed the position |
62 | Balance exceeded | Not enough balance |
61 | Margin exceeded | Not enough margin |
318 | Position notional cap exceeded | The position would exceed its limit |
65 | Open order limit exceeded | Too many open orders for the account's tier, per market or in all: HTTP 429. See Rate limits |
51 | Isolated unit limit exceeded | Too many isolated positions |
49, 50 | Margin mode not permitted, Margin mode mismatch | The margin mode isn't allowed on this market, or differs from the live position's |
302, 303 | Opening margin not permitted, Opening margin invalid | openingMargin on a cross order, or an amount that can't be used |
48 | Position not found | No position to act on |
53, 54 | Margin unit exit only, Liquidation active | The margin unit may only reduce, or is being liquidated |
-11018, -11030, -11031, -11049, -11195 | Risk unavailable, Fx unusable, Fee state unavailable, Margin config unavailable, Mark unusable | Pricing, risk or fee inputs aren't available right now. Retry later |
46 | Builder fee out of range | The Builder Fee rate is outside the venue's range |
45 | Builder fee cap exceeded | The rate is above the signing key's cap for this market class |
93 | Dms timeout out of range | timeoutSeconds isn't 0 or 5 to 86,400 |
227 | Dms round pending | The account's dead-man deadline has passed and its cancels are still running. Retry once they finish |
Keys, accounts and funds
| Code | Message | Meaning |
|---|---|---|
98 | Key ceiling exceeded | The account already holds the maximum number of bound keys |
99 | Key binding not found | A remove of a key that isn't bound to the account |
100 | Builder fee cap out of range | A cap is negative, or above the venue's cap for that market class |
101 | Owner key already set | rotateOwnerKey to the current owner key |
160 | Owner key proof invalid | rotateOwnerKey without a valid proof from the new key |
91 | Sub account allowance exceeded | The wallet holds its maximum of sub-accounts |
264 | Sub account address not permitted | The next sub-account address is already another wallet's account |
9, 103 | Amount invalid, Amount grid invalid | An amount that is zero or negative, out of range, or off its grid (a withdrawal's amount sits on the withdrawal grid) |
132, 180 | Withdrawable exceeded, Removable exceeded | More than the account may move out, or remove from an isolated position |
135, 137 | Transfer destination invalid, Transfer destination not permitted | A transfer to its own source, or an internal transfer out of the wallet |
205 | Asset not found | The asset isn't listed |
206 | Bridge withdrawal route not found | No route for that asset to that zone. atlas.getAssets lists each asset's withdrawalZones |
342 | Bridge withdrawal below minimum | The amount is below the asset's withdrawalMinimum |
256, 158, 141 | Staking asset not permitted, Unstake pending, Unstake exceeded | A stake or unstake that can't apply |
202 | Command size exceeded | A list or text is longer than its cap |
305, 262 | Rate invalid, Balance out of range | A bps rate or an amount outside the range ATLAS can hold |
The remaining protocol codes cover venue administration and should not answer an ordinary client write.
Account reads, sign-in and sessions
| Code | Message | Meaning |
|---|---|---|
-12009 | Forbidden | The bearer token doesn't cover this account |
-12010 | Account mismatch | The signed account doesn't match the request, or a private stream on a connection signed in as another account |
-12012 | Challenge expired | Get a new challenge |
-12013 | Challenge invalid | Not the challenge issued on this connection |
-12014 | Challenge used | Already consumed |
-12015 | Unknown account | The account doesn't exist |
-12016 | Authentication failed | The sign-in or login signature doesn't recover to a key that may act for the account |
-12017 | Already authenticated | This connection is already signed in |
-12018 | Challenge required | auth.signIn without an auth.challenge on this connection |
-12019, -12020 | Token expired, Token invalid | Refresh the access token, or log in again |
-12021, -12022 | Refresh token invalid, Refresh token reused | Log in again. A reused refresh token ends the session |
-12023 | Signature expired | Onboarding: the bind's expires_at has passed or is more than 14 days ahead, or a TermsAcceptance's expiresAt has passed or is more than one day ahead |
-12024 | Not a builder | A Builder read for an account that isn't a builder |
-12025 | Handoff code invalid | auth.redeemHandoff with an unknown, expired or already redeemed code, or the wrong codeVerifier. Nothing was consumed |
Advanced orders
| Code | Message | Meaning |
|---|---|---|
-14001 | Unknown advanced order | No such parent, or one the reader may not read |
-14002 | Version not projected | The read hasn't caught up with minVersion yet. Retry shortly |
-14003 | OMS delegate key mismatch | The delegate key named isn't the account's current one |
A refused advanced-order request is usually not an error: it answers with a result whose result is { "rejected": reason }, and it still spends its advanced-order nonce. The exception is a create on a market closed to new orders, which is refused -10022 and spends no nonce. See Advanced orders.
HTTP statuses
Every JSON-RPC answer, success or error, comes back as HTTP 200, with these exceptions:
| Status | When |
|---|---|
401 | No valid X-Api-Key header, before JSON-RPC is involved. The body is {"error":"authentication required"} |
403 | The IP is over the edge limit. See Edge limit per IP |
429 | Rate limited (-20001) or over the open-order cap (65), including a WebSocket upgrade. The body is the JSON-RPC error |
503 | Venue busy (-20015) |
A 429 or 503 also carries x-ratelimit-limit (the limit's name), x-ratelimit-retry-after-ms and Retry-After headers. Back off on the millisecond value. See Rate limits.
WebSocket close codes
| Close | Meaning |
|---|---|
1008 (Policy Violation) on /seq/ws, after one JSON-RPC error with "id": null | The handshake failed. The reason is "<code> <message>", with one of the handshake codes |
Closed after stream.closed with -20007 for each subscription | Closed for not keeping up (-20007). Every subscription on the connection is gone. Reconnect with jittered backoff |