Skip to content

Conventions

The JSON-RPC envelope, string-encoded numbers, ids, timestamps, sequence numbers and enums used across the ATLAS API.

On this page

Every ATLAS message is a JSON-RPC 2.0 object. Every price, size, amount and most ids are strings. Parse them with a decimal or bigint library, never as a float.

Envelope
Params
Decimals
Timestamps
Account ids
Markets
Stream order

Envelope

Every request names a method, carries params and an id, and gets back exactly one response with the same id. The same envelope is used on HTTP and on WebSocket. Pick Rate limited under the response to see the error shape.

Try itatlas.getTickerHTTP POST
paramsedit me
curl -s https://<api-host>/market/rpc \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"atlas.getTicker","params":{"marketId":4294967297}}'
Sent to testnet by the docs server, which adds the API key
Response
Press Send to see the response.

Request

  • jsonrpc must be "2.0".
  • id is required. It is a string or a whole number. It may not be null or fractional.
  • Do not reuse an id while a request with that id is still in flight on the same connection. The trading WebSocket refuses a reused one with -10017.
  • Responses can arrive out of order. Match them by id.
  • On one /seq/ws connection, signed writes enter the venue in the order you sent them. Their responses may still come back in any order. Separate HTTP requests to POST /seq/tx have no order between them: wait for one answer before sending a write that depends on it.

Params

Every read and subscription method takes a named params object: leave out the optional fields you don't need. A method with no inputs, such as atlas.getTime or auth.challenge, takes no params at all, or {}. The signed writes take a positional array: atlas.sendRawTransaction and atlas.sendRawMessage take "params": ["0x…"], one signed envelope or message as 0x-hex, and atlas.sendWalletReadyRequest takes "params": [kind, rawTx, statements]. See Sign a transaction.

{ "jsonrpc": "2.0", "id": 8, "method": "atlas.getCandles", "params": { "marketId": 4294967297, "interval": "1h", "from": 1791122400000, "to": 1791208800000 } }
{ "jsonrpc": "2.0", "id": 9, "method": "atlas.subscribe",  "params": { "stream": "trades", "marketId": 4294967297 } }
{ "jsonrpc": "2.0", "id": 10, "method": "atlas.sendRawTransaction", "params": [ "0x0011000080ebf39fd6e51aad88f6f4ce6ab8827279cfffb92266…" ] }

Success and error

A response carries exactly one of result or error.

Responseone of 2, by result | error
jsonrpcstringrequired
idstring | integerrequired
resultanyrequired
{ "jsonrpc": "2.0", "id": 2, "result": { "success": true } }

Notifications

Server push is a JSON-RPC notification: it has method and params and no id, so you never answer it. Push methods use the stream. prefix, and params is always an object.

On a WebSocket, responses and notifications share one connection. Responses can come back in a different order from your requests, and notifications can arrive between them. Play the session and click a line to expand it.

WebSocketRequests, responses and a notification on one connectionopen
wss://<ws-host>/market/ws 2 3
  1. + 0ms●connection open
  2. +2030ms//id 8 answered before id 7. Match responses by id, not by order.

How to tell them apart: a message with an id is a response to you; a message with method and no id is a notification.

Stream semantics are on Streams.

Numbers

All of these are JSON strings in plain decimal notation. Scientific notation such as 1e-8 is not allowed.

TypePatternExampleUsed for
DecimalString^-?[0-9]+(\.[0-9]+)?$"-12.5"Signed values
PositiveDecimalString^[0-9]+(\.[0-9]+)?$"100.25"Non-negative values
Pricealias of PositiveDecimalString"70300"Prices
Sizealias of PositiveDecimalString"0.25"Quantities
Amountalias of DecimalString"-3.2"Balances, PnL, fees, funding
SignedSizealias of DecimalString"-0.4"Position size: positive long, negative short
IntegerStringsigned integer string"-1250000"Raw scaled integers
Uint64String^[0-9]+$"18446744073709551615"Nonces, nonce expiries, revisions, positions in a log, parent order ids
Uint256String^[0-9]+$"1"The wallet's EIP-712 domain chainId you send with a sign-in or handshake

Values that are JSON numbers

A few fields are plain JSON numbers. They are small enough to be safe, but don't assume every number is a string.

TypeWhereExample
TimestampMsEvery Unix-millisecond timestamp: timestamp, createdAt, updatedAt, settlementTsMs, expiresAt, candle bounds and so on1791210612345
Uint64NumberOrder and fill seq48213
ATLAS chain idsigning.chainId from atlas.getVersion, and the first signed field of every transaction33003
Integer basis pointsimrBps, mmrBps, passiveCollarBps and similar market parameters500
marketIdEvery market id in results, reads and streams: the market's kind above its 32-bit id (spot id, perp 2^32 + id)4294967297
assetIdEvery asset id. 0 is a listed asset (ZRO), not a placeholder0

Identifiers

TypeFormatNotes
Symbol^[A-Z0-9]+(/[A-Z0-9]+|-[A-Z0-9]+(-(PERP|SPOT))?)$A display label, for example ZRO/USDT. Not a unique market id: more than one market can share a symbol. Identify markets by marketId
AccountAddress^0x[0-9a-fA-F]{40}$The account's 20-byte address. Responses carry lowercase hex. A wallet's first account (Main) has the address of the key that opened it; every sub-account has its own. Never a number or a decimal string
OrderIdopaque string"{kind}:{id}:{seq}", for example "perp:1:48213", in write results, reads and streams alike. Treat it as opaque and use the sibling marketId and seq fields. A cancel or replace names the order by the bare seq with the tagged market
ClientOrderId^0x[0-9a-f]{32}$Your own bytes16 order id (clientOrderId in signed actions, clOrdId in results and reads, named after FIX ClOrdID), lowercase hex. Required on placement. Uppercase is refused with -32602
BuilderId^0x[0-9a-f]{40}$A builder's 20-byte id from enableBuilder. Signed as an EIP-712 address, but it is not the builder's account address
MarketIdinteger in reads; {"SPOT":{"id"}} or {"PERP":{"id"}} in signed commandsFrom atlas.getSymbols. Reads, results and streams use the number, the kind above the 32-bit id. Signed commands name the kind and the id separately, {"PERP":{"id":1}} for 4294967297: spot and perp markets are numbered apart
TxId^0x[0-9a-f]{64}$Identity of a signed transaction: the digest its signature covers, not a hash of the signature. Returned as txId and looked up with atlas.getTransactionReceipt and atlas.getTransactionByHash
TradeIdopaque stringUnique per trade
SubscriptionIdopaque stringValid only on the connection that created it
Signature65array of 65 integers (0 to 255) in the /seq/ws handshake; 0x-hex string in auth.signIn and auth.loginr(32) ‖ s(32) ‖ v(1), v in {0, 1}

Enums

NameValues
Sidebuy, sell
OrderTypelimit, market
TimeInForcegtc, ioc, fok. Post-only is the postOnly flag, not a time in force
OrderStatusaccepted, open, partially_filled, filled, cancelled, rejected, expired
Interval1m, 5m, 15m, 1h, 4h, 1d
Liquiditymaker, taker
PositionSidelong, short
Key scopeINSTRUCTION_KEY_SCOPE_FULL, INSTRUCTION_KEY_SCOPE_REDUCE_ONLY (uppercase)
Key nonceModeGAPLESS, INCREASING (uppercase)
walletStatepending, active, exit_only
stpLevelaccount, wallet
Market status (atlas.getSymbols)ACTIVE, INACTIVE (uppercase)
Market modeNORMAL, REDUCE_ONLY, CLOSE_ONLY on atlas.getSymbols; normal, reduce_only, close_only on tickers

Enum values are case-sensitive.

Sequence numbers

Every stream notification carries seq, a decimal string.

  • It is per subscription. There is no connection-wide sequence.
  • The first event of a subscription is "1". A new subscription starts again at "1".
  • Compare seq as an unsigned integer, not as a string ("10" sorts before "9" as text).
  • A gap, a repeat or a step backwards means your local state is unreliable. Resubscribe. See Streams: recovery.
  • stream.orders and stream.account also number their reports per account and stream, a separate counter you resume from with afterReportNo. See Streams.

Versioning

  • The public API is versioned as v1. Methods live in the atlas. namespace, apart from the auth. methods (auth.challenge, auth.signIn, auth.login, auth.refresh, auth.logout, auth.createHandoff and auth.redeemHandoff), and only methods in the published catalog are public.
  • The signed envelope and its signing domains are on Authentication.
  • atlas.getVersion returns the ATLAS chain id and the transaction signing domain, on /seq/rpc, /account/rpc and /market/rpc. Use it to read the chain id to sign with.

Stability

Stable in v1: method names, params and result fields as documented, the signing bytes (envelopes, type strings, selectors, domains and salts), and error codes.

May change: limits, weights, cadences and retention, and the set of optional fields and enum values.

Build your client to:

  • Ignore fields and enum values it doesn't recognise.
  • Branch on code, never on message. Treat an unknown error code or stream.closed reason code as non-fatal.
  • Treat ids and cursors as opaque.
  • Wait retryAfterMs when an error carries it.

Not supported

These are out of scope for v1. Do not build on them.

  • Resuming market-data streams, or gap-fill on them. Only stream.orders and stream.account resume, from a report number
  • Moving a subscription to another connection
  • Batch subscribe or unsubscribe
  • JSON-RPC batch requests
  • Binary payloads