Skip to content

Trading

Place, replace and cancel orders with atlas.sendRawTransaction, move margin and funds, manage TP/SL and TWAP orders, read every outcome and error, and query orders, fills, advanced orders and funding history.

On this page

Every write is one signed transaction: you build the command, sign it, encode the signed envelope and send it with atlas.sendRawTransaction, over POST /seq/tx or the trading WebSocket /seq/ws. Each request carries exactly one command: place, replace or cancel orders, set the dead-man switch, move isolated margin, transfer, stake or withdraw funds, manage keys, or manage TP/SL and TWAP orders. An applied command answers with a typed result; anything refused answers with a JSON-RPC error whose code says why. Reads of orders, fills, advanced orders and funding are plain HTTP calls.

Writes
Write params
Order commands
Markets
Outcome
Reads
Time in force
Before the first order

How a write works

Every write gets exactly one answer, matched by the JSON-RPC id.

  1. Make sure the wallet is ready and the key you sign with is bound to the account. A deposit only funds the address; one owner signature opens the wallet, binds an app's key and accepts the terms (see enableTrading). Until then every order is refused with 30 (Wallet pending). A key that isn't bound to the account is refused with -10003 (Sender mismatch), and the owner key, unbound, with 28 (Signer key not permitted).
  2. Build the command as JSON (each command below shows its JSON), wrap it in Transaction {chainId, authority, signer, nonce, command}, sign it and encode the signed envelope. How to sign and which nonce to use are on Authentication: sign a transaction.
  3. Send the envelope as the only positional param, "params": ["0x…"], to POST /seq/tx, or on a /seq/ws connection after its handshake.
  4. You get one answer: the command's result if it was applied, or a JSON-RPC error if it was refused or its outcome is unknown.
  5. Fills that come later arrive on stream.orders, which you subscribe to on a separate /account/ws connection. Nothing else is pushed on /seq/ws.

Result or error

An applied command answers with its typed result (with an orderId on a placement). A refusal is a JSON-RPC error with a definite code: nothing changed and the nonce is not consumed, so fix the cause and sign the corrected request with the same nonce. -10010, -10011, -32603 or no reply means the outcome is unknown: look the txId up before you sign anything new. See Errors: results, refusals and unknown outcomes and below.

Once the command decodes, an order request's error echoes its own clientOrderId as error.data.clOrdId, on placeOrder, cancelOrder and replaceOrder. A retryable refusal carries error.data.retryAfterMs. Every code is on Errors.

The same writes work on /seq/ws, which saves a connection per request.

WebSocketPlace, partially fill, cancel on /seq/wsopen
wss://<ws-host>/seq/ws 3 2
  1. + 0ms●connection open
  2. +1300ms//No reply means the handshake was accepted. The connection now takes signed writes.
  3. +3500ms//0.4 filled on arrival, 0.6 rests as perp:1:48213. Later fills arrive on stream.orders over /account/ws, not here.
  4. +6000ms//Cancelled. The 0.4 already filled stays filled.
Raw envelopes are abbreviated. Nonces, signatures and transaction ids are illustrative.

Market and order identity

Markets have two forms. A signed command names its market tagged by kind, {"PERP":{"id":1}} or {"SPOT":{"id":1}}: spot and perp markets are numbered apart. Results, reads and stream subscriptions use one number, the marketId that atlas.getSymbols returns, with the kind above the 32-bit id: spot id, perp 2^32 + id. Perp 1 is 4294967297. Take both from market discovery rather than computing them, and don't use a symbol to identify a market: a symbol is a display label and can name more than one market.

Four ids show up around an order. Keep them straight. The write payloads call a client id clientOrderId; results, errors and reads call it clOrdId.

IdWho sets itFormatWhat it is
Placement id A (clientOrderId on placeOrder)You0x + 32 lowercase hex (bytes16). RequiredNames the live order. Must differ from every live order of the account (33, Client order id already set); free again once its order ends. Results and reads return it as clOrdId. Target an order by it with target.clientOrderId, and read it with atlas.getOrderByClOrdId
Request id C (clientOrderId on cancelOrder, cancelAllOrders and replaceOrder)YouSame. RequiredNames the request itself. Never checked against live orders. Results return it as requestClOrdId. A replaceOrder's C becomes the replacement's clOrdId
Venue id (orderId)ATLAS"{kind}:{id}:{seq}" in results, reads and streams, for example "perp:1:48213". In a write's target.orderId, the bare seq as a string, "48213", with the tagged market in marketIdReturned on acceptance, with seq. Never on a refusal
Transaction id (txId)Derived0x + 64 lowercase hexThe digest the transaction's signature covers: the submission's identity, returned as txId and stamped on the orders and fills it produced. Look it up with atlas.getTransactionReceipt. Not the nonce, and not a hash of the signature

Ids must be lowercase. Uppercase hex is refused with -32602.

The transaction

A transaction is Transaction {chainId, authority, signer, nonce, command}, signed as one. You build it, sign it and encode it yourself. The server only decodes, verifies and executes: there is no JSON form of a write on the wire.

Transaction, before encoding
{
  "chainId": 33003,
  "authority": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
  "signer": "0x3c9e1a7b5d2f4e6a8c0b1d3f5a7c9e2b4d6f8a10",
  "nonce": { "time_stamp_nonce": "469555114762567936" },
  "command": {
    "placeOrder": { "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15", … }
  }
}

chainId is the ATLAS chain id, 33003, from atlas.getVersion signing.chainId (246 otherwise). authority is the account whose authority the command exercises: the account the command names, or, for an owner-key command, that wallet's Main (329 otherwise). signer is the signing key's address, nonce its slot's nonce, and command one command tagged by its kind, naming its account inside its own fields. What each field must hold is on Authentication: sign a transaction and Nonce.

Signing is Opaque (0x01) or Typed EIP-712 (0x11), as each command allows: see Signing domains and the Typed type strings below. The byte layout of rawTx is on Authentication: the envelope, and every command's selector and encoding on Action encoding.

Send a transaction

atlas.sendRawTransaction

atlas.sendRawTransactionHTTP or WebSocket/seq/tx · /seq/ws auth

Submits one signed transaction and answers with its result or its refusal. Weight 1. One command per request: there is no batch.

rawTxstringrequired
Request: POST /seq/tx
{
  "jsonrpc": "2.0",
  "id": 41,
  "method": "atlas.sendRawTransaction",
  "params": ["0x0011000080eb8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f153c9e1a7b5d…"]
}
PathWhat it serves
POST /seq/txatlas.sendRawTransaction, atlas.sendWalletReadyRequest and atlas.sendRawMessage for every public command
wss://<ws-host>/seq/wsThe same methods with the same results, after the handshake. Optional
POST /seq/rpcatlas.getVersion and atlas.getTime only

Supported commands

CommandWhat it doesSigned bySigning
placeOrderPlace a limit or market orderA key bound to the accountOpaque or Typed
cancelOrderCancel one orderA key bound to the accountOpaque or Typed
replaceOrderReplace a resting order, losing priorityA key bound to the accountOpaque or Typed
cancelAllOrdersCancel every order of the account in one marketA key bound to the accountOpaque or Typed
cancelAllOrdersAfterArm, refresh or disarm the dead-man switchA key bound to the account, any scopeOpaque or Typed
moveIsolatedMarginAdd or remove isolated collateralA Full key bound to the accountOpaque or Typed
internalTransferMove funds between accounts of one walletA Full key bound to the accountOpaque or Typed
stake, unstakeStake an asset, or start unstaking itA Full key bound to the accountOpaque or Typed
transferMove funds to any accountOwner keyTyped
withdrawWithdraw to another Zero zoneOwner keyTyped
setStpLevelSet the wallet's self-trade prevention levelOwner keyTyped
createSubAccountOpen a sub-accountOwner keyTyped
setInstructionKey, rotateOwnerKeyBind or remove a key, replace the owner keyOwner keyTyped
createSignerPolicyCreate a multi-sig signer policyOwner keyTyped
createTpSlOrder, updateTpSlOrder, cancelTpSlOrderTP/SL ordersOwner key or an advance instruction keyTyped
createTwapOrder, cancelTwapOrder, cancelAllTwapsTWAP ordersOwner key or an advance instruction keyTyped
setAdvanceInstructionKeyLet a key manage the account's TP/SL and TWAP ordersOwner keyTyped

enableTrading and enableBuilder aren't transactions: see atlas.sendWalletReadyRequest and atlas.sendRawMessage.

Who may sign. A trading command needs a key bound to the account. The owner key is no exception: it signs orders only once it is bound to the account itself, otherwise 28 (24 on a sub-account). INSTRUCTION_KEY_SCOPE_FULL signs every trading command; INSTRUCTION_KEY_SCOPE_REDUCE_ONLY signs cancels, reduce-only orders and a dead-man switch that arms or shortens. A command outside the key's scope is 28. See Authentication: who signs what.

placeOrder

placeOrder places one limit or market order, chosen by orderType. Every flag is required: there are no defaults.

accountAccountAddressrequired
marketIdMarketIdrequired
clientOrderIdClientOrderIdrequired
sideenumrequired
quantitydecimal stringrequired
orderTypeenumrequired
pricedecimal string
postOnlyboolean
timeInForceenumrequired
marginModeenumrequired
openingMargindecimal string
reduceOnlybooleanrequired
builderFeeBuilderFee
›Show 2 child fields
appBuilderIdBuilderIdrequired
builderFeeBpsdecimal stringrequired
placeOrder: limit buy 1 BTC at 70,300, GTC (before encoding)
{
  "placeOrder": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "marketId": { "PERP": { "id": 1 } },
    "clientOrderId": "0x5f1c9a7e3b2d4c6e8a0b1d3f5e7c9a2b",
    "side": "buy",
    "quantity": "1",
    "orderType": "limit",
    "price": "70300",
    "postOnly": false,
    "timeInForce": "gtc",
    "marginMode": "cross",
    "reduceOnly": false
  }
}
placeOrder: open an isolated long with 2,000 USDT of margin and a 2 bps Builder Fee (before encoding)
{
  "placeOrder": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "marketId": { "PERP": { "id": 1 } },
    "clientOrderId": "0x7a3c5e9b1d4f6a8c0e2b4d6f8a1c3e5b",
    "side": "buy",
    "quantity": "0.5",
    "orderType": "limit",
    "price": "70100",
    "postOnly": true,
    "timeInForce": "gtc",
    "marginMode": "isolated",
    "openingMargin": "2000",
    "reduceOnly": false,
    "builderFee": {
      "appBuilderId": "0x1d4e7a2c9b5f3e8a6c0d2b4f7e9a1c3b5d8f0a26",
      "builderFeeBps": "2"
    }
  }
}

A market order has no price and no postOnly. ATLAS bounds it at the market's protective cap: gtc rests what doesn't fill at that bound price, ioc expires it, and fok fills the whole quantity inside the bound or is killed whole. If no price is available to bound it, the order is refused.

placeOrder: market sell 0.5 BTC, IOC (before encoding)
{
  "placeOrder": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "marketId": { "PERP": { "id": 1 } },
    "clientOrderId": "0x8e2d4f6a1c3b5d7e9f0a2c4e6b8d1f3a",
    "side": "sell",
    "quantity": "0.5",
    "orderType": "market",
    "timeInForce": "ioc",
    "marginMode": "cross",
    "reduceOnly": false
  }
}

A FOK order fills in full or is cancelled whole, with no fill and no fee; your own self-trade group's orders don't count toward it. See FOK.

There is no per-order self-trade prevention field: the wallet's setStpLevel applies to every order. See Self-trade prevention.

An order that reduces a perp position can't be priced past the position's bankruptcy price: a limit past it is 176, and a market order is bound to it. See Closing orders and the bankruptcy price.

A reduce-only order can trim your other resting orders on the same side; read trimmedSize on the Order. See Your older orders make room.

cancelOrder

Cancels one live order of account on marketId. Name the order by exactly one of its venue id or its placement id A. A refusal leaves the order unchanged.

accountAccountAddressrequired
clientOrderIdClientOrderIdrequired
marketIdMarketIdrequired
targetOrderTargetrequired
›Show 2 child fields
orderIdstring
clientOrderIdClientOrderId
cancelOrder: by placement id A (before encoding)
{
  "cancelOrder": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "clientOrderId": "0x9a1c3e5b7d0f2a4c6e8b0d2f4a6c8e1b",
    "marketId": { "PERP": { "id": 1 } },
    "target": { "clientOrderId": "0x5f1c9a7e3b2d4c6e8a0b1d3f5e7c9a2b" }
  }
}
cancelOrder: by venue id (before encoding)
{
  "cancelOrder": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "clientOrderId": "0x9a1c3e5b7d0f2a4c6e8b0d2f4a6c8e1c",
    "marketId": { "PERP": { "id": 1 } },
    "target": { "orderId": "48213" }
  }
}

The result is cancelApplied. No live order of the account on marketId matching target is 44 (Order not found).

replaceOrder

Swaps a resting order for a new limit order in one step. The old order is removed only after the replacement is admitted. If the replacement is refused, the old order stays on the book in its queue place and no order is created.

The replacement keeps the target's side, margin mode and Builder Fee, and is always gtc. It is a new order with its own orderId: it goes to the back of the queue at its price, even if the price is unchanged and the quantity smaller. It opens no isolated position, so it takes no opening margin. Its Builder Fee is checked against the signing key's cap like a placement's. If the target carries TP/SL protection, a replacement with a fresh clientOrderId keeps it: later fills of the replacement arm the same parent.

accountAccountAddressrequired
marketIdMarketIdrequired
targetOrderTargetrequired
clientOrderIdClientOrderIdrequired
quantitydecimal stringrequired
pricedecimal stringrequired
postOnlybooleanrequired
reduceOnlybooleanrequired
replaceOrder: move a resting bid from 70,300 to 70,250 (before encoding)
{
  "replaceOrder": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "marketId": { "PERP": { "id": 1 } },
    "target": { "orderId": "48213" },
    "clientOrderId": "0x1b3d5f7a9c0e2b4d6f8a1c3e5b7d9f0a",
    "quantity": "0.6",
    "price": "70250",
    "postOnly": false,
    "reduceOnly": false
  }
}

The result is replaceOrderApplied: txId, accountAddress, requestClOrdId (your C), the target as you named it (origOrderId, or origClOrdId), and the new order's marketId, orderId, seq, filledSize, avgFillPrice, leavesQty, immediateOutcome and iocRemainder, read as on placeOrderAccepted. An unknown target is 44; the replacement can also fail any check placeOrder does.

There is no amend that keeps queue priority. To reduce an order, replace it; to close a position, send a reduce-only order.

cancelAllOrders

Cancels every working order of one account in one market, whichever key placed it. Sub-accounts are not included. A market with nothing to cancel still succeeds. To cancel in every market, send one per market. See Mass cancel.

cancelAllOrders (before encoding)
{
  "cancelAllOrders": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "clientOrderId": "0x4d2b6f8a0c1e3a5c7e9b1d3f5a7c9e2b",
    "marketId": { "PERP": { "id": 1 } }
  }
}

The result is cancelAllOrdersApplied with txId, accountAddress and cancelledCount. A market that isn't listed is 34 (Market not found).

cancelAllOrdersAfter

Sets the account's dead-man switch: one clock per account, covering every working order on it. timeoutSeconds is 0 (off) or 5 to 86,400; anything else is 93. Any key bound to the account may sign it. A Reduce Only key may arm the switch or shorten it, but turning it off or lengthening it needs a Full key (28).

cancelAllOrdersAfter: cancel everything if not refreshed within 60 seconds (before encoding)
{
  "cancelAllOrdersAfter": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "timeoutSeconds": 60
  }
}

The result is cancelAllOrdersAfterApplied: txId, accountAddress, receivedAtNs and deadlineNs (absent when you turned it off), in Unix nanoseconds as decimal strings.

moveIsolatedMargin

Moves settlement cash between the account's cross balance and its isolated position on one market. Leverage is not set per market: an isolated position's leverage follows from its margin, so open it with openingMargin and adjust it here.

accountAccountAddressrequired
marketIdMarketIdrequired
directionenumrequired
amountdecimal stringrequired
moveIsolatedMargin: add 500 USDT to the BTC isolated position (before encoding)
{
  "moveIsolatedMargin": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "marketId": { "PERP": { "id": 1 } },
    "direction": "add",
    "amount": "500"
  }
}

It needs a Full key; a Reduce Only key is 28. The answer is { "status": "ok" } once the move applies, or its refusal, and nothing moves, when: the account holds no isolated position on the market (48), the wallet is pending (30), a liquidation is active (54), an add exceeds what cross can release (132), or a remove exceeds what the position can release (180).

setStpLevel

Sets which of a taker's own orders self-trade prevention cancels, for every account of the wallet. Only the wallet's owner key may sign it, Typed only.

accountAccountAddressrequired
levelenumrequired
setStpLevel (before encoding)
{ "setStpLevel": { "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15", "level": "wallet" } }

A wallet starts at account, and an account created later takes the wallet's current level. The level applies to every order of the wallet, resting orders included, from the next match; setting it cancels nothing. The result is setStpLevelApplied: wallet, level, committed. An instruction key is refused with 28. See Self-trade prevention.

createSubAccount

Opens a new sub-account in a wallet. account names the wallet's Main. The owner key signs it, Typed only, and the new account inherits that key. Each wallet has an allowance of sub-accounts; one past it is 91.

accountAccountAddressrequired
bindingobject
›Show 4 child fields
instructionKeyaddressrequired
scopeenumrequired
builderFeeCapobjectrequired
nonceModeenumrequired
createSubAccount (before encoding)
{
  "createSubAccount": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "binding": {
      "instructionKey": "0x3c9e1a7b5d2f4e6a8c0b1d3f5a7c9e2b4d6f8a10",
      "scope": "INSTRUCTION_KEY_SCOPE_FULL",
      "builderFeeCap": { "perpBps": "2", "spotBps": "10" },
      "nonceMode": "INCREASING"
    }
  }
}

The answer is { "status": "ok" } once the account is created, or its refusal (91 at the allowance). Read the new address with atlas.getAccounts. A key bound with nonceMode INCREASING on the new account can be refused 21 for a short time after the account is created: retry with backoff. See Authentication: increasing.

Key commands

The wallet's owner key binds keys to its accounts and removes them with setInstructionKey, and replaces itself with rotateOwnerKey. Both are Typed only. Each binding is per account and carries its own scope, Builder Fee cap and nonce mode. What keys can do, and how to bind one, is on Instruction keys and Authentication: keys and authority.

Key commandone of 2, by kind
accountAccountAddressrequired
instructionKeyaddressrequired
changeobjectrequired
›Show 4 child fields
scopeenum
builderFeeCapobject
nonceModeenum
statementsStatement[]
setInstructionKey: bind a bot key (before encoding)
{
  "setInstructionKey": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "instructionKey": "0x3c9e1a7b5d2f4e6a8c0b1d3f5a7c9e2b4d6f8a10",
    "change": {
      "kind": "bind",
      "scope": "INSTRUCTION_KEY_SCOPE_FULL",
      "builderFeeCap": { "perpBps": "2", "spotBps": "10" },
      "nonceMode": "INCREASING",
      "statements": []
    }
  }
}

A bind of a key already bound replaces its scope and caps and keeps its nonce slot. It must name the slot's nonce mode: another mode is 20, and changes nothing. To change mode, remove the key and bind it again. A lower cap applies to new orders only. A bind answers setInstructionKeyApplied with txId, accountAddress and stampedAtMs, the time the bind was stamped, which sets when an increasing-nonce key may first sign: see Authentication: nonce. An account already holding its maximum number of keys is 98. A remove answers { "status": "ok" } once applied, or its refusal, and cancels nothing: the key's resting orders stay on the book. Removing a key that isn't bound is 99.

createSignerPolicy creates a signer policy, an owner made of keys that must co-sign. Any owner key signs it, with a threshold and the members' addresses sorted in ascending order, and every member signs its consent to join. The write answers { "status": "ok" }; the policy's identity (its own address), threshold and members are in the write's record in atlas.getTransactions, found by its txId, and in atlas.getSignerPolicy. It changes no wallet's owner: to move a wallet to the policy, sign rotateOwnerKey with the policy's identity as newOwnerKey and a proof from every member, not only the threshold. See Multi-sig.

Transfers and withdrawals

account is the sending account in each. Amounts are decimal strings, signed at 12 decimal places whatever the asset's own scale. asset is the asset's id from atlas.getAssets. See Withdrawals and transfers.

CommandPayloadSigned byAnswer
internalTransferaccount, toAccount (an account of the same wallet), asset, amount, optional memo (0x + 128 hex)A Full key bound to account{ "status": "ok", "transferId" } once booked, or the refusal
transferaccount, toAccount (any account, in this wallet or another), asset, amount, optional memoThe wallet's owner key{ "status": "ok", "transferId" } once booked, or the refusal. A transfer booked into another wallet can't be reversed
withdrawaccount, asset, amount, destinationZone, receiver, optional memoThe wallet's owner key{ "status": "ok", "transferId" } once booked on ATLAS, or the refusal. Not arrival on the destination zone
internalTransfer: 1,000 USDT from Main to a sub-account (before encoding)
{
  "internalTransfer": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "toAccount": "0x2c7e9a4b1f6d3c8e5a0b7f2d9c4e1a6b3f8d5c27",
    "asset": 1,
    "amount": "1000"
  }
}

transferId is the request's txId: atlas.getTransfers reports it once booked, and atlas.getLedger shows the memo on an internal transfer's rows. The fee is 0. Refusals, nothing moved: 9 (zero amount, or finer than the asset's scale), 135 (toAccount is account), 137 (internalTransfer to another wallet), 205 (unknown asset), 54 (liquidation active), 62 (balance, less what resting spot orders reserve, below amount), 132 (above the withdrawable balance). A transfer to another wallet from a pending or exit-only wallet is 30 or 219; transfers between accounts of one wallet go through in any wallet state.

withdraw sends funds to another Zero zone. ATLAS debits amount and the zone pays receiver the whole amount: there is no withdrawal fee.

accountAccountAddressrequired
assetinteger (u32)required
amountdecimal stringrequired
destinationZoneinteger (u32)required
receiverstringrequired
memostring
withdraw: 250 USDT (before encoding)
{
  "withdraw": {
    "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "asset": 1,
    "amount": "250",
    "destinationZone": 43002,
    "receiver": "0x0000000000000000000000008f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15"
  }
}

The zone id is illustrative. The answer comes once the withdrawal is booked on ATLAS; transferId is its withdrawal id: track it with atlas.getWithdrawal. A booked withdrawal can't be reversed. Arrival on the destination zone comes later.

Staking

stake moves amount of asset from the account's cross balance into its staking position for that asset; unstake moves it into a pending unstake, which returns to the cross balance whole at the first session boundary after the unstake period. Both take account, asset and amount, need a Full key bound to the account, and answer { "status": "ok" } once applied, or with the refusal. A successful unstake starts the unstake period: the funds are not available yet. Staked funds back no margin.

stake: 5,000 ZRO (before encoding)
{ "stake": { "account": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15", "asset": 0, "amount": "5000" } }

Refusals, nothing moved: a stake of an asset that can't be staked (256), from a pending wallet (30) or above the withdrawable balance (132); an unstake while one is already pending for the asset (158) or above the staked amount (141). Read the result on atlas.getBalances or atlas.getStakingState.

Advanced orders

TP/SL and TWAP orders are held by ATLAS's advanced-order service, not the matching engine. A parent runs one strategy, tpSl or twap, and places ordinary orders, its children, on the book with the account's delegate key, which you bind first. Send the advanced-order commands with atlas.sendRawTransaction, on POST /seq/tx or /seq/ws, like any other command. Read parents with atlas.getAdvancedOrders and atlas.getAdvancedOrder.

  1. Get the delegate key

    atlas.getOmsDelegateKey returns the public key the service signs the account's child orders with. It grants nothing.

  2. Bind it

    Bind its address with setInstructionKey: INSTRUCTION_KEY_SCOPE_REDUCE_ONLY for TP/SL on a live position or a reduce-only TWAP, INSTRUCTION_KEY_SCOPE_FULL for a TP/SL entry order or a TWAP that opens a position. Use nonceMode INCREASING: the service signs child orders with an increasing nonce and places none under a GAPLESS binding. Set builderFeeCap at or above the Builder Fee your parents carry on that market class. A create above it is refused 45 and spends no nonce, so fix the cap or the fee and sign again with the same nonce. If the cap is lowered later, children go out at the new cap, or with no Builder Fee at 0, so a stop still fires. The parent the service stores keeps its own fee, so if the cap is raised again, the children it sends after that carry the full fee.

  3. Create the parent

    Sign createTpSlOrder or createTwapOrder with the owner key, or with a key you bound with setAdvanceInstructionKey.

The advanced-order commands sign Typed only, under the service's own domain, { name: "atlas", version: "1", chainId, salt: keccak256("atlas/oms") }, where chainId is the wallet's chain, as for any Typed transaction. Their type strings sign Transaction(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,CreateTpSlOrderV2 action) and so on, with authority the account. They use the same envelope as every other transaction, always with a gapless nonce.

Their nonce is one gapless sequence per signer, separate from its trading nonces. Read the last spent value with atlas.getOmsNonce and sign the next one, with an expiry; a { "rejected": … } result spends its nonce too. Its expires_at follows the gapless rules: a passed expiry is refused 22, one too far ahead 23, and a nonce that isn't last + 1 290. These are JSON-RPC errors and spend no nonce. See Authentication: advanced orders.

Their payloads name the account accountAddress and their own id clOrdId, and carry a flat appBuilderId and builderFeeBps. marketId is the tagged market, as on placeOrder.

TP/SL orders

A TP/SL parent holds a take profit (tp), a stop loss (sl) or both for one position; each side watches a trigger and, when it fires, places a reduce-only close for the whole position at that moment. See Take profit and stop loss.

TP/SL commandone of 3, by kind
accountAddressAccountAddressrequired
marketIdMarketIdrequired
clOrdIdClientOrderIdrequired
marginModeenumrequired
tpSlotPlan
›Show 5 child fields
triggerRefenumrequired
triggerPricedecimal stringrequired
orderTypeenumrequired
limitPricedecimal string
timeInForceenumrequired
slSlotPlan
entryEntryPlan
›Show 7 child fields
sideenumrequired
baseQtydecimal stringrequired
orderTypeenumrequired
limitPricedecimal string
timeInForceenumrequired
postOnlyboolean
openingMargindecimal string
appBuilderIdBuilderId
builderFeeBpsdecimal string

One open TP/SL parent per account, market and margin mode: a second create is refused whole as occupied, and its parentOrderId names the open one. Add or change a side with updateTpSlOrder.

createTpSlOrder: TP and SL on a live 1 BTC long (before encoding)
{
  "createTpSlOrder": {
    "accountAddress": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "marketId": { "PERP": { "id": 1 } },
    "clOrdId": "0x2c4e6a8b0d1f3e5a7c9b2d4f6a8c0e1d",
    "marginMode": "cross",
    "tp": { "triggerRef": "mark", "triggerPrice": "73000", "orderType": "limit", "limitPrice": "72950", "timeInForce": "gtc" },
    "sl": { "triggerRef": "mark", "triggerPrice": "68000", "orderType": "market", "timeInForce": "ioc" }
  }
}
createTpSlOrder: a 0.1 BTC isolated entry at 5x with an SL, the BTC mark at 70,000 USDT (before encoding)
{
  "createTpSlOrder": {
    "accountAddress": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "marketId": { "PERP": { "id": 1 } },
    "clOrdId": "0x7a1c3e5b9d2f4a6c8e0b1d3f5a7c9e2b",
    "marginMode": "isolated",
    "entry": { "side": "buy", "baseQty": "0.1", "orderType": "limit", "limitPrice": "70000", "timeInForce": "gtc", "postOnly": true, "openingMargin": "1400" },
    "sl": { "triggerRef": "mark", "triggerPrice": "66000", "orderType": "market", "timeInForce": "ioc" }
  }
}

A side that has fired keeps its close order working if the position later goes flat or flips, and it can then open a position the other way: cancel the parent with cancelTpSlOrder, or the close with cancelOrder. See When ATLAS cancels a TP or SL.

TWAP orders

A TWAP parent sends a total quantity as a series of child orders until a fixed deadline. Completion by the deadline is not guaranteed: what is unfilled at the deadline stays unfilled. See TWAP.

TWAP commandone of 3, by kind
accountAddressAccountAddressrequired
marketIdMarketIdrequired
clOrdIdClientOrderIdrequired
marginModeenumrequired
twapTwapPlanrequired
›Show 4 child fields
sideenumrequired
baseQtydecimal stringrequired
durationSecondsintegerrequired
reduceOnlyboolean
appBuilderIdBuilderId
builderFeeBpsdecimal string

An account runs at most one TWAP per market: a second create is occupied. A total that isn't whole lots, is below twice the market's minimum order value at the current mark, or needs a slice above the market's maximum order is plan.

createTwapOrder: buy 2 BTC over one hour (before encoding)
{
  "createTwapOrder": {
    "accountAddress": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "marketId": { "PERP": { "id": 1 } },
    "clOrdId": "0x3e5a7c9b1d2f4e6a8c0b2d4f6a8c1e3b",
    "marginMode": "cross",
    "twap": { "side": "buy", "baseQty": "2", "durationSeconds": 3600, "reduceOnly": false }
  }
}
Advance instruction keys

setAdvanceInstructionKey lets another key create, update and cancel every advanced order of the account, or removes that permission. That key signs only advanced-order requests; it can't trade. Only the owner key may sign it, Typed only; any other signer is -11111, spending no nonce.

accountAddressAccountAddressrequired
instructionKeyaddressrequired
changeobjectrequired
›Show 1 child field
omsDelegateKeystring
setAdvanceInstructionKey: bind a key (before encoding)
{
  "setAdvanceInstructionKey": {
    "accountAddress": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "instructionKey": "0x5b7d9f1a3c5e7b9d2f4a6c8e0b1d3f5a7c9e2b4d",
    "change": {
      "kind": "bind",
      "omsDelegateKey": "0x04b2e6d8f0a4c1e3b5d7f9a2c4e6b8d0f1a3c5e7b9d2f4a6c8e0b1d3f5a7c9e2b4d6f8a1c3e5b7d9f0a2c4e6b8d1f3a5c7e9b2d4f6a8c0e1d3f5a7b9c2e4d6f8a1"
    }
  }
}

The binding lasts while that delegate key does: once it is revoked or replaced, bind the key again to the new one. Binding a pair already bound is accepted and changes nothing. A remove of a key that isn't bound answers { "rejected": "keyNotBound" }; parents already placed stay live. The answer is setAdvanceInstructionKeyResult: the request's accountAddress, instructionKey and change, result and version.

Advanced-order results

Each command answers once the service has decided, with type (createAdvancedOrderResult, updateAdvancedOrderResult or cancelAdvancedOrderResult), accountAddress, clOrdId, parentOrderId (or null), version, and result: "accepted" or { "rejected": reason }. A result is not by itself an acceptance: check result. accepted says nothing of the orders it places: follow those on stream.orders. Pass version as minVersion to the reads to see at least that state. A create on a market closed to new orders gets no result: it is refused with JSON-RPC error -10022 (Market closed to new orders) and spends no nonce, as placeOrder and replaceOrder are there. An update there answers { "rejected": "marketAdmissionClosed" }. Cancels still go through.

ReasonMeaning
notOwnerThe target is another account's parent
unknownTargetNo parent answers to the target, or it runs another strategy than the request's
notOpenThe parent has ended, the side's close was already sent, or the side to cancel is missing or ended
occupiedAn open TP/SL parent already holds this account, market and margin mode, or a running TWAP already holds this account and market
underWorkThe position is being liquidated
reduceOnlyAccount controls forbid it
accountThe account can't hold advanced orders
malformedA plan breaks a rule above, no side was sent, there is no position and no entry, or the Builder Fee is invalid
instrumentThe strategy isn't offered on this market
planA TWAP total that isn't whole lots, is below its starting floor, needs a slice above the market's maximum order, or has no mark to plan with
delegateKeyNotLivesetAdvanceInstructionKey named a delegate key that isn't the account's current one
keyNotBoundsetAdvanceInstructionKey removed a key that isn't bound
marketAdmissionClosedAn update of a parent whose market is closed to new orders
openingMarginNotPermittedAn entry names openingMargin but doesn't create the market's isolated pool: the parent is cross, or the account's pool on the market exists, even flat with cash left in it
openingMarginInvalidAn entry's openingMargin is zero or negative
createAdvancedOrderResult
{
  "jsonrpc": "2.0",
  "id": 51,
  "result": {
    "type": "createAdvancedOrderResult",
    "accountAddress": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "clOrdId": "0x2c4e6a8b0d1f3e5a7c9b2d4f6a8c0e1d",
    "parentOrderId": "90211",
    "result": "accepted",
    "version": "4410"
  }
}

After -10011 (Publication unknown), a timeout or a lost answer the outcome is unknown, not refused: resend the same signed request rather than signing a new one. It applies at most once: if the resend gets a result, that is the outcome; a copy of one already applied is refused, usually 290, and that refusal doesn't say which copy applied. To settle it, read atlas.getOmsNonce for the signer. At or past the request's nonce, that nonce was spent (by this request, if you signed that nonce for nothing else); below it, the read may be behind, so read again. A spent nonce is not an acceptance: an accepted create leaves a parent with its clOrdId in atlas.getAdvancedOrders, open or closed, and a rejected one leaves none.

Results

The result is a closed union, tagged on type. Branch on type. Compare decimal strings numerically, not as text.

CommandResult
placeOrderplaceOrderAccepted
cancelOrdercancelApplied
replaceOrderreplaceOrderApplied
cancelAllOrders, cancelAllOrdersAftercancelAllOrdersApplied, cancelAllOrdersAfterApplied
setStpLevel, rotateOwnerKeysetStpLevelApplied, rotateOwnerKeyApplied
setInstructionKey bindsetInstructionKeyApplied
internalTransfer, transfer, withdraw{ "status": "ok", "transferId" }: booked
moveIsolatedMargin, stake, unstake{ "status": "ok" }: applied
createSubAccount, setInstructionKey remove{ "status": "ok" }: applied
TP/SL and TWAPcreateAdvancedOrderResult, updateAdvancedOrderResult, cancelAdvancedOrderResult
setAdvanceInstructionKeysetAdvanceInstructionKeyResult

Apart from the advanced-order commands, there are no …Rejected results: a refusal is a JSON-RPC error.

Order resultone of 2, by type

Track the order by orderId. Read immediateOutcome, leavesQty and iocRemainder to see what happened on arrival.

typestringrequired
txIdstringrequired
accountAddressAccountAddressrequired
clOrdIdClientOrderIdrequired
marketIdintegerrequired
sideenumrequired
orderTypeenumrequired
pricePrice
sizeSizerequired
filledSizeSizerequired
avgFillPricePricerequired
leavesQtySizerequired
orderIdOrderIdrequired
seqUint64Numberrequired
immediateOutcomeenumrequired
iocRemainderIocRemainderrequired
›Show 2 child fields
kindstringrequired
expiredSizeSize
placeOrderAccepted: limit, 0.4 filled on arrival, 0.6 rests
{
  "jsonrpc": "2.0",
  "id": 41,
  "result": {
    "type": "placeOrderAccepted",
    "txId": "0x27ca64c092a959c7edc525ed45e845b1de6a7590d173fd2fad9133c8a779a1e3",
    "accountAddress": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "clOrdId": "0x5f1c9a7e3b2d4c6e8a0b1d3f5e7c9a2b",
    "marketId": 4294967297,
    "side": "buy",
    "orderType": "limit",
    "price": "70300",
    "size": "1",
    "filledSize": "0.4",
    "avgFillPrice": "70220",
    "leavesQty": "0.6",
    "orderId": "perp:1:48213",
    "seq": 48213,
    "immediateOutcome": "partial",
    "iocRemainder": { "kind": "notApplicable" }
  }
}
placeOrderAccepted: market IOC, filled
{
  "jsonrpc": "2.0",
  "id": 42,
  "result": {
    "type": "placeOrderAccepted",
    "txId": "0x0bf474896363505e5ea5e5d6ace8ebfb13a760a409b1fb467d428fc716f9f284",
    "accountAddress": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
    "clOrdId": "0x8e2d4f6a1c3b5d7e9f0a2c4e6b8d1f3a",
    "marketId": 4294967297,
    "side": "sell",
    "orderType": "market",
    "size": "0.5",
    "filledSize": "0.5",
    "avgFillPrice": "70140",
    "leavesQty": "0",
    "orderId": "perp:1:48214",
    "seq": 48214,
    "immediateOutcome": "filled",
    "iocRemainder": { "kind": "expired", "expiredSize": "0" }
  }
}
ExampleThe same limit order as IOC, then as FOKIOC / FOK
  • Best offers are 0.3 BTC at 70,200 and 0.1 BTC at 70,280.
  • IOC: you get filledSize: "0.4", leavesQty: "0", immediateOutcome: "partial" and iocRemainder: { "kind": "expired", "expiredSize": "0.6" }.
  • FOK: only 0.4 of 1 can fill, so the order is killed whole: filledSize: "0", leavesQty: "0", immediateOutcome: "partial", iocRemainder: { "kind": "notApplicable" }. No fill, no fee.

Errors

Every refusal is a JSON-RPC error. code says why; message is human-readable (do not match on it); data, when present, carries clOrdId (the order request's own clientOrderId) and retryAfterMs.

A placement refused by a pre-trade check
{
  "jsonrpc": "2.0",
  "id": 41,
  "error": {
    "code": 40,
    "message": "Price tick invalid",
    "data": { "clOrdId": "0x5f1c9a7e3b2d4c6e8a0b1d3f5e7c9a2b" }
  }
}
CodeWhat it meansWhat to do
-32700 to -32600The request is malformed: bad JSON, envelope or params, uppercase ids, a price or postOnly on a market orderFix the request
-20009, 18The signature does not verify, or the digest mode isn't allowed for the command (18)Fix the signing code
246, 329The transaction names another deployment's chain id, or the wrong authorityRead signing.chainId from atlas.getVersion; set authority as described under The transaction
-10013, 218, -10015Not a public command, an unknown command selector, or a command switched offSend a supported command
-10003, 24, 28, -11095, -11111The key isn't bound to the account, its scope doesn't allow the command, or the signer may not act for the accountBind the key, or sign with one that may
20, 21, 22, 23, 290Nonce malformed, stale, too old, too far ahead, or not the next gapless valueSign again with a correct nonce. See Authentication: nonce
30, 219The wallet is pending (not yet ready to trade) or exit-onlyComplete enableTrading; an exit-only wallet can only reduce
Other positive codes, -11018, -11030, -11031A pre-trade check or command rule refused it, for example 40 tick, 42 size, 59 post-only, 61 margin, 62 balance, 318 position capNothing changed and the nonce is not spent. Fix the cause and sign again with the same nonce
-10006, -10007, -10008, -10009, -20001, -20015Busy, unavailable, outcome unavailable, account authority unavailable, rate limited or the venue busyNot submitted. Retry after retryAfterMs, or with backoff
-10010, -10011, -32603, -20003, a code you don't recognise, a dropped connectionTimed out, publication uncertain, or no definite answer: the outcome is unknownLook the txId up, as below

The full catalog is on Errors.

Typed type strings

Each command's EIP-712 type string, in the gapless-nonce form. For a key whose slot is increasing, replace Transaction_Gapless with Transaction_Increasing, Nonce_Gapless nonce with Nonce_Increasing nonce and the Nonce_Gapless(…) definition with Nonce_Increasing(bool Increasing,uint64 time_stamp_nonce). The advanced-order commands always sign the gapless form. How the strings are hashed and signed is on Authentication: Typed signing.

A command whose type depends on its values has one string per form, named after the variants it holds: the market's kind (Spot or Perp), then for placeOrder the order type (Limit or Market) and margin mode (Cross or Isolated), for cancelOrder and replaceOrder the target (OrderId or ClientOrderId), and for setInstructionKey the change (Bind or Remove). The perp forms are below; a spot form replaces Perp with Spot throughout, and MarketId_Perp(bool Perp,uint32 value) with MarketId_Spot(bool Spot,uint32 value).

Type strings for every command
Orders (perp forms)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Perp_Limit_Cross transaction)BuilderFee(address appBuilderId,int64 builderFeeBps)MarketId_Perp(bool Perp,uint32 value)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)OrderKind_Limit(bool Limit,int64 price,bool postOnly)OrderMarginMode_Cross(bool Cross)PlaceOrder_Perp_Limit_Cross(address account,MarketId_Perp marketId,bytes16 clientOrderId,uint8 side,int64 quantity,OrderKind_Limit kind,uint8 timeInForce,OrderMarginMode_Cross marginMode,bool reduceOnly,bool hasBuilderFee,BuilderFee builderFee)Transaction_Gapless_Perp_Limit_Cross(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,PlaceOrder_Perp_Limit_Cross command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Perp_Limit_Isolated transaction)BuilderFee(address appBuilderId,int64 builderFeeBps)MarketId_Perp(bool Perp,uint32 value)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)OrderKind_Limit(bool Limit,int64 price,bool postOnly)OrderMarginMode_Isolated(bool Isolated,bool hasOpeningMargin,int128 openingMargin)PlaceOrder_Perp_Limit_Isolated(address account,MarketId_Perp marketId,bytes16 clientOrderId,uint8 side,int64 quantity,OrderKind_Limit kind,uint8 timeInForce,OrderMarginMode_Isolated marginMode,bool reduceOnly,bool hasBuilderFee,BuilderFee builderFee)Transaction_Gapless_Perp_Limit_Isolated(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,PlaceOrder_Perp_Limit_Isolated command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Perp_Market_Cross transaction)BuilderFee(address appBuilderId,int64 builderFeeBps)MarketId_Perp(bool Perp,uint32 value)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)OrderKind_Market(bool Market)OrderMarginMode_Cross(bool Cross)PlaceOrder_Perp_Market_Cross(address account,MarketId_Perp marketId,bytes16 clientOrderId,uint8 side,int64 quantity,OrderKind_Market kind,uint8 timeInForce,OrderMarginMode_Cross marginMode,bool reduceOnly,bool hasBuilderFee,BuilderFee builderFee)Transaction_Gapless_Perp_Market_Cross(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,PlaceOrder_Perp_Market_Cross command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Perp_Market_Isolated transaction)BuilderFee(address appBuilderId,int64 builderFeeBps)MarketId_Perp(bool Perp,uint32 value)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)OrderKind_Market(bool Market)OrderMarginMode_Isolated(bool Isolated,bool hasOpeningMargin,int128 openingMargin)PlaceOrder_Perp_Market_Isolated(address account,MarketId_Perp marketId,bytes16 clientOrderId,uint8 side,int64 quantity,OrderKind_Market kind,uint8 timeInForce,OrderMarginMode_Isolated marginMode,bool reduceOnly,bool hasBuilderFee,BuilderFee builderFee)Transaction_Gapless_Perp_Market_Isolated(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,PlaceOrder_Perp_Market_Isolated command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Perp_OrderId transaction)CancelOrder_Perp_OrderId(address account,bytes16 clientOrderId,MarketId_Perp marketId,OrderTarget_OrderId target)MarketId_Perp(bool Perp,uint32 value)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)OrderTarget_OrderId(bool OrderId,uint64 value)Transaction_Gapless_Perp_OrderId(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,CancelOrder_Perp_OrderId command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Perp_ClientOrderId transaction)CancelOrder_Perp_ClientOrderId(address account,bytes16 clientOrderId,MarketId_Perp marketId,OrderTarget_ClientOrderId target)MarketId_Perp(bool Perp,uint32 value)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)OrderTarget_ClientOrderId(bool ClientOrderId,bytes16 value)Transaction_Gapless_Perp_ClientOrderId(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,CancelOrder_Perp_ClientOrderId command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Perp_OrderId transaction)MarketId_Perp(bool Perp,uint32 value)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)OrderTarget_OrderId(bool OrderId,uint64 value)ReplaceOrder_Perp_OrderId(address account,MarketId_Perp marketId,OrderTarget_OrderId target,bytes16 clientOrderId,int64 quantity,int64 price,bool postOnly,bool reduceOnly)Transaction_Gapless_Perp_OrderId(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,ReplaceOrder_Perp_OrderId command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Perp_ClientOrderId transaction)MarketId_Perp(bool Perp,uint32 value)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)OrderTarget_ClientOrderId(bool ClientOrderId,bytes16 value)ReplaceOrder_Perp_ClientOrderId(address account,MarketId_Perp marketId,OrderTarget_ClientOrderId target,bytes16 clientOrderId,int64 quantity,int64 price,bool postOnly,bool reduceOnly)Transaction_Gapless_Perp_ClientOrderId(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,ReplaceOrder_Perp_ClientOrderId command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Perp transaction)CancelAllOrders_Perp(address account,bytes16 clientOrderId,MarketId_Perp marketId)MarketId_Perp(bool Perp,uint32 value)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)Transaction_Gapless_Perp(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,CancelAllOrders_Perp command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless transaction)CancelAllOrdersAfter(address account,uint32 timeoutSeconds)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)Transaction_Gapless(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,CancelAllOrdersAfter command)

A variant signs as the struct of its variant with its bool true: a perp market as MarketId_Perp { Perp: true, value: id }, a limit as OrderKind_Limit { Limit: true, price, postOnly }, a market as OrderKind_Market { Market: true }, cross as OrderMarginMode_Cross { Cross: true }, and isolated as OrderMarginMode_Isolated, with hasOpeningMargin false and openingMargin 0 when it names none. Without a Builder Fee, sign hasBuilderFee false, the zero address and 0. txType is 0 and sigSuite the scheme byte. Enums are uint8: side buy 0, sell 1; timeInForce ioc 0, gtc 1, fok 2.

Margin, funds and staking
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Perp transaction)MarketId_Perp(bool Perp,uint32 value)MoveIsolatedMargin_Perp(address account,MarketId_Perp marketId,uint8 direction,int128 amount)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)Transaction_Gapless_Perp(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,MoveIsolatedMargin_Perp command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless transaction)InternalTransfer(address account,address toAccount,uint32 asset,int128 amount,bytes memo)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)Transaction_Gapless(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,InternalTransfer command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless transaction)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)Transaction_Gapless(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,Transfer command)Transfer(address account,address toAccount,uint32 asset,int128 amount,bytes memo)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless transaction)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)Transaction_Gapless(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,Withdraw command)Withdraw(address account,uint32 asset,int128 amount,uint32 destinationZone,bytes32 receiver,bytes memo)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless transaction)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)Stake(address account,uint32 asset,int128 amount)Transaction_Gapless(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,Stake command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless transaction)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)Transaction_Gapless(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,Unstake command)Unstake(address account,uint32 asset,int128 amount)

direction add 0, remove 1. A transfer or withdrawal memo signs as bytes, the keccak256 of its bytes; an absent transfer memo signs as 64 zero bytes, an absent withdrawal memo as no bytes.

Wallet and keys
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless transaction)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)SetStpLevel(address account,uint8 level)Transaction_Gapless(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,SetStpLevel command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless transaction)Binding(address instructionKey,uint8 scope,BuilderFeeCap builderFeeCap,uint8 nonceMode)BuilderFeeCap(int64 perpBps,int64 spotBps)CreateSubAccount(address account,bool hasBinding,Binding binding)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)Transaction_Gapless(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,CreateSubAccount command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Bind transaction)BuilderFeeCap(int64 perpBps,int64 spotBps)KeyChange_Bind(bool Bind,uint8 scope,BuilderFeeCap builderFeeCap,uint8 nonceMode,Statement[] statements)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)SetInstructionKey_Bind(address account,address instructionKey,KeyChange_Bind change)Statement(string label,string value)Transaction_Gapless_Bind(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,SetInstructionKey_Bind command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless_Remove transaction)KeyChange_Remove(bool Remove)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)SetInstructionKey_Remove(address account,address instructionKey,KeyChange_Remove change)Transaction_Gapless_Remove(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,SetInstructionKey_Remove command)
AtlasTransaction(uint8 txType,bytes1 sigSuite,Transaction_Gapless transaction)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)RotateOwnerKey(address account,bool hasNewOwnerKey,address newOwnerKey,bool hasNewOwnerKeyProof,Signature[] newOwnerKeyProof)Signature(uint8 sigSuite,bytes32 r,bytes32 s,uint8 v)Transaction_Gapless(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,bytes2 selector,RotateOwnerKey command)

level account 0, wallet 1. scope INSTRUCTION_KEY_SCOPE_REDUCE_ONLY 2, INSTRUCTION_KEY_SCOPE_FULL 3. nonceMode GAPLESS 0, INCREASING 1. Builder Fee caps sign at scale 8. A remove signs KeyChange_Remove { Remove: true }.

Advanced orders (advanced-order domain)
Transaction(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,CreateTpSlOrderV2 action)BuilderFee(address appBuilderId,int64 builderFeeBps)CreateTpSlOrderV2(address accountAddress,uint8 marketKind,uint32 marketId,bytes16 clOrdId,uint8 marginMode,bool hasTakeProfit,SlotPlan takeProfit,bool hasStopLoss,SlotPlan stopLoss,bool hasEntry,EntryPlanV2 entry,bool hasBuilderFee,BuilderFee builderFee)EntryPlanV2(uint8 side,int64 quantity,uint8 orderType,uint8 timeInForce,bool hasPrice,int64 price,bool postOnly,bool hasOpeningMargin,int128 openingMargin)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)SlotPlan(uint8 triggerRef,int64 triggerPrice,uint8 orderType,uint8 timeInForce,bool hasPrice,int64 price)
Transaction(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,UpdateTpSlOrder action)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)SlotPlan(uint8 triggerRef,int64 triggerPrice,uint8 orderType,uint8 timeInForce,bool hasPrice,int64 price)UpdateTpSlOrder(address accountAddress,uint8 targetKind,uint64 parentOrderId,bytes16 origClOrdId,bytes16 clOrdId,bool hasTakeProfit,SlotPlan takeProfit,bool hasStopLoss,SlotPlan stopLoss)
Transaction(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,CancelTpSlOrder action)CancelTpSlOrder(address accountAddress,uint8 targetKind,uint64 parentOrderId,bytes16 origClOrdId,uint8 slot,bytes16 clOrdId)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)
Transaction(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,CreateTwapOrder action)BuilderFee(address appBuilderId,int64 builderFeeBps)CreateTwapOrder(address accountAddress,uint8 marketKind,uint32 marketId,bytes16 clOrdId,uint8 marginMode,TwapPlan twap,bool hasBuilderFee,BuilderFee builderFee)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)TwapPlan(uint8 side,int64 quantity,uint32 durationSeconds,bool reduceOnly)
Transaction(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,CancelTwapOrder action)CancelTwapOrder(address accountAddress,uint8 targetKind,uint64 parentOrderId,bytes16 origClOrdId,bytes16 clOrdId)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)
Transaction(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,CancelAllTwaps action)CancelAllTwaps(address accountAddress,bytes16 clOrdId)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)
Transaction(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,SetAdvanceInstructionKey_Bind action)KeyChange_Bind(bool Bind,bytes32 omsDelegateKeyX,bytes32 omsDelegateKeyY)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)SetAdvanceInstructionKey_Bind(address accountAddress,address instructionKey,KeyChange_Bind change)
Transaction(uint32 chainId,address authority,address signer,Nonce_Gapless nonce,SetAdvanceInstructionKey_Remove action)KeyChange_Remove(bool Remove)Nonce_Gapless(bool Gapless,uint64 gapless_nonce,uint64 expires_at)SetAdvanceInstructionKey_Remove(address accountAddress,address instructionKey,KeyChange_Remove change)
  • Enums: marketKind spot 0, perp 1, with marketId the market's number. marginMode cross 0, isolated 1. triggerRef mark 0, index 1, last 2. orderType limit 0, market 1. timeInForce ioc 0, gtc 1. slots signs as slot: takeProfit 0, stopLoss 1, both 2.
  • JSON to signed names: a plan's limitPrice signs as hasPrice and price; an entry's or TWAP's baseQty as quantity; an entry's openingMargin as hasOpeningMargin and openingMargin, and its postOnly as is, false when left out; tp and sl as hasTakeProfit/takeProfit and hasStopLoss/stopLoss; appBuilderId and builderFeeBps as hasBuilderFee and builderFee. A missing side, entry or Builder Fee signs its flag false and zeros.
  • Target: targetKind 0 with parentOrderId and 16 zero bytes, or 1 with 0 and origClOrdId.
  • Keys: omsDelegateKey signs as its X and Y coordinates, 32 bytes each.

Enable trading and builder

enableTrading and enableBuilder aren't sent with atlas.sendRawTransaction. Both accept the Terms of Use with one owner signature. The onboarding flow is on Authentication: open an account and enable trading.

enableTrading

Makes the wallet ready to trade: one signature covers Main and every sub-account, and it charges nothing. It comes in two forms:

The exact statements lines are on Authentication: the statements. The result is enableTradingApplied: wallet, committed, stamped (whether the wallet's stamp is now the Builder ID of the Builder line) and stampedAtMs (when the bind was stamped). An already ready wallet can send it again without change.

enableBuilder

Makes the wallet ready and issues the account's Builder ID, the one way to become a builder. Send it as an atlas.sendWalletReadyRequest with kind: "enableBuilder" and a Request line naming it, over HTTP (POST /seq/tx). The result is enableBuilderApplied: digest (of the request that issued the Builder ID), accountAddress, builderId (0x + 40 hex, the same on every later acceptance), terms, issuedAt and, when known, stampedAtMs. From a restricted or undetermined region it is refused with -20014 (Restricted region); trading is not affected.

atlas.sendWalletReadyRequest

atlas.sendWalletReadyRequestHTTP or WebSocket/seq/tx · /seq/ws auth

Submits an owner's signed setInstructionKey bind together with its statements text, and answers once the wallet is ready. Positional params, in order: [kind, rawTx, statements]. enableTrading works on POST /seq/tx and /seq/ws; enableBuilder is HTTP only, and /seq/ws refuses it with -10013.

kindenumrequired
rawTxstringrequired
statementsStatement[]required
Request: bind an app key and enable trading
{
  "jsonrpc": "2.0",
  "id": 40,
  "method": "atlas.sendWalletReadyRequest",
  "params": [
    "enableTrading",
    "0x0011000080eb8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15…",
    [
      { "label": "Atlas Terms of Use", "value": "atlas-terms-of-use@1 0xd7a9a09c83844e83ec08a2e0d7e997472106b41706c6d30f1a7ffbf755253807" }
    ]
  ]
}

If the bind is refused, read atlas.getAccountState and atlas.getKeys before you retry: the wallet may be ready anyway. Refusals include -12023 (the bind's expiry has passed), -20010 (unknown terms), -20011 (hash mismatch), -20012 (terms not in force), -20014 (enableBuilder from a restricted region) and 157 (an exit-only wallet; an enableBuilder still gets its Builder ID). The bind's expires_at must be no more than 14 days ahead. After a timeout or a lost answer, send the same request again: every step repeats harmlessly.

atlas.sendRawMessage

atlas.sendRawMessageHTTP or WebSocket/seq/tx · /seq/ws auth

Submits one signed TermsAcceptance message (enableTrading without a bind) as its bytes: params: [rawMessage]. A message has no nonce. It signs Typed only, under the message domain, and carries an expiresAt in Unix seconds, at most one day ahead (else -12023). An EnableBuilder message is refused with -10013: become a builder with atlas.sendWalletReadyRequest. A wallet no bind has claimed yet is 115: onboard it with atlas.sendWalletReadyRequest. The result is enableTradingApplied. See Authentication: signed messages.

The terms id, version and hash above are illustrative: copy the ones atlas.getTerms returns.

Not in v1

  • Batch: one signed command per request.
  • Amend in place: there is no amendOrder. Use replaceOrder, which loses queue priority.
  • Close all: there is no closeAll. Close each position with a reduce-only order.
  • Set leverage: there is no setLeverage. Give a new isolated position an openingMargin, and adjust it with moveIsolatedMargin.
  • Per-order self-trade prevention: the wallet's setStpLevel decides it for every order.
  • Cancel in every market at once: cancelAllOrders takes one market per request.
  • Post-only and reduce-only are flags on placeOrder (postOnly on limit orders, reduceOnly on both), not separate commands or time-in-force values.

Order reads

Reads are served at POST /account/rpc, take a named params object, and need no auth. ATLAS account state is public. Market filters take the numeric marketId from atlas.getSymbols; orders and fills carry no symbol, so resolve a market's display label from market discovery.

The list reads return one page, { rows, nextCursor }, newest first; order history, fills and open orders also return coveredThrough. Pass nextCursor back unchanged as cursor, with the same filters, for the next page; null ends the traversal. The cursor is opaque: start again from the first page when you change a filter. A limit outside 1 to 500 is refused with -32602, not adjusted. Where a read takes from and to, they are Unix milliseconds, from inclusive and to exclusive, and they stay fixed across pages.

Coverage. On atlas.getOrderHistory and atlas.getFills, coveredThrough is how far the history is complete, in Unix ms (null when unknown): anything after it may not be in this traversal yet. A cursor can expire; start again from the first page. atlas.getOpenOrders always returns coveredThrough: null.

The Order object

Order

orderIdOrderId
historyIdstring
accountAddressAccountAddressrequired
clOrdIdClientOrderId
txIdstring
marketIdintegerrequired
seqUint64Number
sideenumrequired
typeenumrequired
pricedecimal string | nullrequired
sizeSizerequired
timeInForceenum
postOnlyboolean
reduceOnlyboolean
marginModeenum
statusOrderStatusrequired
statusReasonstring
filledSizeSizerequired
remainingSizeSizerequired
trimmedSizeSizerequired
avgFillPricePricerequired
builderIdBuilderId
builderFeeRateBpsdecimal string
createdAtTimestampMsrequired
updatedAtTimestampMsrequired
signerRoleenum
agentPubkeyXstring
agentPubkeyYstring
parentOrderIdUint64String
originenum
stpLevelenum
stpTakerAccountAccountAddress
  1. 01
    accepted
  2. 02
    open
  3. 03
    partially_filled
  4. 04
    filled / cancelled / expiredterminal

A market order that fills at once goes straight from accepted to filled. cancelled covers a cancel you sent, self-trade prevention, the dead-man deadline, a reduce-only trim that removed the whole order, a killed FOK, a forced close and a venue cancel. expired is the unfilled remainder of an IOC order. rejected is a placement ATLAS refused.

atlas.getOrder

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

Result: Order, or null if there is no such order. Not-found is not an error. A filled or cancelled order is still found.

atlas.getOrderByClOrdId

atlas.getOrderByClOrdIdHTTP/account/rpc

The same Order by your own placement id. The key is the pair (accountAddress, clOrdId): different accounts may use the same id. No market or venue id needed.

Try itatlas.getOrderByClOrdIdHTTP POST
paramsedit me
curl -s https://<api-host>/account/rpc \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"atlas.getOrderByClOrdId","params":{"accountAddress":"0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15","clOrdId":"0x5f1c9a7e3b2d4c6e8a0b1d3f5e7c9a2b"}}'
Sent to testnet by the docs server, which adds the API key · use your own account
Response
Press Send to see the response.
accountAddressAccountAddressrequired
clOrdIdClientOrderIdrequired

Result: Order, or null.

A clOrdId is unique among an account's live orders and is free again once its order ends, so over time it can name several orders. The lookup covers every order of the account, live or ended, and returns the newest: the live order using it, otherwise the most recently placed. Read an older one by its orderId. A placement refused before it got an orderId is not found here: look for it in atlas.getOrderHistory, or look its txId up with atlas.getTransactions. null does not show that a placement failed.

atlas.getOpenOrders

atlas.getOpenOrdersHTTP/account/rpc

Live orders, most recently updated first.

Try itatlas.getOpenOrdersHTTP POST
paramsedit me
curl -s https://<api-host>/account/rpc \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"atlas.getOpenOrders","params":{"marketId":4294967297,"accountAddress":"0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15","limit":100}}'
Sent to testnet by the docs server, which adds the API key · use your own account
Response
Press Send to see the response.
marketIdinteger
accountAddressAccountAddress
limitinteger
cursorstring

Result: { rows: Order[], nextCursor, coveredThrough }, by updatedAt descending, then orderId. An order that changes between pages can move, so a full traversal is not a point-in-time snapshot. Keep live state with stream.orders.

atlas.getOrderHistory

atlas.getOrderHistoryHTTP/account/rpc

Ended orders for one account, most recently updated first: filled, cancelled and expired orders, unfilled IOC and FOK outcomes, and refused placements. Live orders are in atlas.getOpenOrders. Requests refused for their signature or envelope are not recorded.

Try itatlas.getOrderHistoryHTTP POST
paramsedit me
curl -s https://<api-host>/account/rpc \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"atlas.getOrderHistory","params":{"accountAddress":"0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15","marketId":4294967297,"limit":20}}'
Sent to testnet by the docs server, which adds the API key · use your own account
Response
Press Send to see the response.

The first row is a 25 BTC buy refused for margin: it has no orderId or seq, so find it by its txId or clOrdId. The second is the order from the examples above, cancelled with 0.4 filled.

accountAddressAccountAddressrequired
marketIdinteger
signerenum
fromTimestampMs
toTimestampMs
limitinteger
cursorstring

Result: { rows: Order[], nextCursor, coveredThrough }: the latest state of each ended order and each recorded refusal, by updatedAt descending. historyId identifies each row. An unfilled IOC reads expired with statusReason: "IOC_EXPIRED"; a killed FOK reads cancelled with statusReason: "FOK_KILLED" and nothing filled.

atlas.getFills

atlas.getFillsHTTP/account/rpc

Your fills, newest first, each with what it did to the position and the PnL it realized.

Try itatlas.getFillsHTTP POST
paramsedit me
curl -s https://<api-host>/account/rpc \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"atlas.getFills","params":{"marketId":4294967297,"limit":2,"accountAddress":"0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15"}}'
Sent to testnet by the docs server, which adds the API key · use your own account
Response
Press Send to see the response.
marketIdinteger
accountAddressAccountAddress
signerenum
fromTimestampMs
toTimestampMs
limitinteger
cursorstring

Result: { rows: Fill[], nextCursor, coveredThrough }, by timestamp descending. Both sides of one trade stay apart across pages.

Fill

tradeIdTradeIdrequired
kindenum
orderIdOrderId
clOrdIdClientOrderId
marketIdintegerrequired
seqUint64Number
accountAddressAccountAddressrequired
sideenumrequired
pricePricerequired
sizeSizerequired
feeAmountrequired
builderIdBuilderId
builderFeeAmount
liquidityenum
realizedPnlAmount
directionenum
startPositiondecimal string
liquidationboolean
txIdstring
timestampTimestampMsrequired
signerRoleenum
agentPubkeyXstring
agentPubkeyYstring
parentOrderIdUint64String
originenum

atlas.getFundingHistory

atlas.getFundingHistoryHTTP/account/rpc

Booked funding payments, newest first. settlementTsMs is when the payment was booked, which may be after the session ended.

Try itatlas.getFundingHistoryHTTP POST
paramsedit me
curl -s https://<api-host>/account/rpc \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"atlas.getFundingHistory","params":{"accountAddress":"0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15","marketId":4294967297,"limit":100}}'
Sent to testnet by the docs server, which adds the API key · use your own account
Response
Press Send to see the response.
accountAddressAccountAddressrequired
marketIdinteger
fromTimestampMs
toTimestampMs
limitinteger
cursorstring

Result: FundingHistoryPage

FundingHistoryPage

rowsFundingPayment[]required
›Show 11 child fields
accountAddressAccountAddressrequired
marketIdintegerrequired
symbolSymbolrequired
sessionIdUint64Stringrequired
marginModeenumrequired
settlementHeightintegerrequired
settlementTsMsTimestampMsrequired
positionQuantityDecimalStringrequired
fundingRateDecimalStringrequired
markPriceDecimalStringrequired
paymentDecimalStringrequired
nextCursorstring | nullrequired

A cursor can expire; start again from the first page. Each position's running total is cumulativeFunding on atlas.getPositions.

Advanced order reads

The advanced-order reads are served at POST /oms/v1/queries, with the same JSON-RPC envelope and named params. They are HTTP only.

atlas.getOmsDelegateKey

atlas.getOmsDelegateKeyHTTP/oms/v1/queries

The public key the advanced-order service signs the account's child orders with. Public: no read authorization. It is issued on the first request and stays the same until its binding is removed; the request after that returns a new key. It returns no private key and grants nothing: bind its address with setInstructionKey, then pass it unchanged as omsDelegateKey to a setAdvanceInstructionKey bind. Weight 1.

accountAddressAccountAddressrequired
Result
{
  "accountAddress": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
  "omsDelegateKey": "0x04b2e6d8f0a4c1e3b5d7f9a2c4e6b8d0f1a3c5e7b9d2f4a6c8e0b1d3f5a7c9e2b4d6f8a1c3e5b7d9f0a2c4e6b8d1f3a5c7e9b2d4f6a8c0e1d3f5a7b9c2e4d6f8a1",
  "status": "bindable"
}

Result: accountAddress, omsDelegateKey (0x04 + 128 hex) and status: bindable (not bound yet: bind it before binding an advance instruction key to it) or bound (a live binding was seen).

atlas.getOmsNonce

atlas.getOmsNonceHTTP/oms/v1/queries

The last advanced-order nonce a signer spent. Sign its next advanced-order command with this value plus one. Public: no read authorization.

signerAddressaddressrequired
Result
{ "gaplessNonce": "41" }

Result: gaplessNonce, a decimal string. The sequence is per signer, across every account it signs for, and a recorded rejection spends a value too.

Read authorization

atlas.getAdvancedOrders and atlas.getAdvancedOrder need an Authorization header signed by the account's owner key or a key bound with setAdvanceInstructionKey. An account Bearer token alone does not authorize them.

Authorization header
Authorization: OMS-Read <expiresAtMs>:<chainId>:<signatureHex>

The signature is 65 bytes r ‖ s ‖ v with no scheme byte, over EIP-712 ReadAuthorization(address accountAddress,uint64 expiresAtMs) under { name: "atlas", version: "1", chainId, salt: keccak256("atlas/oms/message") }, where chainId is the chain the wallet signed at and the one the header names. It expires at expiresAtMs, at most five minutes ahead. signatureHex is the 130 hex digits, with or without 0x, in either case. A missing or invalid header is -20002.

Both reads take an optional minVersion, a write result's version: the read answers only once it has caught up that far, and is refused with -14002 (Version not projected) rather than answering older state. Retry it shortly.

atlas.getAdvancedOrders

atlas.getAdvancedOrdersHTTP/oms/v1/queries auth

The account's parents of the strategies you name, as they stand now, by parentOrderId ascending. A parent of a strategy you don't name is never returned. Child orders are ordinary orders too: read them with the order reads (parentOrderId marks them). Weight 20.

accountAddressAccountAddressrequired
strategiesstring[]required
stateenum
cursorUint64String
limitinteger
minVersionUint64String

Result: { projectedVersion, items: AdvancedOrder[], nextCursor }. projectedVersion is the version the read answered at.

Result: an armed TP/SL on a 1 BTC long and a running TWAP
{
  "projectedVersion": "4412",
  "items": [
    {
      "parentOrderId": "90211",
      "accountAddress": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
      "clOrdId": "0x2c4e6a8b0d1f3e5a7c9b2d4f6a8c0e1d",
      "marketId": 4294967297,
      "marginMode": "cross",
      "parentVersion": "2",
      "strategy": {
        "type": "tpSl",
        "status": "armed",
        "endReason": null,
        "protects": "long",
        "entry": null,
        "takeProfit": {
          "plan": { "triggerRef": "mark", "triggerPrice": "73000", "orderType": "limit", "limitPrice": "72950", "timeInForce": "gtc" },
          "state": "armed",
          "childHasFills": false,
          "childLogged": false,
          "childCancelState": "notRequested"
        },
        "stopLoss": {
          "plan": { "triggerRef": "mark", "triggerPrice": "68000", "orderType": "market", "timeInForce": "ioc" },
          "state": "armed",
          "childHasFills": false,
          "childLogged": false,
          "childCancelState": "notRequested"
        }
      }
    },
    {
      "parentOrderId": "90230",
      "accountAddress": "0x8f3a6c1e2b9d4f7a0c5e8b1d3f6a9c2e4b7d0f15",
      "clOrdId": "0x3e5a7c9b1d2f4e6a8c0b2d4f6a8c1e3b",
      "marketId": 4294967297,
      "marginMode": "cross",
      "parentVersion": "9",
      "strategy": {
        "type": "twap",
        "status": "running",
        "endReason": null,
        "side": "buy",
        "baseQty": "2",
        "durationSeconds": 3600,
        "reduceOnly": false,
        "startedAtMs": 1791210600000,
        "deadlineMs": 1791214200000,
        "opportunities": 120,
        "filledQty": "0.5",
        "remainingQty": "1.5",
        "averagePrice": "70184",
        "skip": null
      }
    }
  ],
  "nextCursor": null
}

AdvancedOrder

parentOrderIdUint64Stringrequired
accountAddressAccountAddressrequired
clOrdIdClientOrderIdrequired
marketIdintegerrequired
marginModeenumrequired
parentVersionUint64Stringrequired
strategyobjectrequired

strategy (tpSl)

typestringrequired
statusenumrequired
endReasonEndReason | nullrequired
protectsenum | nullrequired
entryobject | nullrequired
›Show 4 child fields
clOrdIdClientOrderIdrequired
planEntryPlanrequired
stateenumrequired
hasFillsbooleanrequired
takeProfitAdvancedOrderSlot | nullrequired
›Show 5 child fields
planSlotPlanrequired
stateSlotStaterequired
childHasFillsbooleanrequired
childLoggedbooleanrequired
childCancelStateenumrequired
stopLossAdvancedOrderSlot | nullrequired

strategy (twap)

typestringrequired
statusenumrequired
endReasonEndReason | nullrequired
sideenumrequired
baseQtydecimal stringrequired
durationSecondsintegerrequired
reduceOnlybooleanrequired
startedAtMsintegerrequired
deadlineMsintegerrequired
opportunitiesintegerrequired
filledQtydecimal stringrequired
remainingQtydecimal stringrequired
averagePricedecimal string | nullrequired
skipenum | nullrequired

endReason values: client (you cancelled it, or its close order was cancelled by you, cancelAllOrders or the dead-man switch), invalid (the position went flat or flipped before a fire, the engine refused or cancelled the close, or the entry ended unfilled), liquidated, expired (the close's time in force ended it), reduceOnlyTrim (the close was trimmed away to fit the position), forceClose (the position was force-closed), childRejected (the engine refused a TWAP child), omsKeyRevoked (the account's delegate key was unbound), marketClosed (the market closed for good), positionFlat (a reduce-only TWAP's position went flat), walletExitOnly (a spot TWAP's wallet became exit-only) and marketAdmissionClosed (the market was closed to new orders before a close order or TWAP child was sent).

atlas.getAdvancedOrder

atlas.getAdvancedOrderHTTP/oms/v1/queries auth

One parent, of either strategy, as it stands now, and what was seen of its child orders. It is not the receipt of any one request. Weight 5.

accountAddressAccountAddressrequired
parentOrderIdUint64Stringrequired
limitinteger
cursorstring
minVersionUint64String

Result: { projectedVersion, parent: AdvancedOrder, children, nextCursor }. Children come a page at a time, newest first, and every page carries the parent again. Pass nextCursor back as cursor for older children; null ends the traversal. A parent of another account, or one the signer may not read, is -14001 (Unknown advanced order).

children[]

clOrdIdClientOrderIdrequired
roleenumrequired
linkedbooleanrequired
outcomesChildOutcome[]required