> For the complete documentation index, see [llms.txt](https://docs.reya.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reya.xyz/developers/devnet/api-reference/rest-api-reference/order-entry.md).

# Order Entry

Place, modify, and cancel orders, or manage an account's cancel-all-after countdown. Reya verifies signatures, signer permissions, order validity, and applicable pre-trade risk checks before accepting requests.

**Rate limits.** Account budgets are shared across markets, signers, REST, and WebSocket requests. Create and modify share a placement budget; single cancels, bulk cancels, and cancel-all-after control have separate budgets. Resting orders also have count and notional limits. See the HTTP 400 response reference for errors and recovery guidance.

**Every venue verdict is HTTP 400.** Rejections carry the reason in the body's `error` code and an optional `retryAfterMs`. Branch on the code to decide how to recover. HTTP 429 is reserved for infrastructure-level (per-IP) limits in front of the API and need not use the venue's JSON error format.

**Cancellation reasons**

Reason for a terminal `CANCELLED` order. `cancelReason` and `cancelReasonMessage` are omitted for other statuses and may be omitted when a cancellation reason is unavailable. Branch on `cancelReason`; `cancelReasonMessage` is explanatory text, not a stable contract to parse.

* `NO_LIQUIDITY`: an IOC order filled nothing at its limit.
* `IOC_REMAINDER`: an IOC order partially filled and its unfilled quantity was cancelled because no further executable liquidity was available. Both IOC reasons appear on create/modify responses.
* `USER_CANCEL`, `MASS_CANCEL`, `CANCEL_ALL_AFTER`, `GTT_EXPIRED`: cancellation by a single cancel, bulk cancel, expired cancel-all-after countdown, or GTT expiry. These appear on `walletOrderChanges`.
* `SELF_TRADE_PREVENTION`: an order would trade against the account's own resting order. Only the incoming order is cancelled; the resting order stays in place. This can appear on create/modify responses or a crossing modification's order-change event. Any fills already completed remain recorded.
* `FEED_RESET`: rebuild the local order view from the following order events or `GET /v2/wallet/{address}/openOrders`. This notification does not mean the orders were cancelled on the exchange.
* `RISK_CANCELLED`: a resting order was cancelled because it did not pass pre-trade risk checks when it was about to fill. Delivered on `walletOrderChanges`, with any previous fills preserved. A create or modify refused at request acceptance instead returns a `RequestErrorCode`.
* `OCO_SIBLING_FIRED`: the paired stop-loss or take-profit fired and created its child order. The sibling is cancelled even when the child fills nothing. Cancelling a leg manually leaves its sibling armed; protection is not automatically re-armed.
* `PROTECTIVE_SELF_TRADE_SWEEP`: a resting maker order was cancelled to allow a protective stop to execute without self-trading. This reason appears on the maker's cancellation, unlike `SELF_TRADE_PREVENTION`, which cancels the incoming order.
* `POSITION_CLOSED`: no tradeable quantity remains to reduce. If the position has closed, reversed, or fallen below one lot before a stop fires, both protective legs are cancelled with `triggered: false` and no child is created. A fired child's remaining quantity is limited by the current reducible position; if that quantity is zero when it attempts to fill, its remainder is cancelled.
* `RISK_REJECTED`: the proposed protective child failed pre-trade risk checks. Both protective legs are cancelled with `triggered: false`; no child is created and protection is not automatically retried or re-armed.

A GTT stop or its resting child can be cancelled with `GTT_EXPIRED` before the signed `expiresAfter` to allow settlement. Explicit `cancelAll` includes fired children and reports `MASS_CANCEL`; cancel-all-after leaves armed protective stops and their fired children in place.

## Create order

> Create a new spot or perp order. \`timeInForce\` is required for every order class.\
> STOP\_LOSS and TAKE\_PROFIT orders are supported only on perp markets.\
> On trigger creates and modifications, omit \`reduceOnly\` and \`postOnly\`, including\
> \`false\`. Supplied flags return \`INPUT\_VALIDATION\_ERROR\`. SDK signing and server\
> verification reconstruct both as \`false\`; they never inherit stored values.\
> \
> \*\*Armed stops.\*\* A protective stop is not executable liquidity until it fires. While armed,\
> it remains modifiable and cancellable and appears as \`OPEN\`, with \`triggered: false\` in\
> \`openOrders\` and \`walletOrderChanges\`. Order-history rows omit \`triggered\`; its absence\
> there means unknown, not \`false\`.\
> \
> \*\*Time in force and expiry.\*\* For a stop, \`timeInForce\` selects the fired child's behavior:\
> IOC fills available liquidity and cancels the remainder; GTC rests the remainder until\
> cancelled; GTT rests it until expiry. Only GTT carries \`expiresAfter\`, which must be in the\
> future and strictly greater than the signature's \`deadline\`. GTC and IOC must omit it.\
> Invalid combinations return \`INPUT\_VALIDATION\_ERROR\` or \`TRIGGER\_IOC\_MUST\_NOT\_EXPIRE\_ERROR\`.\
> \
> A GTT stop and its child share one absolute \`expiresAfter\`; firing does not start a new\
> lifetime. The stop or resting child can be cancelled before that timestamp to allow\
> settlement, with \`cancelReason: GTT\_EXPIRED\`. Choose an expiry with sufficient time for\
> both protection and settlement. An expiry that is too near returns \`ORDER\_EXPIRES\_TOO\_SOON\_ERROR\`.\
> The signature's \`deadline\` controls request acceptance only; passing it does not disarm\
> an accepted stop or prevent its child from executing. A fill that settles after \`expiresAfter\`\
> can revert with \`OrderExpired\`.\
> \
> \*\*Execution price.\*\* \`limitPx\` is the child's worst acceptable execution price, not an\
> offset from \`triggerPx\`. It must be within the permitted range around \`triggerPx\`.\
> \`TRIGGER\_LIMIT\_OUTSIDE\_BAND\_ERROR\` indicates an out-of-range limit or that stops are\
> unavailable for the market. If the limit is out of range, move it closer to the trigger\
> and re-sign; changing the price will not resolve market unavailability.\
> \
> \*\*Firing and paired stops.\*\* When the mark price crosses \`triggerPx\`, the stop attempts\
> to create its child. A created child has \`triggered: true\` and cancels the paired stop\
> on the same account and market with \`OCO\_SIBLING\_FIRED\`, even if it fills nothing.\
> A partial IOC fill can leave the remaining position without protection. Protection is\
> not automatically re-armed. Manually cancelling one protective leg leaves its sibling armed.\
> If a protective child would self-trade, the account's conflicting resting maker orders\
> are cancelled with \`PROTECTIVE\_SELF\_TRADE\_SWEEP\` so the child can execute.\
> \
> If no tradeable position remains to reduce (the position closed, reversed, or is below one\
> lot), both legs are cancelled with \`POSITION\_CLOSED\`. If the proposed child fails pre-trade\
> risk checks, both legs are cancelled with \`RISK\_REJECTED\`. In either case, no child is created,\
> both orders retain \`triggered: false\`, and protection is not automatically retried or re-armed.\
> Use \`cancelReason\` for handling; do not parse \`cancelReasonMessage\`.\
> \
> \*\*Resting children.\*\* Firing does not guarantee a fill. A GTC/GTT child can remain unfilled\
> at \`limitPx\` if the market moves past it. Its fills cannot exceed the current reducible\
> position, so displayed remaining quantity can exceed what can execute. A zero reducible\
> quantity when it attempts to fill cancels the remainder with \`POSITION\_CLOSED\`; closing the\
> position by another route does not immediately remove the child. A fired child is cancel-only:\
> \`modifyOrder\` is refused. Ordinary self-trade prevention applies to the account's new crossing\
> orders. Explicit \`cancelAll\` includes the child; cancel-all-after leaves it in place.\
> \
> Stops and their children only reduce positions, even though their signed \`reduceOnly\`\
> field is \`false\`. They cannot open a new position.\
> \
> Also available on the order-entry WebSocket (\`asyncapi-exec-v2.yaml\`, \`createOrder\`).\
> \
> \*\*Responses and fill correlation\*\*\
> \
> A created order receives an \`orderId\`, even if an IOC fills nothing and is immediately\
> cancelled. \`execQty\` reports the fills from this request; \`cumQty\` reports lifetime fills.\
> \`firstFillId\` and \`fillCount\`, when present, identify the contiguous fill range. On a\
> non-IOC taker, the same range appears in its \`orderChanges\` update. IOC takers do not\
> appear on \`orderChanges\`, so retain the response's range to correlate their executions.\
> See the Order Entry section's Cancellation reasons for cancelled outcomes.\
> These fill-correlation rules also apply to \`modifyOrder\` responses.<br>

```json
{"openapi":"3.0.3","info":{"title":"Reya DEX Trading API v2","version":"3.5.2"},"tags":[{"name":"Order Entry","description":"Place, modify, and cancel orders, or manage an account's cancel-all-after countdown.\nReya verifies signatures, signer permissions, order validity, and applicable pre-trade\nrisk checks before accepting requests.\n\n**Rate limits.** Account budgets are shared across markets, signers, REST, and WebSocket\nrequests. Create and modify share a placement budget; single cancels, bulk cancels, and\ncancel-all-after control have separate budgets. Resting orders also have count and\nnotional limits. See the HTTP 400 response reference for errors and recovery guidance.\n\n**Every venue verdict is HTTP 400.** Rejections carry the reason in the body's `error`\ncode and an optional `retryAfterMs`. Branch on the code to decide how to recover. HTTP 429 is\nreserved for infrastructure-level (per-IP) limits in front of the API and need not use\nthe venue's JSON error format.\n\n**Cancellation reasons**\n\nReason for a terminal `CANCELLED` order. `cancelReason` and `cancelReasonMessage`\nare omitted for other statuses and may be omitted when a cancellation reason is\nunavailable. Branch on `cancelReason`; `cancelReasonMessage` is explanatory text,\nnot a stable contract to parse.\n\n- `NO_LIQUIDITY`: an IOC order filled nothing at its limit.\n- `IOC_REMAINDER`: an IOC order partially filled and its unfilled quantity was\n  cancelled because no further executable liquidity was available. Both IOC reasons\n  appear on create/modify responses.\n- `USER_CANCEL`, `MASS_CANCEL`, `CANCEL_ALL_AFTER`, `GTT_EXPIRED`: cancellation by a\n  single cancel, bulk cancel, expired cancel-all-after countdown, or GTT expiry.\n  These appear on `walletOrderChanges`.\n- `SELF_TRADE_PREVENTION`: an order would trade against the account's own resting\n  order. Only the incoming order is cancelled; the resting order stays in place.\n  This can appear on create/modify responses or a crossing modification's\n  order-change event. Any fills already completed remain recorded.\n- `FEED_RESET`: rebuild the local order view from the following order events or `GET\n  /v2/wallet/{address}/openOrders`. This notification does not mean the orders were\n  cancelled on the exchange.\n- `RISK_CANCELLED`: a resting order was cancelled because it did not pass pre-trade\n  risk checks when it was about to fill. Delivered on `walletOrderChanges`, with any\n  previous fills preserved. A create or modify refused at request acceptance instead\n  returns a `RequestErrorCode`.\n- `OCO_SIBLING_FIRED`: the paired stop-loss or take-profit fired and created its\n  child order. The sibling is cancelled even when the child fills nothing.\n  Cancelling a leg manually leaves its sibling armed; protection is not\n  automatically re-armed.\n- `PROTECTIVE_SELF_TRADE_SWEEP`: a resting maker order was cancelled to allow a\n  protective stop to execute without self-trading. This reason appears on the\n  maker's cancellation, unlike `SELF_TRADE_PREVENTION`, which cancels the incoming\n  order.\n- `POSITION_CLOSED`: no tradeable quantity remains to reduce. If the position has\n  closed, reversed, or fallen below one lot before a stop fires, both protective\n  legs are cancelled with `triggered: false` and no child is created. A fired\n  child's remaining quantity is limited by the current reducible position; if that\n  quantity is zero when it attempts to fill, its remainder is cancelled.\n- `RISK_REJECTED`: the proposed protective child failed pre-trade risk checks. Both\n  protective legs are cancelled with `triggered: false`; no child is created and\n  protection is not automatically retried or re-armed.\n\nA GTT stop or its resting child can be cancelled with `GTT_EXPIRED` before the\nsigned `expiresAfter` to allow settlement. Explicit `cancelAll` includes fired\nchildren and reports `MASS_CANCEL`; cancel-all-after leaves armed protective stops\nand their fired children in place.\n"}],"servers":[{"url":"/v2"}],"paths":{"/createOrder":{"post":{"summary":"Create order","description":"Create a new spot or perp order. `timeInForce` is required for every order class.\nSTOP_LOSS and TAKE_PROFIT orders are supported only on perp markets.\nOn trigger creates and modifications, omit `reduceOnly` and `postOnly`, including\n`false`. Supplied flags return `INPUT_VALIDATION_ERROR`. SDK signing and server\nverification reconstruct both as `false`; they never inherit stored values.\n\n**Armed stops.** A protective stop is not executable liquidity until it fires. While armed,\nit remains modifiable and cancellable and appears as `OPEN`, with `triggered: false` in\n`openOrders` and `walletOrderChanges`. Order-history rows omit `triggered`; its absence\nthere means unknown, not `false`.\n\n**Time in force and expiry.** For a stop, `timeInForce` selects the fired child's behavior:\nIOC fills available liquidity and cancels the remainder; GTC rests the remainder until\ncancelled; GTT rests it until expiry. Only GTT carries `expiresAfter`, which must be in the\nfuture and strictly greater than the signature's `deadline`. GTC and IOC must omit it.\nInvalid combinations return `INPUT_VALIDATION_ERROR` or `TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR`.\n\nA GTT stop and its child share one absolute `expiresAfter`; firing does not start a new\nlifetime. The stop or resting child can be cancelled before that timestamp to allow\nsettlement, with `cancelReason: GTT_EXPIRED`. Choose an expiry with sufficient time for\nboth protection and settlement. An expiry that is too near returns `ORDER_EXPIRES_TOO_SOON_ERROR`.\nThe signature's `deadline` controls request acceptance only; passing it does not disarm\nan accepted stop or prevent its child from executing. A fill that settles after `expiresAfter`\ncan revert with `OrderExpired`.\n\n**Execution price.** `limitPx` is the child's worst acceptable execution price, not an\noffset from `triggerPx`. It must be within the permitted range around `triggerPx`.\n`TRIGGER_LIMIT_OUTSIDE_BAND_ERROR` indicates an out-of-range limit or that stops are\nunavailable for the market. If the limit is out of range, move it closer to the trigger\nand re-sign; changing the price will not resolve market unavailability.\n\n**Firing and paired stops.** When the mark price crosses `triggerPx`, the stop attempts\nto create its child. A created child has `triggered: true` and cancels the paired stop\non the same account and market with `OCO_SIBLING_FIRED`, even if it fills nothing.\nA partial IOC fill can leave the remaining position without protection. Protection is\nnot automatically re-armed. Manually cancelling one protective leg leaves its sibling armed.\nIf a protective child would self-trade, the account's conflicting resting maker orders\nare cancelled with `PROTECTIVE_SELF_TRADE_SWEEP` so the child can execute.\n\nIf no tradeable position remains to reduce (the position closed, reversed, or is below one\nlot), both legs are cancelled with `POSITION_CLOSED`. If the proposed child fails pre-trade\nrisk checks, both legs are cancelled with `RISK_REJECTED`. In either case, no child is created,\nboth orders retain `triggered: false`, and protection is not automatically retried or re-armed.\nUse `cancelReason` for handling; do not parse `cancelReasonMessage`.\n\n**Resting children.** Firing does not guarantee a fill. A GTC/GTT child can remain unfilled\nat `limitPx` if the market moves past it. Its fills cannot exceed the current reducible\nposition, so displayed remaining quantity can exceed what can execute. A zero reducible\nquantity when it attempts to fill cancels the remainder with `POSITION_CLOSED`; closing the\nposition by another route does not immediately remove the child. A fired child is cancel-only:\n`modifyOrder` is refused. Ordinary self-trade prevention applies to the account's new crossing\norders. Explicit `cancelAll` includes the child; cancel-all-after leaves it in place.\n\nStops and their children only reduce positions, even though their signed `reduceOnly`\nfield is `false`. They cannot open a new position.\n\nAlso available on the order-entry WebSocket (`asyncapi-exec-v2.yaml`, `createOrder`).\n\n**Responses and fill correlation**\n\nA created order receives an `orderId`, even if an IOC fills nothing and is immediately\ncancelled. `execQty` reports the fills from this request; `cumQty` reports lifetime fills.\n`firstFillId` and `fillCount`, when present, identify the contiguous fill range. On a\nnon-IOC taker, the same range appears in its `orderChanges` update. IOC takers do not\nappear on `orderChanges`, so retain the response's range to correlate their executions.\nSee the Order Entry section's Cancellation reasons for cancelled outcomes.\nThese fill-correlation rules also apply to `modifyOrder` responses.\n","operationId":"createOrder","tags":["Order Entry"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderRequest"}}}},"responses":{"200":{"description":"Order creation response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateOrderResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"schemas":{"CreateOrderRequest":{"title":"CreateOrderRequest","description":"Create an order with an EIP-712 signature, nonce, and deadline. Field descriptions define signed values and order-class requirements. See POST /v2/createOrder for execution and protective-stop behavior.","type":"object","required":["exchangeId","symbol","accountId","isBuy","limitPx","orderType","timeInForce","signature","nonce","signerWallet","deadline"],"properties":{"exchangeId":{"$ref":"#/components/schemas/UnsignedInteger","description":"On-chain `OrderDetails.exchangeId`."},"symbol":{"$ref":"#/components/schemas/Symbol","description":"Market symbol. The server resolves this to the on-chain `OrderDetails.marketId`, which uses a unified namespace: perp market ids are raw core ids, spot market ids are `coreMarketId + 1e10`."},"accountId":{"$ref":"#/components/schemas/UnsignedInteger","description":"On-chain `OrderDetails.accountId`."},"isBuy":{"type":"boolean","description":"Whether this is a buy order. Combined with `qty`, determines the signed `OrderDetails.quantity` (int256): positive for buy/long, negative for sell/short."},"limitPx":{"$ref":"#/components/schemas/SignedDecimal","description":"Worst acceptable execution price. Must be positive (> 0). Maps to signed `OrderDetails.limitPrice` (uint256). For a STOP_LOSS/TAKE_PROFIT, this is the child's worst execution price, not an offset added to `triggerPx`. Keep it within the permitted range around the trigger price. `TRIGGER_LIMIT_OUTSIDE_BAND_ERROR` indicates an out-of-range price or that stops are unavailable for the market."},"qty":{"$ref":"#/components/schemas/UnsignedDecimal","description":"Unsigned quantity, required for LIMIT orders; its sign in OrderDetails.quantity follows isBuy. Omit for STOP_LOSS/TAKE_PROFIT and sign the full-position sentinel ±int256.max (raw, not E18), with sign from isBuy. A protective stop takes its executable size from the position when it fires."},"orderType":{"$ref":"#/components/schemas/OrderType","description":"On-chain `OrderDetails.orderType`: LIMIT, STOP_LOSS, or TAKE_PROFIT."},"timeInForce":{"$ref":"#/components/schemas/TimeInForce","description":"Required signed OrderDetails.timeInForce (0 = GTC, 1 = IOC, 2 = GTT). For a protective stop, selects its fired child's time in force. Only GTT carries expiresAfter; GTC and IOC omit it. See POST /v2/createOrder for execution, expiry, and invalid-combination handling."},"triggerPx":{"$ref":"#/components/schemas/SignedDecimal","description":"Trigger price, required for STOP_LOSS/TAKE_PROFIT and omitted for LIMIT. Maps to on-chain `OrderDetails.triggerPrice`. The trigger fires when the market's mark price crosses this level; it is also the reference the `limitPx` band is measured from (see `limitPx`)."},"reduceOnly":{"type":"boolean","description":"Reduce-only intent. Required only for perp IOC orders. Omit this field for every other order class: perp GTC/GTT, STOP_LOSS/TAKE_PROFIT, and all spot orders. Sending the field, including `false`, for those order classes is rejected with `INPUT_VALIDATION_ERROR`. Omitted values map to `false` in the signed on-chain `OrderDetails.reduceOnly` field."},"postOnly":{"type":"boolean","description":"Post-only (maker-only) intent for LIMIT GTC/GTT orders; rejected on IOC. Omit for STOP_LOSS/TAKE_PROFIT, including false: triggers sign OrderDetails.postOnly=false. A post-only LIMIT that would cross is rejected with POST_ONLY_WOULD_CROSS_ERROR."},"signature":{"type":"string","description":"EIP-712 signature over the `Order(uint256 verifyingChainId, uint256 deadline, OrderDetails order)` envelope. See the EIP-712 signing reference in the Reya docs (https://docs.reya.xyz/developers/readme/signatures-and-nonces) for the exact typehash string and signing algorithm."},"nonce":{"type":"string","description":"Monotonically increasing per-signer nonce. Maps to on-chain `OrderDetails.nonce`."},"signerWallet":{"$ref":"#/components/schemas/Address","description":"Address of the signer that produced the EIP-712 signature. Maps to on-chain `OrderDetails.signer`."},"deadline":{"$ref":"#/components/schemas/UnsignedInteger","description":"Unix seconds. Required EIP-712 signature-validity deadline, signed into the `Order` envelope. Requests received after this timestamp are rejected. It controls request acceptance only: once accepted, an order remains valid after `deadline` passes. An armed protective stop can still fire afterwards. Use `expiresAfter` to set GTT order lifetime."},"expiresAfter":{"$ref":"#/components/schemas/UnsignedInteger","description":"GTT expiry in Unix seconds, signed as OrderDetails.expiresAfter. Required for GTT, in the future and strictly greater than deadline; omitted for GTC/IOC. A protective stop and its child share this expiry. See POST /v2/createOrder for early cancellation, settlement, and expiry errors."},"clientOrderId":{"type":"string","description":"Client-provided correlation ID, signed as OrderDetails.clientOrderId (uint64). Omit when unused; otherwise send a non-zero decimal string to preserve precision."}},"additionalProperties":true,"not":{"anyOf":[{"description":"TP/SL requests must omit both fixed Boolean fields, even when false.","properties":{"orderType":{"$ref":"#/components/schemas/TriggerOrderType"}},"required":["orderType"],"anyOf":[{"required":["reduceOnly"]},{"required":["postOnly"]}]}]}},"UnsignedInteger":{"title":"UnsignedInteger","type":"integer","minimum":0},"Symbol":{"title":"Symbol","type":"string","pattern":"^[A-Za-z0-9]+$","description":"Trading symbol (e.g., BTCRUSDPERP, WETHRUSD)"},"SignedDecimal":{"title":"SignedDecimal","type":"string","pattern":"^-?\\d+(\\.\\d+)?([eE][+-]?\\d+)?$"},"UnsignedDecimal":{"title":"UnsignedDecimal","type":"string","pattern":"^\\d+(\\.\\d+)?([eE][+-]?\\d+)?$"},"OrderType":{"title":"OrderType","type":"string","enum":["LIMIT","STOP_LOSS","TAKE_PROFIT"],"description":"Order type aligned with the on-chain `OrderDetails.orderType` enum: LIMIT = limit order, STOP_LOSS = stop-loss trigger order, TAKE_PROFIT = take-profit trigger order."},"TimeInForce":{"title":"TimeInForce","type":"string","enum":["IOC","GTC","GTT"],"description":"Order time in force (IOC = Immediate or Cancel, GTC = Good Till Cancel, GTT = Good Till Time)"},"Address":{"title":"Address","type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"TriggerOrderType":{"type":"string","enum":["STOP_LOSS","TAKE_PROFIT"]},"CreateOrderResponse":{"title":"CreateOrderResponse","type":"object","required":["status","orderId"],"properties":{"status":{"$ref":"#/components/schemas/OrderStatus"},"execQty":{"$ref":"#/components/schemas/UnsignedDecimal","description":"Executed quantity in the current order update."},"cumQty":{"$ref":"#/components/schemas/UnsignedDecimal","description":"Total Executed quantity across all fills where the order is involved."},"orderId":{"type":"string","description":"Reya-assigned order ID, generated for all order types including IOC. A no-cross IOC still receives an ID and is returned with status CANCELLED (it never rests)."},"clientOrderId":{"type":"string","description":"Client-provided order ID echoed back from the request, as a decimal string (`uint64`)."},"cancelReason":{"$ref":"#/components/schemas/CancelReason","description":"Machine-readable reason the order was cancelled. Present if and only if `status` is `CANCELLED` — e.g. a no-cross IOC returns `status: CANCELLED` with `cancelReason: NO_LIQUIDITY`, and a self-crossing IOC with `SELF_TRADE_PREVENTION`. Omitted entirely otherwise."},"cancelReasonMessage":{"type":"string","description":"Human-readable explanation of `cancelReason`. Present only when `cancelReason` is present."},"firstFillId":{"type":"string","description":"First fill ID produced by this request. With fillCount, identifies [firstFillId, firstFillId + fillCount - 1]. Omitted if no fill occurred. See POST /v2/createOrder, Responses and fill correlation, for joining responses to streamed executions."},"fillCount":{"$ref":"#/components/schemas/UnsignedInteger","description":"Number of fills produced by this request, starting at firstFillId. Omitted if no fill occurred; positive whenever present."}},"additionalProperties":true},"OrderStatus":{"title":"OrderStatus","type":"string","enum":["OPEN","FILLED","CANCELLED"],"description":"OPEN includes partially filled resting orders, armed protective stops, and their resting children. FILLED and CANCELLED are terminal states. Use Order.triggered to distinguish armed stops from fired children. Requests rejected before order creation return errors, not order-status rows."},"CancelReason":{"title":"CancelReason","type":"string","enum":["NO_LIQUIDITY","IOC_REMAINDER","SELF_TRADE_PREVENTION","PROTECTIVE_SELF_TRADE_SWEEP","GTT_EXPIRED","USER_CANCEL","MASS_CANCEL","CANCEL_ALL_AFTER","FEED_RESET","RISK_CANCELLED","RISK_REJECTED","OCO_SIBLING_FIRED","POSITION_CLOSED"],"description":"Machine-readable cancellation reason. Present only on CANCELLED orders and may be omitted when unavailable. See Cancellation reasons in the REST API Order Entry section for per-code meanings and handling."},"RequestError":{"title":"RequestError","type":"object","required":["error","message"],"properties":{"error":{"$ref":"#/components/schemas/RequestErrorCode"},"message":{"type":"string","description":"Human-readable error message"},"retryAfterMs":{"type":"integer","minimum":1,"description":"Minimum wait in milliseconds before retrying the rejected operation. Included for `RATE_LIMITED_ERROR`; omitted for errors without a retry hint, including resting-order caps and `CAPACITY_LIMITED_ERROR`. The same field appears in the REST HTTP 400 body and the order-entry WebSocket's `{ ok: false, error }` response. When present, it is a positive integer. Wait at least this long; it does not reserve capacity, and concurrent requests can consume the account's available budget."}},"additionalProperties":true},"RequestErrorCode":{"title":"RequestErrorCode","type":"string","enum":["SYMBOL_NOT_FOUND_ERROR","NO_ACCOUNTS_FOUND_ERROR","NO_PRICES_FOUND_FOR_SYMBOL_ERROR","INPUT_VALIDATION_ERROR","CREATE_ORDER_OTHER_ERROR","CANCEL_ORDER_OTHER_ERROR","ORDER_DEADLINE_PASSED_ERROR","ORDER_DEADLINE_TOO_HIGH_ERROR","INVALID_NONCE_ERROR","UNAVAILABLE_MATCHING_ENGINE_ERROR","UNAUTHORIZED_SIGNATURE_ERROR","NUMERIC_OVERFLOW_ERROR","CANCEL_ALL_AFTER_OTHER_ERROR","ORDER_NOT_FOUND_ERROR","POST_ONLY_WOULD_CROSS_ERROR","MODIFY_QTY_BELOW_FILLED_ERROR","EMPTY_MODIFY_ERROR","MODIFY_ORDER_OTHER_ERROR","RATE_LIMITED_ERROR","INSUFFICIENT_BALANCE_ERROR","PRICE_QTY_BOUNDS_ERROR","SERVICE_DISABLED_ERROR","UNAUTHORIZED_ACCOUNT_ERROR","TRADING_HALTED_ERROR","DUPLICATE_CLIENT_ORDER_ID_ERROR","ACCOUNT_BELOW_LIQUIDATION_MARGIN_ERROR","ACCOUNT_BELOW_INITIAL_MARGIN_ERROR","OPEN_INTEREST_CAP_ERROR","OPEN_INTEREST_BUDGET_ERROR","REDUCE_ONLY_CONDITION_NOT_MET_ERROR","CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR","TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR","TRIGGER_LIMIT_OUTSIDE_BAND_ERROR","TRIGGER_ALREADY_EXISTS_ERROR","ORDER_EXPIRES_TOO_SOON_ERROR","OPEN_ORDER_COUNT_EXCEEDED_ERROR","OPEN_ORDER_NOTIONAL_EXCEEDED_ERROR","CAPACITY_LIMITED_ERROR","NOT_WHITELISTED_ERROR","ACCOUNT_SUSPENDED_ERROR","UNAVAILABLE_ACCOUNT_OWNER_ERROR"],"description":"Machine-readable request rejection code. REST returns HTTP 400; the order-entry WebSocket returns the same code in its correlated error response. See the REST API HTTP 400 response reference for per-code meanings and retry guidance."},"ServerError":{"title":"ServerError","type":"object","required":["error","message"],"properties":{"error":{"$ref":"#/components/schemas/ServerErrorCode"},"message":{"type":"string","description":"Human-readable error message"}},"additionalProperties":true},"ServerErrorCode":{"title":"ServerErrorCode","type":"string","enum":["INTERNAL_SERVER_ERROR"],"description":"Standardized error codes for API responses"}},"responses":{"BadRequest":{"description":"Standardized error codes for API responses. Branch on `error`, not the free-text\n`message` or HTTP status. Every venue rejection on REST uses HTTP 400 with a\n`RequestError` body. The order-entry WebSocket returns the same code and optional\n`retryAfterMs` in its `{ ok: false, error }` response. HTTP 429 is reserved for\ninfrastructure-level (per-IP) limits in front of the API and is never a venue\nverdict.\n\nValidation and authorization:\n- `INPUT_VALIDATION_ERROR`: correct the request's fields or order-class combination\n  before resubmitting. Immutable fields on a modify must match the existing order.\n- `SYMBOL_NOT_FOUND_ERROR`, `NO_ACCOUNTS_FOUND_ERROR`,\n  `NO_PRICES_FOUND_FOR_SYMBOL_ERROR`: the requested market, account data, or price\n  data is unavailable; check the request and current market/account state.\n- `NUMERIC_OVERFLOW_ERROR`, `PRICE_QTY_BOUNDS_ERROR`: a numeric value is out of\n  range, or price/quantity is invalid for the market. Check price increments and\n  quantity limits.\n- `UNAUTHORIZED_SIGNATURE_ERROR`: the signature is invalid or unauthorized.\n  `UNAUTHORIZED_ACCOUNT_ERROR`: the signer is not permitted to act on the target\n  order. For an armed protective stop, modify and cancel require the signer that\n  created it.\n- `INVALID_NONCE_ERROR`: use a fresh, monotonically increasing nonce for the signer\n  and re-sign.\n- `ORDER_DEADLINE_PASSED_ERROR`, `ORDER_DEADLINE_TOO_HIGH_ERROR`: the signature's\n  `deadline` has passed or is too far in the future. Correct it and re-sign. This\n  deadline controls request acceptance, not the lifetime of an accepted order.\n- `ORDER_EXPIRES_TOO_SOON_ERROR`: a GTT order's `expiresAfter` leaves insufficient\n  time for execution and settlement. Choose a later expiry and re-sign. GTT orders\n  can be cancelled before their signed expiry to allow settlement; for a protective\n  stop this applies to both its armed phase and its fired child.\n- `SERVICE_DISABLED_ERROR`, `TRADING_HALTED_ERROR`: order entry is unavailable for\n  the market. Check market availability before submitting again.\n- `DUPLICATE_CLIENT_ORDER_ID_ERROR`: the client ID belongs to a live order.\n  Reconcile that order before submitting another.\n- `ORDER_NOT_FOUND_ERROR`: the target order was not found. Refresh its state before\n  retrying.\n- `EMPTY_MODIFY_ERROR`: a LIMIT modification makes no change. An armed trigger may\n  be re-signed at unchanged prices.\n- `MODIFY_QTY_BELOW_FILLED_ERROR`: the modified total quantity must exceed the\n  quantity already filled.\n- `POST_ONLY_WOULD_CROSS_ERROR`: the order would execute immediately. Choose a\n  non-crossing price or change the post-only intent and re-sign.\n- The `*_OTHER_ERROR` codes are operation-specific failures without a more specific\n  code. Use `message` for display or troubleshooting; do not parse it as a stable\n  machine-readable contract.\n\nPre-trade risk checks:\n- `ACCOUNT_BELOW_LIQUIDATION_MARGIN_ERROR`: the account does not meet the required\n  liquidation-margin or balance conditions.\n- `ACCOUNT_BELOW_INITIAL_MARGIN_ERROR`: the proposed trade does not meet the\n  account's initial-margin or collateral requirements. An account already below\n  initial margin may trade only when the trade improves its health.\n- `INSUFFICIENT_BALANCE_ERROR`: the account cannot fund the order.\n- `OPEN_INTEREST_CAP_ERROR`, `OPEN_INTEREST_BUDGET_ERROR`: the trade exceeds the\n  market's available open-interest capacity.\n- `REDUCE_ONLY_CONDITION_NOT_MET_ERROR`: the order would not strictly reduce the\n  current position, for example because there is no position, the side is wrong, or\n  the size would reverse it.\n\nA request refused by risk checks is rejected in full. A rejected create produces no\norder; a rejected modify leaves the existing order unchanged. These failures require\na change in account or market state, a smaller order, more collateral, or a user\ndecision; do not automatically retry them unchanged. Resting-order cancellations\nappear separately as `cancelReason: RISK_CANCELLED`. A protective stop whose child\nfails risk checks is cancelled with `RISK_REJECTED`; see `CancelReason`.\n\nProtective stops:\n- `TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR`: an IOC trigger cannot carry `expiresAfter`.\n  Only GTT orders carry an expiry; GTC and IOC must omit it. Invalid\n  time-in-force/expiry combinations can also return `INPUT_VALIDATION_ERROR`.\n  Correct the combination and re-sign.\n- `TRIGGER_LIMIT_OUTSIDE_BAND_ERROR`: the stop's `limitPx` is outside the permitted\n  range around `triggerPx`, or stops are unavailable for the market. Move the limit\n  closer to the trigger and re-sign when the price is out of range. If the message\n  indicates stops are unavailable, changing the price will not resolve it.\n- `TRIGGER_ALREADY_EXISTS_ERROR`: the account already has an armed stop of the same\n  type on that market. At most one stop-loss and one take-profit may be armed per\n  account and market. Modify or cancel the existing stop before replacing it.\n\nRate limits and resting-order caps:\n- `RATE_LIMITED_ERROR`: the account's request budget for this operation is\n  exhausted. Create and modify share a placement budget; single cancels, bulk\n  cancels, and cancel-all-after control have separate budgets. Budgets are shared\n  across markets, signers, REST, and WebSocket requests for the same account. Wait\n  at least `retryAfterMs` milliseconds before retrying. This is a minimum wait, not\n  a reserved request slot; concurrent traffic can use the available budget.\n  Disarming an armed cancel-all-after countdown is never throttled. A disarm when no\n  countdown is armed can be throttled.\n- `OPEN_ORDER_COUNT_EXCEEDED_ERROR`: a new resting order would exceed the account's\n  total or per-market resting-order count. Cancel orders or allow them to fill\n  before placing more. Modifications do not increase the count.\n- `OPEN_ORDER_NOTIONAL_EXCEEDED_ERROR`: the account's combined resting-order\n  notional would exceed its limit. Notional is remaining quantity multiplied by\n  limit price for resting GTC/GTT orders. Creates are checked against the submitted\n  quantity before any immediate fills; modifications are checked against the\n  resulting notional. IOC orders and armed triggers are exempt; fired trigger\n  children that rest count toward the limits. Cancel or shrink resting orders, or\n  submit a smaller order.\n\nResting-order cap errors carry no `retryAfterMs`: waiting alone does not resolve\nthem. `CAPACITY_LIMITED_ERROR` means the venue temporarily cannot accept a create or\nmodify. It carries no retry hint; use backoff with jitter. Cancels and\ncancel-all-after operations are not refused for venue capacity, though their\nseparate account rate limits still apply.\n\nTemporary availability:\n- `CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR`: an order that would execute\n  immediately cannot currently pass the required pre-trade checks. Retry after a\n  short delay. Existing resting orders remain in place; non-crossing orders and\n  cancellations remain available.\n- `UNAVAILABLE_MATCHING_ENGINE_ERROR`, `UNAVAILABLE_ACCOUNT_OWNER_ERROR`: the\n  request could not be evaluated and was not accepted. Retry it unchanged after a\n  short delay. These differ from `CAPACITY_LIMITED_ERROR`, which calls for backoff\n  with jitter.\n\nPermission errors such as `NOT_WHITELISTED_ERROR` and `ACCOUNT_SUSPENDED_ERROR` are\nnot resolved by automatic retries. Contact support if an expected operation is\nrefused.\n\nRetry policy: retry unchanged after a short delay for\n`CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR`,\n`UNAVAILABLE_MATCHING_ENGINE_ERROR`, and `UNAVAILABLE_ACCOUNT_OWNER_ERROR`; retry\n`RATE_LIMITED_ERROR` after at least `retryAfterMs`; retry `CAPACITY_LIMITED_ERROR`\nusing backoff with jitter. Correct validation failures and re-sign where required.\nReconcile order state before retrying an unanswered request, because a transport\ntimeout or disconnect does not establish that the request was rejected.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestError"}}}},"InternalServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerError"}}}}}}}
```

## Modify order

> Modify a resting order in place, preserving its \`orderId\` and \`clientOrderId\`.\
> The same rules apply to the order-entry WebSocket \`modifyOrder\` operation.\
> \
> \*\*Target and signature\*\*\
> \
> \- Target by \`orderId\`, or a non-zero \`clientOrderId\` if \`orderId\` is absent.\
> \- If both are supplied, \`orderId\` selects the order and \`clientOrderId\` must\
> &#x20; match its existing client ID. Omit \`clientOrderId\` if the order has none.\
> \- Send the complete intended post-modify \`OrderDetails\`, including unchanged\
> &#x20; values, except the fixed trigger flags described below. Omitted fields do not inherit the resting order's values.\
> \- Sign the restated fields with a fresh EIP-712 signature and nonce, using\
> &#x20; the same \`Order\` / \`OrderDetails\` envelope as \`createOrder\`.\
> \
> \*\*Fields that can change\*\*\
> \
> \| Order class | Modifiable fields | Requirements |\
> \| --- | --- | --- |\
> \| \`LIMIT\` | \`limitPx\`, \`qty\`, \`postOnly\`, \`expiresAfter\` | Omit \`triggerPx\`. Send total \`qty\`, strictly greater than \`cumQty\`; otherwise \`MODIFY\_QTY\_BELOW\_FILLED\_ERROR\`. |\
> \| Armed \`STOP\_LOSS\` / \`TAKE\_PROFIT\` | \`limitPx\`, \`triggerPx\` | Send \`triggerPx\`; omit \`qty\` and sign the full-position sentinel \`±int256.max\`, with sign from \`isBuy\`. Omit \`reduceOnly\` and \`postOnly\`; sign both as \`false\`. Supplied flags, including \`false\`, are rejected. |\
> \
> \`exchangeId\`, \`isBuy\`, \`orderType\`, \`timeInForce\`, \`clientOrderId\`,\
> \`accountId\`, and \`signerWallet\` must match the existing order. LIMIT modifies also\
> restate \`reduceOnly\`; triggers reconstruct \`reduceOnly=false\` and \`postOnly=false\`\
> before signature verification and engine submission. A mismatch returns\
> \`INPUT\_VALIDATION\_ERROR\`. For all order classes, omit \`expiresAfter\` for GTC/IOC;\
> GTT requires a future expiry strictly greater than \`deadline\`.\
> \
> Only armed stops (\`triggered: false\`) can be modified; fired children are\
> cancel-only. A stop's \`timeInForce\` and shared \`expiresAfter\` cannot change:\
> cancel and recreate it to change either. Its post-modify \`limitPx\` and\
> \`triggerPx\` must satisfy the market's trigger-price band, or the request returns\
> \`TRIGGER\_LIMIT\_OUTSIDE\_BAND\_ERROR\`.\
> \
> \*\*Priority and execution\*\*\
> \
> \- Decreasing \`qty\` at unchanged \`limitPx\` preserves queue priority. Increasing\
> &#x20; \`qty\` or changing \`limitPx\` loses priority.\
> \- An unchanged LIMIT request returns \`EMPTY\_MODIFY\_ERROR\`. An armed stop may\
> &#x20; be re-signed with a fresh \`signature\`, \`nonce\`, and \`deadline\` at unchanged prices.\
> \- A post-only modification that would cross returns \`POST\_ONLY\_WOULD\_CROSS\_ERROR\`\
> &#x20; and leaves the order unchanged. A non-post-only crossing modification can\
> &#x20; execute immediately; the response reports \`execQty\` and \`status\`.\
> \- Per-fill details are delivered on the execution and order-change streams.\
> \
> A crossing modification reports \`OPEN\` if a partially filled remainder rests, or \`FILLED\`\
> if fully executed. If it would self-trade against the account's resting liquidity, the\
> incoming modified order is cancelled with \`SELF\_TRADE\_PREVENTION\`; any completed fills\
> remain recorded. See \`POST /v2/createOrder\`, Responses and fill correlation, to associate\
> response fill IDs with streamed executions.<br>

```json
{"openapi":"3.0.3","info":{"title":"Reya DEX Trading API v2","version":"3.5.2"},"tags":[{"name":"Order Entry","description":"Place, modify, and cancel orders, or manage an account's cancel-all-after countdown.\nReya verifies signatures, signer permissions, order validity, and applicable pre-trade\nrisk checks before accepting requests.\n\n**Rate limits.** Account budgets are shared across markets, signers, REST, and WebSocket\nrequests. Create and modify share a placement budget; single cancels, bulk cancels, and\ncancel-all-after control have separate budgets. Resting orders also have count and\nnotional limits. See the HTTP 400 response reference for errors and recovery guidance.\n\n**Every venue verdict is HTTP 400.** Rejections carry the reason in the body's `error`\ncode and an optional `retryAfterMs`. Branch on the code to decide how to recover. HTTP 429 is\nreserved for infrastructure-level (per-IP) limits in front of the API and need not use\nthe venue's JSON error format.\n\n**Cancellation reasons**\n\nReason for a terminal `CANCELLED` order. `cancelReason` and `cancelReasonMessage`\nare omitted for other statuses and may be omitted when a cancellation reason is\nunavailable. Branch on `cancelReason`; `cancelReasonMessage` is explanatory text,\nnot a stable contract to parse.\n\n- `NO_LIQUIDITY`: an IOC order filled nothing at its limit.\n- `IOC_REMAINDER`: an IOC order partially filled and its unfilled quantity was\n  cancelled because no further executable liquidity was available. Both IOC reasons\n  appear on create/modify responses.\n- `USER_CANCEL`, `MASS_CANCEL`, `CANCEL_ALL_AFTER`, `GTT_EXPIRED`: cancellation by a\n  single cancel, bulk cancel, expired cancel-all-after countdown, or GTT expiry.\n  These appear on `walletOrderChanges`.\n- `SELF_TRADE_PREVENTION`: an order would trade against the account's own resting\n  order. Only the incoming order is cancelled; the resting order stays in place.\n  This can appear on create/modify responses or a crossing modification's\n  order-change event. Any fills already completed remain recorded.\n- `FEED_RESET`: rebuild the local order view from the following order events or `GET\n  /v2/wallet/{address}/openOrders`. This notification does not mean the orders were\n  cancelled on the exchange.\n- `RISK_CANCELLED`: a resting order was cancelled because it did not pass pre-trade\n  risk checks when it was about to fill. Delivered on `walletOrderChanges`, with any\n  previous fills preserved. A create or modify refused at request acceptance instead\n  returns a `RequestErrorCode`.\n- `OCO_SIBLING_FIRED`: the paired stop-loss or take-profit fired and created its\n  child order. The sibling is cancelled even when the child fills nothing.\n  Cancelling a leg manually leaves its sibling armed; protection is not\n  automatically re-armed.\n- `PROTECTIVE_SELF_TRADE_SWEEP`: a resting maker order was cancelled to allow a\n  protective stop to execute without self-trading. This reason appears on the\n  maker's cancellation, unlike `SELF_TRADE_PREVENTION`, which cancels the incoming\n  order.\n- `POSITION_CLOSED`: no tradeable quantity remains to reduce. If the position has\n  closed, reversed, or fallen below one lot before a stop fires, both protective\n  legs are cancelled with `triggered: false` and no child is created. A fired\n  child's remaining quantity is limited by the current reducible position; if that\n  quantity is zero when it attempts to fill, its remainder is cancelled.\n- `RISK_REJECTED`: the proposed protective child failed pre-trade risk checks. Both\n  protective legs are cancelled with `triggered: false`; no child is created and\n  protection is not automatically retried or re-armed.\n\nA GTT stop or its resting child can be cancelled with `GTT_EXPIRED` before the\nsigned `expiresAfter` to allow settlement. Explicit `cancelAll` includes fired\nchildren and reports `MASS_CANCEL`; cancel-all-after leaves armed protective stops\nand their fired children in place.\n"}],"servers":[{"url":"/v2"}],"paths":{"/modifyOrder":{"post":{"summary":"Modify order","description":"Modify a resting order in place, preserving its `orderId` and `clientOrderId`.\nThe same rules apply to the order-entry WebSocket `modifyOrder` operation.\n\n**Target and signature**\n\n- Target by `orderId`, or a non-zero `clientOrderId` if `orderId` is absent.\n- If both are supplied, `orderId` selects the order and `clientOrderId` must\n  match its existing client ID. Omit `clientOrderId` if the order has none.\n- Send the complete intended post-modify `OrderDetails`, including unchanged\n  values, except the fixed trigger flags described below. Omitted fields do not inherit the resting order's values.\n- Sign the restated fields with a fresh EIP-712 signature and nonce, using\n  the same `Order` / `OrderDetails` envelope as `createOrder`.\n\n**Fields that can change**\n\n| Order class | Modifiable fields | Requirements |\n| --- | --- | --- |\n| `LIMIT` | `limitPx`, `qty`, `postOnly`, `expiresAfter` | Omit `triggerPx`. Send total `qty`, strictly greater than `cumQty`; otherwise `MODIFY_QTY_BELOW_FILLED_ERROR`. |\n| Armed `STOP_LOSS` / `TAKE_PROFIT` | `limitPx`, `triggerPx` | Send `triggerPx`; omit `qty` and sign the full-position sentinel `±int256.max`, with sign from `isBuy`. Omit `reduceOnly` and `postOnly`; sign both as `false`. Supplied flags, including `false`, are rejected. |\n\n`exchangeId`, `isBuy`, `orderType`, `timeInForce`, `clientOrderId`,\n`accountId`, and `signerWallet` must match the existing order. LIMIT modifies also\nrestate `reduceOnly`; triggers reconstruct `reduceOnly=false` and `postOnly=false`\nbefore signature verification and engine submission. A mismatch returns\n`INPUT_VALIDATION_ERROR`. For all order classes, omit `expiresAfter` for GTC/IOC;\nGTT requires a future expiry strictly greater than `deadline`.\n\nOnly armed stops (`triggered: false`) can be modified; fired children are\ncancel-only. A stop's `timeInForce` and shared `expiresAfter` cannot change:\ncancel and recreate it to change either. Its post-modify `limitPx` and\n`triggerPx` must satisfy the market's trigger-price band, or the request returns\n`TRIGGER_LIMIT_OUTSIDE_BAND_ERROR`.\n\n**Priority and execution**\n\n- Decreasing `qty` at unchanged `limitPx` preserves queue priority. Increasing\n  `qty` or changing `limitPx` loses priority.\n- An unchanged LIMIT request returns `EMPTY_MODIFY_ERROR`. An armed stop may\n  be re-signed with a fresh `signature`, `nonce`, and `deadline` at unchanged prices.\n- A post-only modification that would cross returns `POST_ONLY_WOULD_CROSS_ERROR`\n  and leaves the order unchanged. A non-post-only crossing modification can\n  execute immediately; the response reports `execQty` and `status`.\n- Per-fill details are delivered on the execution and order-change streams.\n\nA crossing modification reports `OPEN` if a partially filled remainder rests, or `FILLED`\nif fully executed. If it would self-trade against the account's resting liquidity, the\nincoming modified order is cancelled with `SELF_TRADE_PREVENTION`; any completed fills\nremain recorded. See `POST /v2/createOrder`, Responses and fill correlation, to associate\nresponse fill IDs with streamed executions.\n","operationId":"modifyOrder","tags":["Order Entry"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModifyOrderRequest"}}}},"responses":{"200":{"description":"Order modification response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModifyOrderResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"schemas":{"ModifyOrderRequest":{"title":"ModifyOrderRequest","description":"Modify a resting order using its complete intended post-modify state and a fresh signature and nonce. Omitted fields do not inherit existing values. Target by `orderId` or a non-zero `clientOrderId`. See `POST /v2/modifyOrder` for modifiable fields, priority, and execution behavior.","oneOf":[{"$ref":"#/components/schemas/LimitModifyOrderRequest"},{"$ref":"#/components/schemas/TriggerModifyOrderRequest"}]},"LimitModifyOrderRequest":{"title":"LimitModifyOrderRequest","allOf":[{"$ref":"#/components/schemas/ModifyOrderRequestBase"},{"type":"object","required":["orderType","reduceOnly","postOnly"],"properties":{"orderType":{"$ref":"#/components/schemas/LimitOrderType","description":"On-chain `OrderDetails.orderType`. Immutable — restate the resting order's value; a modify never converts between `LIMIT` and `STOP_LOSS`/`TAKE_PROFIT`. A mismatch is rejected with `INPUT_VALIDATION_ERROR`. A `STOP_LOSS`/`TAKE_PROFIT` order is modifiable in place (full restate); `orderType` itself stays immutable and is restated at the resting value."},"reduceOnly":{"type":"boolean","description":"Signed OrderDetails.reduceOnly. Required and immutable on LIMIT modifications. Omit for STOP_LOSS/TAKE_PROFIT, including false: the SDK and server reconstruct the fixed signed value false; omission never inherits stored state."},"postOnly":{"type":"boolean","description":"Post-modify maker-only flag, required for LIMIT. Omit for STOP_LOSS/TAKE_PROFIT, including false: the SDK and server reconstruct the fixed signed value false. A post-only LIMIT modification that would cross is rejected with POST_ONLY_WOULD_CROSS_ERROR and leaves the order unchanged."}}}]},"ModifyOrderRequestBase":{"title":"ModifyOrderRequestBase","description":"Modify a resting order using its complete intended post-modify state and a fresh signature and nonce. Omitted fields do not inherit existing values. Target by `orderId` or a non-zero `clientOrderId`. See `POST /v2/modifyOrder` for modifiable fields, priority, and execution behavior.","type":"object","required":["exchangeId","symbol","accountId","isBuy","limitPx","timeInForce","signature","nonce","signerWallet","deadline"],"not":{"anyOf":[{"description":"At least one target identifier is required. If `orderId` is absent, `clientOrderId` must be non-zero.","allOf":[{"not":{"properties":{"orderId":{"type":"string"}},"required":["orderId"]}},{"not":{"properties":{"clientOrderId":{"type":"string"}},"required":["clientOrderId"]}}]}]},"properties":{"orderId":{"type":"string","description":"Reya-assigned order ID of the order to modify. If present, this is the canonical lookup key; `clientOrderId`, when also present, restates the resting order's immutable client id."},"clientOrderId":{"type":"string","description":"Restated client-provided order ID, as a decimal string (`uint64`). Used as the lookup key only when `orderId` is absent, and then it must be non-zero. If `orderId` is present, this field restates the resting order's immutable client id for signing; omit it when the resting order has no client id. Do not send a placeholder value. The modification cannot assign a new `clientOrderId`."},"symbol":{"$ref":"#/components/schemas/Symbol","description":"Market symbol for the order."},"accountId":{"$ref":"#/components/schemas/UnsignedInteger","description":"Account ID that owns the order. Immutable; must match the resting order."},"exchangeId":{"$ref":"#/components/schemas/UnsignedInteger","description":"On-chain `OrderDetails.exchangeId`. Immutable — restate the resting order's value (a mismatch is rejected with `INPUT_VALIDATION_ERROR`)."},"isBuy":{"type":"boolean","description":"Order side. Immutable — restate the resting order's value. Combined with `qty`, sets the signed `OrderDetails.quantity` (int256). A mismatch is rejected with `INPUT_VALIDATION_ERROR`."},"timeInForce":{"$ref":"#/components/schemas/TimeInForce","description":"On-chain `OrderDetails.timeInForce` (0 = GTC, 1 = IOC, 2 = GTT). Immutable and REQUIRED — restate the resting order's value; a modify never converts between time-in-force values, on a book order or on an armed trigger. A mismatch is rejected with `INPUT_VALIDATION_ERROR`. To give an armed `STOP_LOSS`/`TAKE_PROFIT` a different fired-child time in force, cancel it and create a new one."},"triggerPx":{"$ref":"#/components/schemas/SignedDecimal","description":"On-chain `OrderDetails.triggerPrice`. Modifiable — an armed `STOP_LOSS`/`TAKE_PROFIT` can be re-priced in place (no cancel+recreate); restate the post-modify value. Omit for a `LIMIT` order. Required on a `STOP_LOSS`/`TAKE_PROFIT` modify (full restate); a trigger modify that omits it is rejected. The post-modify `limitPx` and `triggerPx` are re-checked against the market's trigger band, so moving the trigger without moving the limit can itself put the pair outside the band (`TRIGGER_LIMIT_OUTSIDE_BAND_ERROR`)."},"limitPx":{"$ref":"#/components/schemas/SignedDecimal","description":"The post-modify worst acceptable execution price. Must be a positive number (> 0). Always required — send the complete intended value even when it is unchanged from the resting order. Changing it loses queue priority; a non-post-only modification whose new price crosses executes immediately. On a `STOP_LOSS`/`TAKE_PROFIT` modify it is the fired child's worst acceptable price and is re-checked against the market's trigger band alongside the post-modify `triggerPx` (`TRIGGER_LIMIT_OUTSIDE_BAND_ERROR`)."},"qty":{"$ref":"#/components/schemas/UnsignedDecimal","description":"The post-modify TOTAL order quantity (not remaining). Required for a `LIMIT` modify; omit for a `STOP_LOSS`/`TAKE_PROFIT` modify — a trigger modify restates the signed full-position sentinel (`quantity = ±int256.max`, sign from `isBuy`; protect the whole position). When present, send the complete intended value even when it is unchanged from the resting order. Must be strictly greater than the order's `cumQty` (else `MODIFY_QTY_BELOW_FILLED_ERROR`). A decrease at an unchanged `limitPx` preserves queue priority; an increase loses it."},"expiresAfter":{"$ref":"#/components/schemas/UnsignedInteger","description":"Unix seconds. Post-modify order expiry (`OrderDetails.expiresAfter`). Omit for GTC and IOC orders; omission never inherits the resting value. GTT modifications must send a future value greater than `deadline`. On an armed `GTT` `STOP_LOSS`/`TAKE_PROFIT` it is a restated immutable: restate the trigger's original shared deadline. A trigger's expiry cannot be extended by modification — cancel it and create a new one."},"signature":{"type":"string","description":"Fresh EIP-712 signature over the full post-modify order state — the same `Order` envelope as `createOrder`, with the modified values substituted into `OrderDetails`. See the EIP-712 signing reference in the Reya docs (https://docs.reya.xyz/developers/readme/signatures-and-nonces) for the exact typehash string and signing algorithm."},"nonce":{"type":"string","description":"Monotonically increasing per-signer nonce. A fresh nonce is required for every modification; replayed nonces are rejected with `INVALID_NONCE_ERROR`."},"signerWallet":{"$ref":"#/components/schemas/Address","description":"Address of the signer that produced the EIP-712 signature. Not modifiable; must match the resting order's signer."},"deadline":{"$ref":"#/components/schemas/UnsignedInteger","description":"Unix seconds. Required EIP-712 signature-validity deadline, signed into the `Order` envelope. It controls acceptance of this modification, not the order's lifetime. Re-signing an armed trigger with a fresh `deadline` does not extend its lifetime, and a deadline that later passes does not disarm it. Use the shared `expiresAfter` to determine a GTT stop's expiry."}},"additionalProperties":true},"Symbol":{"title":"Symbol","type":"string","pattern":"^[A-Za-z0-9]+$","description":"Trading symbol (e.g., BTCRUSDPERP, WETHRUSD)"},"UnsignedInteger":{"title":"UnsignedInteger","type":"integer","minimum":0},"TimeInForce":{"title":"TimeInForce","type":"string","enum":["IOC","GTC","GTT"],"description":"Order time in force (IOC = Immediate or Cancel, GTC = Good Till Cancel, GTT = Good Till Time)"},"SignedDecimal":{"title":"SignedDecimal","type":"string","pattern":"^-?\\d+(\\.\\d+)?([eE][+-]?\\d+)?$"},"UnsignedDecimal":{"title":"UnsignedDecimal","type":"string","pattern":"^\\d+(\\.\\d+)?([eE][+-]?\\d+)?$"},"Address":{"title":"Address","type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"LimitOrderType":{"type":"string","enum":["LIMIT"]},"TriggerModifyOrderRequest":{"title":"TriggerModifyOrderRequest","allOf":[{"$ref":"#/components/schemas/ModifyOrderRequestBase"},{"type":"object","required":["orderType"],"properties":{"orderType":{"$ref":"#/components/schemas/TriggerOrderType","description":"On-chain `OrderDetails.orderType`. Immutable — restate the resting order's value; a modify never converts between `LIMIT` and `STOP_LOSS`/`TAKE_PROFIT`. A mismatch is rejected with `INPUT_VALIDATION_ERROR`. A `STOP_LOSS`/`TAKE_PROFIT` order is modifiable in place (full restate); `orderType` itself stays immutable and is restated at the resting value."},"reduceOnly":{"not":{},"description":"Must be omitted for TP/SL, including false. The signed value is reconstructed as false."},"postOnly":{"not":{},"description":"Must be omitted for TP/SL, including false. The signed value is reconstructed as false."}}}]},"TriggerOrderType":{"type":"string","enum":["STOP_LOSS","TAKE_PROFIT"]},"ModifyOrderResponse":{"title":"ModifyOrderResponse","description":"Result of a modification, with the same orderId as before. Fields report immediate execution and resulting order state. See POST /v2/modifyOrder for outcomes and POST /v2/createOrder for shared fill-correlation rules.","type":"object","required":["status","orderId"],"properties":{"status":{"$ref":"#/components/schemas/OrderStatus"},"execQty":{"$ref":"#/components/schemas/UnsignedDecimal","description":"Quantity filled immediately by this modification. Present only when the modification crossed and executed."},"cumQty":{"$ref":"#/components/schemas/UnsignedDecimal","description":"Total executed quantity across the order's lifetime, including fills from before the modification."},"orderId":{"type":"string","description":"Order ID — unchanged by the modification (the same ID the order had before)."},"clientOrderId":{"type":"string","description":"Client-provided order ID preserved from order creation, as a decimal string (`uint64`)."},"cancelReason":{"$ref":"#/components/schemas/CancelReason","description":"Machine-readable reason the modified order was cancelled. Present if and only if `status` is `CANCELLED` — for a self-crossing non-post-only modify this is `SELF_TRADE_PREVENTION`. Omitted entirely otherwise."},"cancelReasonMessage":{"type":"string","description":"Human-readable explanation of `cancelReason`. Present only when `cancelReason` is present."},"firstFillId":{"type":"string","description":"First fill ID produced by this request. With fillCount, identifies [firstFillId, firstFillId + fillCount - 1]. Omitted if no fill occurred. See POST /v2/createOrder, Responses and fill correlation, for joining responses to streamed executions."},"fillCount":{"$ref":"#/components/schemas/UnsignedInteger","description":"Number of fills produced by this request, starting at firstFillId. Omitted if no fill occurred; positive whenever present."}},"additionalProperties":true},"OrderStatus":{"title":"OrderStatus","type":"string","enum":["OPEN","FILLED","CANCELLED"],"description":"OPEN includes partially filled resting orders, armed protective stops, and their resting children. FILLED and CANCELLED are terminal states. Use Order.triggered to distinguish armed stops from fired children. Requests rejected before order creation return errors, not order-status rows."},"CancelReason":{"title":"CancelReason","type":"string","enum":["NO_LIQUIDITY","IOC_REMAINDER","SELF_TRADE_PREVENTION","PROTECTIVE_SELF_TRADE_SWEEP","GTT_EXPIRED","USER_CANCEL","MASS_CANCEL","CANCEL_ALL_AFTER","FEED_RESET","RISK_CANCELLED","RISK_REJECTED","OCO_SIBLING_FIRED","POSITION_CLOSED"],"description":"Machine-readable cancellation reason. Present only on CANCELLED orders and may be omitted when unavailable. See Cancellation reasons in the REST API Order Entry section for per-code meanings and handling."},"RequestError":{"title":"RequestError","type":"object","required":["error","message"],"properties":{"error":{"$ref":"#/components/schemas/RequestErrorCode"},"message":{"type":"string","description":"Human-readable error message"},"retryAfterMs":{"type":"integer","minimum":1,"description":"Minimum wait in milliseconds before retrying the rejected operation. Included for `RATE_LIMITED_ERROR`; omitted for errors without a retry hint, including resting-order caps and `CAPACITY_LIMITED_ERROR`. The same field appears in the REST HTTP 400 body and the order-entry WebSocket's `{ ok: false, error }` response. When present, it is a positive integer. Wait at least this long; it does not reserve capacity, and concurrent requests can consume the account's available budget."}},"additionalProperties":true},"RequestErrorCode":{"title":"RequestErrorCode","type":"string","enum":["SYMBOL_NOT_FOUND_ERROR","NO_ACCOUNTS_FOUND_ERROR","NO_PRICES_FOUND_FOR_SYMBOL_ERROR","INPUT_VALIDATION_ERROR","CREATE_ORDER_OTHER_ERROR","CANCEL_ORDER_OTHER_ERROR","ORDER_DEADLINE_PASSED_ERROR","ORDER_DEADLINE_TOO_HIGH_ERROR","INVALID_NONCE_ERROR","UNAVAILABLE_MATCHING_ENGINE_ERROR","UNAUTHORIZED_SIGNATURE_ERROR","NUMERIC_OVERFLOW_ERROR","CANCEL_ALL_AFTER_OTHER_ERROR","ORDER_NOT_FOUND_ERROR","POST_ONLY_WOULD_CROSS_ERROR","MODIFY_QTY_BELOW_FILLED_ERROR","EMPTY_MODIFY_ERROR","MODIFY_ORDER_OTHER_ERROR","RATE_LIMITED_ERROR","INSUFFICIENT_BALANCE_ERROR","PRICE_QTY_BOUNDS_ERROR","SERVICE_DISABLED_ERROR","UNAUTHORIZED_ACCOUNT_ERROR","TRADING_HALTED_ERROR","DUPLICATE_CLIENT_ORDER_ID_ERROR","ACCOUNT_BELOW_LIQUIDATION_MARGIN_ERROR","ACCOUNT_BELOW_INITIAL_MARGIN_ERROR","OPEN_INTEREST_CAP_ERROR","OPEN_INTEREST_BUDGET_ERROR","REDUCE_ONLY_CONDITION_NOT_MET_ERROR","CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR","TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR","TRIGGER_LIMIT_OUTSIDE_BAND_ERROR","TRIGGER_ALREADY_EXISTS_ERROR","ORDER_EXPIRES_TOO_SOON_ERROR","OPEN_ORDER_COUNT_EXCEEDED_ERROR","OPEN_ORDER_NOTIONAL_EXCEEDED_ERROR","CAPACITY_LIMITED_ERROR","NOT_WHITELISTED_ERROR","ACCOUNT_SUSPENDED_ERROR","UNAVAILABLE_ACCOUNT_OWNER_ERROR"],"description":"Machine-readable request rejection code. REST returns HTTP 400; the order-entry WebSocket returns the same code in its correlated error response. See the REST API HTTP 400 response reference for per-code meanings and retry guidance."},"ServerError":{"title":"ServerError","type":"object","required":["error","message"],"properties":{"error":{"$ref":"#/components/schemas/ServerErrorCode"},"message":{"type":"string","description":"Human-readable error message"}},"additionalProperties":true},"ServerErrorCode":{"title":"ServerErrorCode","type":"string","enum":["INTERNAL_SERVER_ERROR"],"description":"Standardized error codes for API responses"}},"responses":{"BadRequest":{"description":"Standardized error codes for API responses. Branch on `error`, not the free-text\n`message` or HTTP status. Every venue rejection on REST uses HTTP 400 with a\n`RequestError` body. The order-entry WebSocket returns the same code and optional\n`retryAfterMs` in its `{ ok: false, error }` response. HTTP 429 is reserved for\ninfrastructure-level (per-IP) limits in front of the API and is never a venue\nverdict.\n\nValidation and authorization:\n- `INPUT_VALIDATION_ERROR`: correct the request's fields or order-class combination\n  before resubmitting. Immutable fields on a modify must match the existing order.\n- `SYMBOL_NOT_FOUND_ERROR`, `NO_ACCOUNTS_FOUND_ERROR`,\n  `NO_PRICES_FOUND_FOR_SYMBOL_ERROR`: the requested market, account data, or price\n  data is unavailable; check the request and current market/account state.\n- `NUMERIC_OVERFLOW_ERROR`, `PRICE_QTY_BOUNDS_ERROR`: a numeric value is out of\n  range, or price/quantity is invalid for the market. Check price increments and\n  quantity limits.\n- `UNAUTHORIZED_SIGNATURE_ERROR`: the signature is invalid or unauthorized.\n  `UNAUTHORIZED_ACCOUNT_ERROR`: the signer is not permitted to act on the target\n  order. For an armed protective stop, modify and cancel require the signer that\n  created it.\n- `INVALID_NONCE_ERROR`: use a fresh, monotonically increasing nonce for the signer\n  and re-sign.\n- `ORDER_DEADLINE_PASSED_ERROR`, `ORDER_DEADLINE_TOO_HIGH_ERROR`: the signature's\n  `deadline` has passed or is too far in the future. Correct it and re-sign. This\n  deadline controls request acceptance, not the lifetime of an accepted order.\n- `ORDER_EXPIRES_TOO_SOON_ERROR`: a GTT order's `expiresAfter` leaves insufficient\n  time for execution and settlement. Choose a later expiry and re-sign. GTT orders\n  can be cancelled before their signed expiry to allow settlement; for a protective\n  stop this applies to both its armed phase and its fired child.\n- `SERVICE_DISABLED_ERROR`, `TRADING_HALTED_ERROR`: order entry is unavailable for\n  the market. Check market availability before submitting again.\n- `DUPLICATE_CLIENT_ORDER_ID_ERROR`: the client ID belongs to a live order.\n  Reconcile that order before submitting another.\n- `ORDER_NOT_FOUND_ERROR`: the target order was not found. Refresh its state before\n  retrying.\n- `EMPTY_MODIFY_ERROR`: a LIMIT modification makes no change. An armed trigger may\n  be re-signed at unchanged prices.\n- `MODIFY_QTY_BELOW_FILLED_ERROR`: the modified total quantity must exceed the\n  quantity already filled.\n- `POST_ONLY_WOULD_CROSS_ERROR`: the order would execute immediately. Choose a\n  non-crossing price or change the post-only intent and re-sign.\n- The `*_OTHER_ERROR` codes are operation-specific failures without a more specific\n  code. Use `message` for display or troubleshooting; do not parse it as a stable\n  machine-readable contract.\n\nPre-trade risk checks:\n- `ACCOUNT_BELOW_LIQUIDATION_MARGIN_ERROR`: the account does not meet the required\n  liquidation-margin or balance conditions.\n- `ACCOUNT_BELOW_INITIAL_MARGIN_ERROR`: the proposed trade does not meet the\n  account's initial-margin or collateral requirements. An account already below\n  initial margin may trade only when the trade improves its health.\n- `INSUFFICIENT_BALANCE_ERROR`: the account cannot fund the order.\n- `OPEN_INTEREST_CAP_ERROR`, `OPEN_INTEREST_BUDGET_ERROR`: the trade exceeds the\n  market's available open-interest capacity.\n- `REDUCE_ONLY_CONDITION_NOT_MET_ERROR`: the order would not strictly reduce the\n  current position, for example because there is no position, the side is wrong, or\n  the size would reverse it.\n\nA request refused by risk checks is rejected in full. A rejected create produces no\norder; a rejected modify leaves the existing order unchanged. These failures require\na change in account or market state, a smaller order, more collateral, or a user\ndecision; do not automatically retry them unchanged. Resting-order cancellations\nappear separately as `cancelReason: RISK_CANCELLED`. A protective stop whose child\nfails risk checks is cancelled with `RISK_REJECTED`; see `CancelReason`.\n\nProtective stops:\n- `TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR`: an IOC trigger cannot carry `expiresAfter`.\n  Only GTT orders carry an expiry; GTC and IOC must omit it. Invalid\n  time-in-force/expiry combinations can also return `INPUT_VALIDATION_ERROR`.\n  Correct the combination and re-sign.\n- `TRIGGER_LIMIT_OUTSIDE_BAND_ERROR`: the stop's `limitPx` is outside the permitted\n  range around `triggerPx`, or stops are unavailable for the market. Move the limit\n  closer to the trigger and re-sign when the price is out of range. If the message\n  indicates stops are unavailable, changing the price will not resolve it.\n- `TRIGGER_ALREADY_EXISTS_ERROR`: the account already has an armed stop of the same\n  type on that market. At most one stop-loss and one take-profit may be armed per\n  account and market. Modify or cancel the existing stop before replacing it.\n\nRate limits and resting-order caps:\n- `RATE_LIMITED_ERROR`: the account's request budget for this operation is\n  exhausted. Create and modify share a placement budget; single cancels, bulk\n  cancels, and cancel-all-after control have separate budgets. Budgets are shared\n  across markets, signers, REST, and WebSocket requests for the same account. Wait\n  at least `retryAfterMs` milliseconds before retrying. This is a minimum wait, not\n  a reserved request slot; concurrent traffic can use the available budget.\n  Disarming an armed cancel-all-after countdown is never throttled. A disarm when no\n  countdown is armed can be throttled.\n- `OPEN_ORDER_COUNT_EXCEEDED_ERROR`: a new resting order would exceed the account's\n  total or per-market resting-order count. Cancel orders or allow them to fill\n  before placing more. Modifications do not increase the count.\n- `OPEN_ORDER_NOTIONAL_EXCEEDED_ERROR`: the account's combined resting-order\n  notional would exceed its limit. Notional is remaining quantity multiplied by\n  limit price for resting GTC/GTT orders. Creates are checked against the submitted\n  quantity before any immediate fills; modifications are checked against the\n  resulting notional. IOC orders and armed triggers are exempt; fired trigger\n  children that rest count toward the limits. Cancel or shrink resting orders, or\n  submit a smaller order.\n\nResting-order cap errors carry no `retryAfterMs`: waiting alone does not resolve\nthem. `CAPACITY_LIMITED_ERROR` means the venue temporarily cannot accept a create or\nmodify. It carries no retry hint; use backoff with jitter. Cancels and\ncancel-all-after operations are not refused for venue capacity, though their\nseparate account rate limits still apply.\n\nTemporary availability:\n- `CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR`: an order that would execute\n  immediately cannot currently pass the required pre-trade checks. Retry after a\n  short delay. Existing resting orders remain in place; non-crossing orders and\n  cancellations remain available.\n- `UNAVAILABLE_MATCHING_ENGINE_ERROR`, `UNAVAILABLE_ACCOUNT_OWNER_ERROR`: the\n  request could not be evaluated and was not accepted. Retry it unchanged after a\n  short delay. These differ from `CAPACITY_LIMITED_ERROR`, which calls for backoff\n  with jitter.\n\nPermission errors such as `NOT_WHITELISTED_ERROR` and `ACCOUNT_SUSPENDED_ERROR` are\nnot resolved by automatic retries. Contact support if an expected operation is\nrefused.\n\nRetry policy: retry unchanged after a short delay for\n`CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR`,\n`UNAVAILABLE_MATCHING_ENGINE_ERROR`, and `UNAVAILABLE_ACCOUNT_OWNER_ERROR`; retry\n`RATE_LIMITED_ERROR` after at least `retryAfterMs`; retry `CAPACITY_LIMITED_ERROR`\nusing backoff with jitter. Correct validation failures and re-sign where required.\nReconcile order state before retrying an unanswered request, because a transport\ntimeout or disconnect does not establish that the request was rejected.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestError"}}}},"InternalServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerError"}}}}}}}
```

## Cancel order

> Cancel an existing order. Supports spot, perp, and protective stop orders. \`accountId\`,\
> \`nonce\`, and \`deadline\` are required and bound into the EIP-712 signature.\
> \
> For a \`STOP\_LOSS\` / \`TAKE\_PROFIT\`, cancellation is bound to the \*\*arming signer\*\*: the wallet\
> that signs this cancel must be the exact wallet that armed the trigger, so a different signer\
> holding trade permission on the same account cannot cancel it and is rejected with\
> \`UNAUTHORIZED\_ACCOUNT\_ERROR\`. The same binding applies to \`modifyOrder\` on an armed trigger.\
> \
> Also available on the order-entry WebSocket (\`asyncapi-exec-v2.yaml\`, \`cancelOrder\`).<br>

```json
{"openapi":"3.0.3","info":{"title":"Reya DEX Trading API v2","version":"3.5.2"},"tags":[{"name":"Order Entry","description":"Place, modify, and cancel orders, or manage an account's cancel-all-after countdown.\nReya verifies signatures, signer permissions, order validity, and applicable pre-trade\nrisk checks before accepting requests.\n\n**Rate limits.** Account budgets are shared across markets, signers, REST, and WebSocket\nrequests. Create and modify share a placement budget; single cancels, bulk cancels, and\ncancel-all-after control have separate budgets. Resting orders also have count and\nnotional limits. See the HTTP 400 response reference for errors and recovery guidance.\n\n**Every venue verdict is HTTP 400.** Rejections carry the reason in the body's `error`\ncode and an optional `retryAfterMs`. Branch on the code to decide how to recover. HTTP 429 is\nreserved for infrastructure-level (per-IP) limits in front of the API and need not use\nthe venue's JSON error format.\n\n**Cancellation reasons**\n\nReason for a terminal `CANCELLED` order. `cancelReason` and `cancelReasonMessage`\nare omitted for other statuses and may be omitted when a cancellation reason is\nunavailable. Branch on `cancelReason`; `cancelReasonMessage` is explanatory text,\nnot a stable contract to parse.\n\n- `NO_LIQUIDITY`: an IOC order filled nothing at its limit.\n- `IOC_REMAINDER`: an IOC order partially filled and its unfilled quantity was\n  cancelled because no further executable liquidity was available. Both IOC reasons\n  appear on create/modify responses.\n- `USER_CANCEL`, `MASS_CANCEL`, `CANCEL_ALL_AFTER`, `GTT_EXPIRED`: cancellation by a\n  single cancel, bulk cancel, expired cancel-all-after countdown, or GTT expiry.\n  These appear on `walletOrderChanges`.\n- `SELF_TRADE_PREVENTION`: an order would trade against the account's own resting\n  order. Only the incoming order is cancelled; the resting order stays in place.\n  This can appear on create/modify responses or a crossing modification's\n  order-change event. Any fills already completed remain recorded.\n- `FEED_RESET`: rebuild the local order view from the following order events or `GET\n  /v2/wallet/{address}/openOrders`. This notification does not mean the orders were\n  cancelled on the exchange.\n- `RISK_CANCELLED`: a resting order was cancelled because it did not pass pre-trade\n  risk checks when it was about to fill. Delivered on `walletOrderChanges`, with any\n  previous fills preserved. A create or modify refused at request acceptance instead\n  returns a `RequestErrorCode`.\n- `OCO_SIBLING_FIRED`: the paired stop-loss or take-profit fired and created its\n  child order. The sibling is cancelled even when the child fills nothing.\n  Cancelling a leg manually leaves its sibling armed; protection is not\n  automatically re-armed.\n- `PROTECTIVE_SELF_TRADE_SWEEP`: a resting maker order was cancelled to allow a\n  protective stop to execute without self-trading. This reason appears on the\n  maker's cancellation, unlike `SELF_TRADE_PREVENTION`, which cancels the incoming\n  order.\n- `POSITION_CLOSED`: no tradeable quantity remains to reduce. If the position has\n  closed, reversed, or fallen below one lot before a stop fires, both protective\n  legs are cancelled with `triggered: false` and no child is created. A fired\n  child's remaining quantity is limited by the current reducible position; if that\n  quantity is zero when it attempts to fill, its remainder is cancelled.\n- `RISK_REJECTED`: the proposed protective child failed pre-trade risk checks. Both\n  protective legs are cancelled with `triggered: false`; no child is created and\n  protection is not automatically retried or re-armed.\n\nA GTT stop or its resting child can be cancelled with `GTT_EXPIRED` before the\nsigned `expiresAfter` to allow settlement. Explicit `cancelAll` includes fired\nchildren and reports `MASS_CANCEL`; cancel-all-after leaves armed protective stops\nand their fired children in place.\n"}],"servers":[{"url":"/v2"}],"paths":{"/cancelOrder":{"post":{"summary":"Cancel order","description":"Cancel an existing order. Supports spot, perp, and protective stop orders. `accountId`,\n`nonce`, and `deadline` are required and bound into the EIP-712 signature.\n\nFor a `STOP_LOSS` / `TAKE_PROFIT`, cancellation is bound to the **arming signer**: the wallet\nthat signs this cancel must be the exact wallet that armed the trigger, so a different signer\nholding trade permission on the same account cannot cancel it and is rejected with\n`UNAUTHORIZED_ACCOUNT_ERROR`. The same binding applies to `modifyOrder` on an armed trigger.\n\nAlso available on the order-entry WebSocket (`asyncapi-exec-v2.yaml`, `cancelOrder`).\n","operationId":"cancelOrder","tags":["Order Entry"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelOrderRequest"}}}},"responses":{"200":{"description":"Order cancellation response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelOrderResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"schemas":{"CancelOrderRequest":{"title":"CancelOrderRequest","description":"Cancel a live order by orderId, or a non-zero clientOrderId when orderId is absent. Supports spot, perp, and protective stops. See POST /v2/cancelOrder for signer requirements.","type":"object","required":["symbol","signature","accountId","nonce","deadline"],"not":{"description":"At least one target identifier is required. If `orderId` is absent, `clientOrderId` must be non-zero.","allOf":[{"not":{"properties":{"orderId":{"type":"string"}},"required":["orderId"]}},{"not":{"properties":{"clientOrderId":{"type":"string"}},"required":["clientOrderId"]}}]},"properties":{"orderId":{"type":"string","description":"Reya-assigned order ID to cancel, as returned by `CreateOrderResponse`. Provide `orderId`, or a non-zero `clientOrderId` when `orderId` is absent. If both are supplied, `orderId` takes precedence and `clientOrderId` is ignored."},"clientOrderId":{"type":"string","description":"Client-provided order ID for tracking and correlation, as a decimal string (`uint64`). Used as the lookup key only when `orderId` is absent, and then it must be non-zero. This is the same clientOrderId provided in CreateOrderRequest."},"accountId":{"$ref":"#/components/schemas/UnsignedInteger","description":"Account ID that owns the order."},"symbol":{"$ref":"#/components/schemas/Symbol","description":"Market symbol for the order."},"signature":{"type":"string","description":"EIP-712 signature over the `OrderCancel(uint64 verifyingChainId, uint64 deadline, OrderCancelDetails cancel)` envelope. See the EIP-712 signing reference in the Reya docs (https://docs.reya.xyz/developers/readme/signatures-and-nonces) for the exact typehash string and signing algorithm."},"nonce":{"type":"string","description":"Monotonically increasing per-signer nonce. A fresh nonce is required per request; replayed nonces are rejected with `INVALID_NONCE_ERROR`. See the EIP-712 signing reference in the Reya docs (https://docs.reya.xyz/developers/readme/signatures-and-nonces)."},"deadline":{"$ref":"#/components/schemas/UnsignedInteger","description":"Unix seconds. Signature-validity deadline signed into the OrderCancel envelope. Requests received after this timestamp are rejected."}},"additionalProperties":true},"UnsignedInteger":{"title":"UnsignedInteger","type":"integer","minimum":0},"Symbol":{"title":"Symbol","type":"string","pattern":"^[A-Za-z0-9]+$","description":"Trading symbol (e.g., BTCRUSDPERP, WETHRUSD)"},"CancelOrderResponse":{"title":"CancelOrderResponse","type":"object","required":["status","orderId"],"properties":{"status":{"$ref":"#/components/schemas/OrderStatus"},"orderId":{"type":"string","description":"Cancelled order ID"},"clientOrderId":{"type":"string","description":"Client-provided order ID echoed back from the request, as a decimal string (`uint64`)."}},"additionalProperties":true},"OrderStatus":{"title":"OrderStatus","type":"string","enum":["OPEN","FILLED","CANCELLED"],"description":"OPEN includes partially filled resting orders, armed protective stops, and their resting children. FILLED and CANCELLED are terminal states. Use Order.triggered to distinguish armed stops from fired children. Requests rejected before order creation return errors, not order-status rows."},"RequestError":{"title":"RequestError","type":"object","required":["error","message"],"properties":{"error":{"$ref":"#/components/schemas/RequestErrorCode"},"message":{"type":"string","description":"Human-readable error message"},"retryAfterMs":{"type":"integer","minimum":1,"description":"Minimum wait in milliseconds before retrying the rejected operation. Included for `RATE_LIMITED_ERROR`; omitted for errors without a retry hint, including resting-order caps and `CAPACITY_LIMITED_ERROR`. The same field appears in the REST HTTP 400 body and the order-entry WebSocket's `{ ok: false, error }` response. When present, it is a positive integer. Wait at least this long; it does not reserve capacity, and concurrent requests can consume the account's available budget."}},"additionalProperties":true},"RequestErrorCode":{"title":"RequestErrorCode","type":"string","enum":["SYMBOL_NOT_FOUND_ERROR","NO_ACCOUNTS_FOUND_ERROR","NO_PRICES_FOUND_FOR_SYMBOL_ERROR","INPUT_VALIDATION_ERROR","CREATE_ORDER_OTHER_ERROR","CANCEL_ORDER_OTHER_ERROR","ORDER_DEADLINE_PASSED_ERROR","ORDER_DEADLINE_TOO_HIGH_ERROR","INVALID_NONCE_ERROR","UNAVAILABLE_MATCHING_ENGINE_ERROR","UNAUTHORIZED_SIGNATURE_ERROR","NUMERIC_OVERFLOW_ERROR","CANCEL_ALL_AFTER_OTHER_ERROR","ORDER_NOT_FOUND_ERROR","POST_ONLY_WOULD_CROSS_ERROR","MODIFY_QTY_BELOW_FILLED_ERROR","EMPTY_MODIFY_ERROR","MODIFY_ORDER_OTHER_ERROR","RATE_LIMITED_ERROR","INSUFFICIENT_BALANCE_ERROR","PRICE_QTY_BOUNDS_ERROR","SERVICE_DISABLED_ERROR","UNAUTHORIZED_ACCOUNT_ERROR","TRADING_HALTED_ERROR","DUPLICATE_CLIENT_ORDER_ID_ERROR","ACCOUNT_BELOW_LIQUIDATION_MARGIN_ERROR","ACCOUNT_BELOW_INITIAL_MARGIN_ERROR","OPEN_INTEREST_CAP_ERROR","OPEN_INTEREST_BUDGET_ERROR","REDUCE_ONLY_CONDITION_NOT_MET_ERROR","CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR","TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR","TRIGGER_LIMIT_OUTSIDE_BAND_ERROR","TRIGGER_ALREADY_EXISTS_ERROR","ORDER_EXPIRES_TOO_SOON_ERROR","OPEN_ORDER_COUNT_EXCEEDED_ERROR","OPEN_ORDER_NOTIONAL_EXCEEDED_ERROR","CAPACITY_LIMITED_ERROR","NOT_WHITELISTED_ERROR","ACCOUNT_SUSPENDED_ERROR","UNAVAILABLE_ACCOUNT_OWNER_ERROR"],"description":"Machine-readable request rejection code. REST returns HTTP 400; the order-entry WebSocket returns the same code in its correlated error response. See the REST API HTTP 400 response reference for per-code meanings and retry guidance."},"ServerError":{"title":"ServerError","type":"object","required":["error","message"],"properties":{"error":{"$ref":"#/components/schemas/ServerErrorCode"},"message":{"type":"string","description":"Human-readable error message"}},"additionalProperties":true},"ServerErrorCode":{"title":"ServerErrorCode","type":"string","enum":["INTERNAL_SERVER_ERROR"],"description":"Standardized error codes for API responses"}},"responses":{"BadRequest":{"description":"Standardized error codes for API responses. Branch on `error`, not the free-text\n`message` or HTTP status. Every venue rejection on REST uses HTTP 400 with a\n`RequestError` body. The order-entry WebSocket returns the same code and optional\n`retryAfterMs` in its `{ ok: false, error }` response. HTTP 429 is reserved for\ninfrastructure-level (per-IP) limits in front of the API and is never a venue\nverdict.\n\nValidation and authorization:\n- `INPUT_VALIDATION_ERROR`: correct the request's fields or order-class combination\n  before resubmitting. Immutable fields on a modify must match the existing order.\n- `SYMBOL_NOT_FOUND_ERROR`, `NO_ACCOUNTS_FOUND_ERROR`,\n  `NO_PRICES_FOUND_FOR_SYMBOL_ERROR`: the requested market, account data, or price\n  data is unavailable; check the request and current market/account state.\n- `NUMERIC_OVERFLOW_ERROR`, `PRICE_QTY_BOUNDS_ERROR`: a numeric value is out of\n  range, or price/quantity is invalid for the market. Check price increments and\n  quantity limits.\n- `UNAUTHORIZED_SIGNATURE_ERROR`: the signature is invalid or unauthorized.\n  `UNAUTHORIZED_ACCOUNT_ERROR`: the signer is not permitted to act on the target\n  order. For an armed protective stop, modify and cancel require the signer that\n  created it.\n- `INVALID_NONCE_ERROR`: use a fresh, monotonically increasing nonce for the signer\n  and re-sign.\n- `ORDER_DEADLINE_PASSED_ERROR`, `ORDER_DEADLINE_TOO_HIGH_ERROR`: the signature's\n  `deadline` has passed or is too far in the future. Correct it and re-sign. This\n  deadline controls request acceptance, not the lifetime of an accepted order.\n- `ORDER_EXPIRES_TOO_SOON_ERROR`: a GTT order's `expiresAfter` leaves insufficient\n  time for execution and settlement. Choose a later expiry and re-sign. GTT orders\n  can be cancelled before their signed expiry to allow settlement; for a protective\n  stop this applies to both its armed phase and its fired child.\n- `SERVICE_DISABLED_ERROR`, `TRADING_HALTED_ERROR`: order entry is unavailable for\n  the market. Check market availability before submitting again.\n- `DUPLICATE_CLIENT_ORDER_ID_ERROR`: the client ID belongs to a live order.\n  Reconcile that order before submitting another.\n- `ORDER_NOT_FOUND_ERROR`: the target order was not found. Refresh its state before\n  retrying.\n- `EMPTY_MODIFY_ERROR`: a LIMIT modification makes no change. An armed trigger may\n  be re-signed at unchanged prices.\n- `MODIFY_QTY_BELOW_FILLED_ERROR`: the modified total quantity must exceed the\n  quantity already filled.\n- `POST_ONLY_WOULD_CROSS_ERROR`: the order would execute immediately. Choose a\n  non-crossing price or change the post-only intent and re-sign.\n- The `*_OTHER_ERROR` codes are operation-specific failures without a more specific\n  code. Use `message` for display or troubleshooting; do not parse it as a stable\n  machine-readable contract.\n\nPre-trade risk checks:\n- `ACCOUNT_BELOW_LIQUIDATION_MARGIN_ERROR`: the account does not meet the required\n  liquidation-margin or balance conditions.\n- `ACCOUNT_BELOW_INITIAL_MARGIN_ERROR`: the proposed trade does not meet the\n  account's initial-margin or collateral requirements. An account already below\n  initial margin may trade only when the trade improves its health.\n- `INSUFFICIENT_BALANCE_ERROR`: the account cannot fund the order.\n- `OPEN_INTEREST_CAP_ERROR`, `OPEN_INTEREST_BUDGET_ERROR`: the trade exceeds the\n  market's available open-interest capacity.\n- `REDUCE_ONLY_CONDITION_NOT_MET_ERROR`: the order would not strictly reduce the\n  current position, for example because there is no position, the side is wrong, or\n  the size would reverse it.\n\nA request refused by risk checks is rejected in full. A rejected create produces no\norder; a rejected modify leaves the existing order unchanged. These failures require\na change in account or market state, a smaller order, more collateral, or a user\ndecision; do not automatically retry them unchanged. Resting-order cancellations\nappear separately as `cancelReason: RISK_CANCELLED`. A protective stop whose child\nfails risk checks is cancelled with `RISK_REJECTED`; see `CancelReason`.\n\nProtective stops:\n- `TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR`: an IOC trigger cannot carry `expiresAfter`.\n  Only GTT orders carry an expiry; GTC and IOC must omit it. Invalid\n  time-in-force/expiry combinations can also return `INPUT_VALIDATION_ERROR`.\n  Correct the combination and re-sign.\n- `TRIGGER_LIMIT_OUTSIDE_BAND_ERROR`: the stop's `limitPx` is outside the permitted\n  range around `triggerPx`, or stops are unavailable for the market. Move the limit\n  closer to the trigger and re-sign when the price is out of range. If the message\n  indicates stops are unavailable, changing the price will not resolve it.\n- `TRIGGER_ALREADY_EXISTS_ERROR`: the account already has an armed stop of the same\n  type on that market. At most one stop-loss and one take-profit may be armed per\n  account and market. Modify or cancel the existing stop before replacing it.\n\nRate limits and resting-order caps:\n- `RATE_LIMITED_ERROR`: the account's request budget for this operation is\n  exhausted. Create and modify share a placement budget; single cancels, bulk\n  cancels, and cancel-all-after control have separate budgets. Budgets are shared\n  across markets, signers, REST, and WebSocket requests for the same account. Wait\n  at least `retryAfterMs` milliseconds before retrying. This is a minimum wait, not\n  a reserved request slot; concurrent traffic can use the available budget.\n  Disarming an armed cancel-all-after countdown is never throttled. A disarm when no\n  countdown is armed can be throttled.\n- `OPEN_ORDER_COUNT_EXCEEDED_ERROR`: a new resting order would exceed the account's\n  total or per-market resting-order count. Cancel orders or allow them to fill\n  before placing more. Modifications do not increase the count.\n- `OPEN_ORDER_NOTIONAL_EXCEEDED_ERROR`: the account's combined resting-order\n  notional would exceed its limit. Notional is remaining quantity multiplied by\n  limit price for resting GTC/GTT orders. Creates are checked against the submitted\n  quantity before any immediate fills; modifications are checked against the\n  resulting notional. IOC orders and armed triggers are exempt; fired trigger\n  children that rest count toward the limits. Cancel or shrink resting orders, or\n  submit a smaller order.\n\nResting-order cap errors carry no `retryAfterMs`: waiting alone does not resolve\nthem. `CAPACITY_LIMITED_ERROR` means the venue temporarily cannot accept a create or\nmodify. It carries no retry hint; use backoff with jitter. Cancels and\ncancel-all-after operations are not refused for venue capacity, though their\nseparate account rate limits still apply.\n\nTemporary availability:\n- `CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR`: an order that would execute\n  immediately cannot currently pass the required pre-trade checks. Retry after a\n  short delay. Existing resting orders remain in place; non-crossing orders and\n  cancellations remain available.\n- `UNAVAILABLE_MATCHING_ENGINE_ERROR`, `UNAVAILABLE_ACCOUNT_OWNER_ERROR`: the\n  request could not be evaluated and was not accepted. Retry it unchanged after a\n  short delay. These differ from `CAPACITY_LIMITED_ERROR`, which calls for backoff\n  with jitter.\n\nPermission errors such as `NOT_WHITELISTED_ERROR` and `ACCOUNT_SUSPENDED_ERROR` are\nnot resolved by automatic retries. Contact support if an expected operation is\nrefused.\n\nRetry policy: retry unchanged after a short delay for\n`CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR`,\n`UNAVAILABLE_MATCHING_ENGINE_ERROR`, and `UNAVAILABLE_ACCOUNT_OWNER_ERROR`; retry\n`RATE_LIMITED_ERROR` after at least `retryAfterMs`; retry `CAPACITY_LIMITED_ERROR`\nusing backoff with jitter. Correct validation failures and re-sign where required.\nReconcile order state before retrying an unanswered request, because a transport\ntimeout or disconnect does not establish that the request was rejected.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestError"}}}},"InternalServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerError"}}}}}}}
```

## Cancel all orders

> Cancel all open orders for an account, optionally restricted by \`symbol\`. Omit \`symbol\`\
> to cancel across the account's markets. Supports spot and perp markets and includes\
> protective stops and their fired children. Also available on the order-entry WebSocket\
> as \`cancelAll\`; the same filters and signing requirements apply.<br>

```json
{"openapi":"3.0.3","info":{"title":"Reya DEX Trading API v2","version":"3.5.2"},"tags":[{"name":"Order Entry","description":"Place, modify, and cancel orders, or manage an account's cancel-all-after countdown.\nReya verifies signatures, signer permissions, order validity, and applicable pre-trade\nrisk checks before accepting requests.\n\n**Rate limits.** Account budgets are shared across markets, signers, REST, and WebSocket\nrequests. Create and modify share a placement budget; single cancels, bulk cancels, and\ncancel-all-after control have separate budgets. Resting orders also have count and\nnotional limits. See the HTTP 400 response reference for errors and recovery guidance.\n\n**Every venue verdict is HTTP 400.** Rejections carry the reason in the body's `error`\ncode and an optional `retryAfterMs`. Branch on the code to decide how to recover. HTTP 429 is\nreserved for infrastructure-level (per-IP) limits in front of the API and need not use\nthe venue's JSON error format.\n\n**Cancellation reasons**\n\nReason for a terminal `CANCELLED` order. `cancelReason` and `cancelReasonMessage`\nare omitted for other statuses and may be omitted when a cancellation reason is\nunavailable. Branch on `cancelReason`; `cancelReasonMessage` is explanatory text,\nnot a stable contract to parse.\n\n- `NO_LIQUIDITY`: an IOC order filled nothing at its limit.\n- `IOC_REMAINDER`: an IOC order partially filled and its unfilled quantity was\n  cancelled because no further executable liquidity was available. Both IOC reasons\n  appear on create/modify responses.\n- `USER_CANCEL`, `MASS_CANCEL`, `CANCEL_ALL_AFTER`, `GTT_EXPIRED`: cancellation by a\n  single cancel, bulk cancel, expired cancel-all-after countdown, or GTT expiry.\n  These appear on `walletOrderChanges`.\n- `SELF_TRADE_PREVENTION`: an order would trade against the account's own resting\n  order. Only the incoming order is cancelled; the resting order stays in place.\n  This can appear on create/modify responses or a crossing modification's\n  order-change event. Any fills already completed remain recorded.\n- `FEED_RESET`: rebuild the local order view from the following order events or `GET\n  /v2/wallet/{address}/openOrders`. This notification does not mean the orders were\n  cancelled on the exchange.\n- `RISK_CANCELLED`: a resting order was cancelled because it did not pass pre-trade\n  risk checks when it was about to fill. Delivered on `walletOrderChanges`, with any\n  previous fills preserved. A create or modify refused at request acceptance instead\n  returns a `RequestErrorCode`.\n- `OCO_SIBLING_FIRED`: the paired stop-loss or take-profit fired and created its\n  child order. The sibling is cancelled even when the child fills nothing.\n  Cancelling a leg manually leaves its sibling armed; protection is not\n  automatically re-armed.\n- `PROTECTIVE_SELF_TRADE_SWEEP`: a resting maker order was cancelled to allow a\n  protective stop to execute without self-trading. This reason appears on the\n  maker's cancellation, unlike `SELF_TRADE_PREVENTION`, which cancels the incoming\n  order.\n- `POSITION_CLOSED`: no tradeable quantity remains to reduce. If the position has\n  closed, reversed, or fallen below one lot before a stop fires, both protective\n  legs are cancelled with `triggered: false` and no child is created. A fired\n  child's remaining quantity is limited by the current reducible position; if that\n  quantity is zero when it attempts to fill, its remainder is cancelled.\n- `RISK_REJECTED`: the proposed protective child failed pre-trade risk checks. Both\n  protective legs are cancelled with `triggered: false`; no child is created and\n  protection is not automatically retried or re-armed.\n\nA GTT stop or its resting child can be cancelled with `GTT_EXPIRED` before the\nsigned `expiresAfter` to allow settlement. Explicit `cancelAll` includes fired\nchildren and reports `MASS_CANCEL`; cancel-all-after leaves armed protective stops\nand their fired children in place.\n"}],"servers":[{"url":"/v2"}],"paths":{"/cancelAll":{"post":{"summary":"Cancel all orders","description":"Cancel all open orders for an account, optionally restricted by `symbol`. Omit `symbol`\nto cancel across the account's markets. Supports spot and perp markets and includes\nprotective stops and their fired children. Also available on the order-entry WebSocket\nas `cancelAll`; the same filters and signing requirements apply.\n","operationId":"cancelAll","tags":["Order Entry"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MassCancelRequest"}}}},"responses":{"200":{"description":"Mass cancel response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MassCancelResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"schemas":{"MassCancelRequest":{"title":"MassCancelRequest","type":"object","required":["signature","nonce","accountId","deadline"],"properties":{"accountId":{"$ref":"#/components/schemas/UnsignedInteger","description":"Account ID to cancel orders for."},"symbol":{"$ref":"#/components/schemas/Symbol","description":"Symbol to cancel orders for. If not specified, cancels orders for all symbols."},"signature":{"type":"string","description":"EIP-712 signature over the `MassCancel(uint64 verifyingChainId, uint64 deadline, MassCancelDetails massCancel)` envelope. See the EIP-712 signing reference in the Reya docs (https://docs.reya.xyz/developers/readme/signatures-and-nonces) for the exact typehash string and signing algorithm."},"nonce":{"type":"string","description":"Monotonically increasing per-signer nonce. A fresh nonce is required per request; replayed nonces are rejected with `INVALID_NONCE_ERROR`. See the EIP-712 signing reference in the Reya docs (https://docs.reya.xyz/developers/readme/signatures-and-nonces)."},"deadline":{"$ref":"#/components/schemas/UnsignedInteger","description":"Unix seconds. Signature-validity deadline signed into the MassCancel envelope. Requests received after this timestamp are rejected."}},"additionalProperties":true,"description":"Request to cancel all orders matching the specified filters"},"UnsignedInteger":{"title":"UnsignedInteger","type":"integer","minimum":0},"Symbol":{"title":"Symbol","type":"string","pattern":"^[A-Za-z0-9]+$","description":"Trading symbol (e.g., BTCRUSDPERP, WETHRUSD)"},"MassCancelResponse":{"title":"MassCancelResponse","type":"object","required":["cancelledCount"],"properties":{"cancelledCount":{"$ref":"#/components/schemas/UnsignedInteger","description":"Number of orders that were cancelled"}},"additionalProperties":true},"RequestError":{"title":"RequestError","type":"object","required":["error","message"],"properties":{"error":{"$ref":"#/components/schemas/RequestErrorCode"},"message":{"type":"string","description":"Human-readable error message"},"retryAfterMs":{"type":"integer","minimum":1,"description":"Minimum wait in milliseconds before retrying the rejected operation. Included for `RATE_LIMITED_ERROR`; omitted for errors without a retry hint, including resting-order caps and `CAPACITY_LIMITED_ERROR`. The same field appears in the REST HTTP 400 body and the order-entry WebSocket's `{ ok: false, error }` response. When present, it is a positive integer. Wait at least this long; it does not reserve capacity, and concurrent requests can consume the account's available budget."}},"additionalProperties":true},"RequestErrorCode":{"title":"RequestErrorCode","type":"string","enum":["SYMBOL_NOT_FOUND_ERROR","NO_ACCOUNTS_FOUND_ERROR","NO_PRICES_FOUND_FOR_SYMBOL_ERROR","INPUT_VALIDATION_ERROR","CREATE_ORDER_OTHER_ERROR","CANCEL_ORDER_OTHER_ERROR","ORDER_DEADLINE_PASSED_ERROR","ORDER_DEADLINE_TOO_HIGH_ERROR","INVALID_NONCE_ERROR","UNAVAILABLE_MATCHING_ENGINE_ERROR","UNAUTHORIZED_SIGNATURE_ERROR","NUMERIC_OVERFLOW_ERROR","CANCEL_ALL_AFTER_OTHER_ERROR","ORDER_NOT_FOUND_ERROR","POST_ONLY_WOULD_CROSS_ERROR","MODIFY_QTY_BELOW_FILLED_ERROR","EMPTY_MODIFY_ERROR","MODIFY_ORDER_OTHER_ERROR","RATE_LIMITED_ERROR","INSUFFICIENT_BALANCE_ERROR","PRICE_QTY_BOUNDS_ERROR","SERVICE_DISABLED_ERROR","UNAUTHORIZED_ACCOUNT_ERROR","TRADING_HALTED_ERROR","DUPLICATE_CLIENT_ORDER_ID_ERROR","ACCOUNT_BELOW_LIQUIDATION_MARGIN_ERROR","ACCOUNT_BELOW_INITIAL_MARGIN_ERROR","OPEN_INTEREST_CAP_ERROR","OPEN_INTEREST_BUDGET_ERROR","REDUCE_ONLY_CONDITION_NOT_MET_ERROR","CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR","TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR","TRIGGER_LIMIT_OUTSIDE_BAND_ERROR","TRIGGER_ALREADY_EXISTS_ERROR","ORDER_EXPIRES_TOO_SOON_ERROR","OPEN_ORDER_COUNT_EXCEEDED_ERROR","OPEN_ORDER_NOTIONAL_EXCEEDED_ERROR","CAPACITY_LIMITED_ERROR","NOT_WHITELISTED_ERROR","ACCOUNT_SUSPENDED_ERROR","UNAVAILABLE_ACCOUNT_OWNER_ERROR"],"description":"Machine-readable request rejection code. REST returns HTTP 400; the order-entry WebSocket returns the same code in its correlated error response. See the REST API HTTP 400 response reference for per-code meanings and retry guidance."},"ServerError":{"title":"ServerError","type":"object","required":["error","message"],"properties":{"error":{"$ref":"#/components/schemas/ServerErrorCode"},"message":{"type":"string","description":"Human-readable error message"}},"additionalProperties":true},"ServerErrorCode":{"title":"ServerErrorCode","type":"string","enum":["INTERNAL_SERVER_ERROR"],"description":"Standardized error codes for API responses"}},"responses":{"BadRequest":{"description":"Standardized error codes for API responses. Branch on `error`, not the free-text\n`message` or HTTP status. Every venue rejection on REST uses HTTP 400 with a\n`RequestError` body. The order-entry WebSocket returns the same code and optional\n`retryAfterMs` in its `{ ok: false, error }` response. HTTP 429 is reserved for\ninfrastructure-level (per-IP) limits in front of the API and is never a venue\nverdict.\n\nValidation and authorization:\n- `INPUT_VALIDATION_ERROR`: correct the request's fields or order-class combination\n  before resubmitting. Immutable fields on a modify must match the existing order.\n- `SYMBOL_NOT_FOUND_ERROR`, `NO_ACCOUNTS_FOUND_ERROR`,\n  `NO_PRICES_FOUND_FOR_SYMBOL_ERROR`: the requested market, account data, or price\n  data is unavailable; check the request and current market/account state.\n- `NUMERIC_OVERFLOW_ERROR`, `PRICE_QTY_BOUNDS_ERROR`: a numeric value is out of\n  range, or price/quantity is invalid for the market. Check price increments and\n  quantity limits.\n- `UNAUTHORIZED_SIGNATURE_ERROR`: the signature is invalid or unauthorized.\n  `UNAUTHORIZED_ACCOUNT_ERROR`: the signer is not permitted to act on the target\n  order. For an armed protective stop, modify and cancel require the signer that\n  created it.\n- `INVALID_NONCE_ERROR`: use a fresh, monotonically increasing nonce for the signer\n  and re-sign.\n- `ORDER_DEADLINE_PASSED_ERROR`, `ORDER_DEADLINE_TOO_HIGH_ERROR`: the signature's\n  `deadline` has passed or is too far in the future. Correct it and re-sign. This\n  deadline controls request acceptance, not the lifetime of an accepted order.\n- `ORDER_EXPIRES_TOO_SOON_ERROR`: a GTT order's `expiresAfter` leaves insufficient\n  time for execution and settlement. Choose a later expiry and re-sign. GTT orders\n  can be cancelled before their signed expiry to allow settlement; for a protective\n  stop this applies to both its armed phase and its fired child.\n- `SERVICE_DISABLED_ERROR`, `TRADING_HALTED_ERROR`: order entry is unavailable for\n  the market. Check market availability before submitting again.\n- `DUPLICATE_CLIENT_ORDER_ID_ERROR`: the client ID belongs to a live order.\n  Reconcile that order before submitting another.\n- `ORDER_NOT_FOUND_ERROR`: the target order was not found. Refresh its state before\n  retrying.\n- `EMPTY_MODIFY_ERROR`: a LIMIT modification makes no change. An armed trigger may\n  be re-signed at unchanged prices.\n- `MODIFY_QTY_BELOW_FILLED_ERROR`: the modified total quantity must exceed the\n  quantity already filled.\n- `POST_ONLY_WOULD_CROSS_ERROR`: the order would execute immediately. Choose a\n  non-crossing price or change the post-only intent and re-sign.\n- The `*_OTHER_ERROR` codes are operation-specific failures without a more specific\n  code. Use `message` for display or troubleshooting; do not parse it as a stable\n  machine-readable contract.\n\nPre-trade risk checks:\n- `ACCOUNT_BELOW_LIQUIDATION_MARGIN_ERROR`: the account does not meet the required\n  liquidation-margin or balance conditions.\n- `ACCOUNT_BELOW_INITIAL_MARGIN_ERROR`: the proposed trade does not meet the\n  account's initial-margin or collateral requirements. An account already below\n  initial margin may trade only when the trade improves its health.\n- `INSUFFICIENT_BALANCE_ERROR`: the account cannot fund the order.\n- `OPEN_INTEREST_CAP_ERROR`, `OPEN_INTEREST_BUDGET_ERROR`: the trade exceeds the\n  market's available open-interest capacity.\n- `REDUCE_ONLY_CONDITION_NOT_MET_ERROR`: the order would not strictly reduce the\n  current position, for example because there is no position, the side is wrong, or\n  the size would reverse it.\n\nA request refused by risk checks is rejected in full. A rejected create produces no\norder; a rejected modify leaves the existing order unchanged. These failures require\na change in account or market state, a smaller order, more collateral, or a user\ndecision; do not automatically retry them unchanged. Resting-order cancellations\nappear separately as `cancelReason: RISK_CANCELLED`. A protective stop whose child\nfails risk checks is cancelled with `RISK_REJECTED`; see `CancelReason`.\n\nProtective stops:\n- `TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR`: an IOC trigger cannot carry `expiresAfter`.\n  Only GTT orders carry an expiry; GTC and IOC must omit it. Invalid\n  time-in-force/expiry combinations can also return `INPUT_VALIDATION_ERROR`.\n  Correct the combination and re-sign.\n- `TRIGGER_LIMIT_OUTSIDE_BAND_ERROR`: the stop's `limitPx` is outside the permitted\n  range around `triggerPx`, or stops are unavailable for the market. Move the limit\n  closer to the trigger and re-sign when the price is out of range. If the message\n  indicates stops are unavailable, changing the price will not resolve it.\n- `TRIGGER_ALREADY_EXISTS_ERROR`: the account already has an armed stop of the same\n  type on that market. At most one stop-loss and one take-profit may be armed per\n  account and market. Modify or cancel the existing stop before replacing it.\n\nRate limits and resting-order caps:\n- `RATE_LIMITED_ERROR`: the account's request budget for this operation is\n  exhausted. Create and modify share a placement budget; single cancels, bulk\n  cancels, and cancel-all-after control have separate budgets. Budgets are shared\n  across markets, signers, REST, and WebSocket requests for the same account. Wait\n  at least `retryAfterMs` milliseconds before retrying. This is a minimum wait, not\n  a reserved request slot; concurrent traffic can use the available budget.\n  Disarming an armed cancel-all-after countdown is never throttled. A disarm when no\n  countdown is armed can be throttled.\n- `OPEN_ORDER_COUNT_EXCEEDED_ERROR`: a new resting order would exceed the account's\n  total or per-market resting-order count. Cancel orders or allow them to fill\n  before placing more. Modifications do not increase the count.\n- `OPEN_ORDER_NOTIONAL_EXCEEDED_ERROR`: the account's combined resting-order\n  notional would exceed its limit. Notional is remaining quantity multiplied by\n  limit price for resting GTC/GTT orders. Creates are checked against the submitted\n  quantity before any immediate fills; modifications are checked against the\n  resulting notional. IOC orders and armed triggers are exempt; fired trigger\n  children that rest count toward the limits. Cancel or shrink resting orders, or\n  submit a smaller order.\n\nResting-order cap errors carry no `retryAfterMs`: waiting alone does not resolve\nthem. `CAPACITY_LIMITED_ERROR` means the venue temporarily cannot accept a create or\nmodify. It carries no retry hint; use backoff with jitter. Cancels and\ncancel-all-after operations are not refused for venue capacity, though their\nseparate account rate limits still apply.\n\nTemporary availability:\n- `CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR`: an order that would execute\n  immediately cannot currently pass the required pre-trade checks. Retry after a\n  short delay. Existing resting orders remain in place; non-crossing orders and\n  cancellations remain available.\n- `UNAVAILABLE_MATCHING_ENGINE_ERROR`, `UNAVAILABLE_ACCOUNT_OWNER_ERROR`: the\n  request could not be evaluated and was not accepted. Retry it unchanged after a\n  short delay. These differ from `CAPACITY_LIMITED_ERROR`, which calls for backoff\n  with jitter.\n\nPermission errors such as `NOT_WHITELISTED_ERROR` and `ACCOUNT_SUSPENDED_ERROR` are\nnot resolved by automatic retries. Contact support if an expected operation is\nrefused.\n\nRetry policy: retry unchanged after a short delay for\n`CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR`,\n`UNAVAILABLE_MATCHING_ENGINE_ERROR`, and `UNAVAILABLE_ACCOUNT_OWNER_ERROR`; retry\n`RATE_LIMITED_ERROR` after at least `retryAfterMs`; retry `CAPACITY_LIMITED_ERROR`\nusing backoff with jitter. Correct validation failures and re-sign where required.\nReconcile order state before retrying an unanswered request, because a transport\ntimeout or disconnect does not establish that the request was rejected.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestError"}}}},"InternalServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerError"}}}}}}}
```

## Set cancel-all-after countdown

> Arm, refresh, or disarm an account-scoped cancel-all-after countdown. The same countdown\
> can be managed interchangeably over REST and the order-entry WebSocket.\
> \
> \*\*Countdown controls\*\*\
> \
> \- Send \`timeoutMs\` in \[5000, 60000] milliseconds to arm a countdown. Another successful\
> &#x20; call replaces it with a new countdown of the requested duration, including when the\
> &#x20; duration is unchanged.\
> \- Send \`timeoutMs: 0\` to disarm; it is a no-op if no countdown is armed.\
> \- Only another \`cancelAllAfter\` call refreshes the countdown. Order traffic and pings\
> &#x20; do not refresh it; a WebSocket close does not trigger it. It survives reconnects\
> &#x20; until it fires or is disarmed.\
> \- For example, arm for 30000 ms and refresh every 10–15 seconds. Refresh well before expiry.\
> \
> \*\*Affected orders\*\*\
> \
> On expiry, all open orders for \`accountId\` are cancelled except protective stops\
> (\`STOP\_LOSS\` / \`TAKE\_PROFIT\`) and their fired children. Cancellations appear on\
> \`walletOrderChanges\` with \`CANCEL\_ALL\_AFTER\`. Explicit \`POST /v2/cancelAll\` also cancels\
> protective stops and their children.\
> \
> \*\*Signature and response\*\*\
> \
> Sign \`accountId\`, \`timeoutMs\`, and \`nonce\` in the EIP-712 \`CancelAllAfterDetails\`, using\
> the envelope and signer requirements in the request fields. \`deadline\` is the signature\
> validity in Unix seconds; it does not set countdown expiry. The response's \`triggerAt\`\
> is an advisory Unix timestamp in milliseconds and is omitted when disarming.\
> \
> \*\*Rate limits\*\*\
> \
> Countdown control has a separate account budget from placements and cancels. Disarming\
> an armed countdown is never throttled; a no-op disarm can be throttled. Rate-limit\
> rejections return \`RATE\_LIMITED\_ERROR\` with \`retryAfterMs\`. See the HTTP 400 response\
> reference for recovery guidance.<br>

```json
{"openapi":"3.0.3","info":{"title":"Reya DEX Trading API v2","version":"3.5.2"},"tags":[{"name":"Order Entry","description":"Place, modify, and cancel orders, or manage an account's cancel-all-after countdown.\nReya verifies signatures, signer permissions, order validity, and applicable pre-trade\nrisk checks before accepting requests.\n\n**Rate limits.** Account budgets are shared across markets, signers, REST, and WebSocket\nrequests. Create and modify share a placement budget; single cancels, bulk cancels, and\ncancel-all-after control have separate budgets. Resting orders also have count and\nnotional limits. See the HTTP 400 response reference for errors and recovery guidance.\n\n**Every venue verdict is HTTP 400.** Rejections carry the reason in the body's `error`\ncode and an optional `retryAfterMs`. Branch on the code to decide how to recover. HTTP 429 is\nreserved for infrastructure-level (per-IP) limits in front of the API and need not use\nthe venue's JSON error format.\n\n**Cancellation reasons**\n\nReason for a terminal `CANCELLED` order. `cancelReason` and `cancelReasonMessage`\nare omitted for other statuses and may be omitted when a cancellation reason is\nunavailable. Branch on `cancelReason`; `cancelReasonMessage` is explanatory text,\nnot a stable contract to parse.\n\n- `NO_LIQUIDITY`: an IOC order filled nothing at its limit.\n- `IOC_REMAINDER`: an IOC order partially filled and its unfilled quantity was\n  cancelled because no further executable liquidity was available. Both IOC reasons\n  appear on create/modify responses.\n- `USER_CANCEL`, `MASS_CANCEL`, `CANCEL_ALL_AFTER`, `GTT_EXPIRED`: cancellation by a\n  single cancel, bulk cancel, expired cancel-all-after countdown, or GTT expiry.\n  These appear on `walletOrderChanges`.\n- `SELF_TRADE_PREVENTION`: an order would trade against the account's own resting\n  order. Only the incoming order is cancelled; the resting order stays in place.\n  This can appear on create/modify responses or a crossing modification's\n  order-change event. Any fills already completed remain recorded.\n- `FEED_RESET`: rebuild the local order view from the following order events or `GET\n  /v2/wallet/{address}/openOrders`. This notification does not mean the orders were\n  cancelled on the exchange.\n- `RISK_CANCELLED`: a resting order was cancelled because it did not pass pre-trade\n  risk checks when it was about to fill. Delivered on `walletOrderChanges`, with any\n  previous fills preserved. A create or modify refused at request acceptance instead\n  returns a `RequestErrorCode`.\n- `OCO_SIBLING_FIRED`: the paired stop-loss or take-profit fired and created its\n  child order. The sibling is cancelled even when the child fills nothing.\n  Cancelling a leg manually leaves its sibling armed; protection is not\n  automatically re-armed.\n- `PROTECTIVE_SELF_TRADE_SWEEP`: a resting maker order was cancelled to allow a\n  protective stop to execute without self-trading. This reason appears on the\n  maker's cancellation, unlike `SELF_TRADE_PREVENTION`, which cancels the incoming\n  order.\n- `POSITION_CLOSED`: no tradeable quantity remains to reduce. If the position has\n  closed, reversed, or fallen below one lot before a stop fires, both protective\n  legs are cancelled with `triggered: false` and no child is created. A fired\n  child's remaining quantity is limited by the current reducible position; if that\n  quantity is zero when it attempts to fill, its remainder is cancelled.\n- `RISK_REJECTED`: the proposed protective child failed pre-trade risk checks. Both\n  protective legs are cancelled with `triggered: false`; no child is created and\n  protection is not automatically retried or re-armed.\n\nA GTT stop or its resting child can be cancelled with `GTT_EXPIRED` before the\nsigned `expiresAfter` to allow settlement. Explicit `cancelAll` includes fired\nchildren and reports `MASS_CANCEL`; cancel-all-after leaves armed protective stops\nand their fired children in place.\n"}],"servers":[{"url":"/v2"}],"paths":{"/cancelAllAfter":{"post":{"summary":"Set cancel-all-after countdown","description":"Arm, refresh, or disarm an account-scoped cancel-all-after countdown. The same countdown\ncan be managed interchangeably over REST and the order-entry WebSocket.\n\n**Countdown controls**\n\n- Send `timeoutMs` in [5000, 60000] milliseconds to arm a countdown. Another successful\n  call replaces it with a new countdown of the requested duration, including when the\n  duration is unchanged.\n- Send `timeoutMs: 0` to disarm; it is a no-op if no countdown is armed.\n- Only another `cancelAllAfter` call refreshes the countdown. Order traffic and pings\n  do not refresh it; a WebSocket close does not trigger it. It survives reconnects\n  until it fires or is disarmed.\n- For example, arm for 30000 ms and refresh every 10–15 seconds. Refresh well before expiry.\n\n**Affected orders**\n\nOn expiry, all open orders for `accountId` are cancelled except protective stops\n(`STOP_LOSS` / `TAKE_PROFIT`) and their fired children. Cancellations appear on\n`walletOrderChanges` with `CANCEL_ALL_AFTER`. Explicit `POST /v2/cancelAll` also cancels\nprotective stops and their children.\n\n**Signature and response**\n\nSign `accountId`, `timeoutMs`, and `nonce` in the EIP-712 `CancelAllAfterDetails`, using\nthe envelope and signer requirements in the request fields. `deadline` is the signature\nvalidity in Unix seconds; it does not set countdown expiry. The response's `triggerAt`\nis an advisory Unix timestamp in milliseconds and is omitted when disarming.\n\n**Rate limits**\n\nCountdown control has a separate account budget from placements and cancels. Disarming\nan armed countdown is never throttled; a no-op disarm can be throttled. Rate-limit\nrejections return `RATE_LIMITED_ERROR` with `retryAfterMs`. See the HTTP 400 response\nreference for recovery guidance.\n","operationId":"cancelAllAfter","tags":["Order Entry"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelAllAfterRequest"}}}},"responses":{"200":{"description":"Cancel-all-after response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelAllAfterResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}},"components":{"schemas":{"CancelAllAfterRequest":{"title":"CancelAllAfterRequest","description":"Arm, refresh, or disarm the account's cancel-all-after countdown using a signed request. See POST /v2/cancelAllAfter for affected orders, refresh rules, disconnect behavior, and throttling.","type":"object","required":["accountId","timeoutMs","signature","nonce","signerWallet","deadline"],"properties":{"accountId":{"$ref":"#/components/schemas/UnsignedInteger","description":"Account ID whose open orders are covered by the countdown."},"timeoutMs":{"$ref":"#/components/schemas/UnsignedInteger","description":"Countdown duration in milliseconds: 0 disarms; 5000–60000 arms or refreshes. Other values return INPUT_VALIDATION_ERROR. Signed into CancelAllAfterDetails. See POST /v2/cancelAllAfter for countdown and throttling behavior."},"signature":{"type":"string","description":"EIP-712 signature over the `CancelAllAfter(uint64 verifyingChainId, uint64 deadline, CancelAllAfterDetails cancelAllAfter)` envelope, where `CancelAllAfterDetails(uint64 accountId, uint64 timeoutMs, uint64 nonce)`. See the EIP-712 signing reference in the Reya docs (https://docs.reya.xyz/developers/readme/signatures-and-nonces) for the exact typehash string and signing algorithm."},"nonce":{"type":"string","description":"Monotonically increasing per-signer nonce. A fresh nonce is required on every arm/refresh/disarm call; replayed nonces are rejected with `INVALID_NONCE_ERROR`."},"signerWallet":{"$ref":"#/components/schemas/Address","description":"Address of the signer that produced the EIP-712 signature. Required on `cancelAllAfter` and must match the signature. Omit `signerWallet` from `cancelOrder` and `cancelAll` requests."},"deadline":{"$ref":"#/components/schemas/UnsignedInteger","description":"Unix seconds. Signature-validity deadline signed into the CancelAllAfter envelope. It controls request acceptance, not countdown expiry; see timeoutMs and the response's triggerAt."}},"additionalProperties":true},"UnsignedInteger":{"title":"UnsignedInteger","type":"integer","minimum":0},"Address":{"title":"Address","type":"string","pattern":"^0x[a-fA-F0-9]{40}$"},"CancelAllAfterResponse":{"title":"CancelAllAfterResponse","type":"object","required":["accountId","timeoutMs"],"properties":{"accountId":{"$ref":"#/components/schemas/UnsignedInteger","description":"Account ID the countdown applies to, echoed from the request."},"timeoutMs":{"$ref":"#/components/schemas/UnsignedInteger","description":"Effective countdown duration in milliseconds; `0` means the switch is now disarmed."},"triggerAt":{"$ref":"#/components/schemas/UnsignedInteger","description":"Advisory Unix timestamp in milliseconds at which the countdown will fire unless refreshed or disarmed. The countdown starts when the request is accepted, using the requested `timeoutMs`. Use this timestamp for display and schedule refreshes well before expiry. Omitted when `timeoutMs` is `0`."}},"additionalProperties":true},"RequestError":{"title":"RequestError","type":"object","required":["error","message"],"properties":{"error":{"$ref":"#/components/schemas/RequestErrorCode"},"message":{"type":"string","description":"Human-readable error message"},"retryAfterMs":{"type":"integer","minimum":1,"description":"Minimum wait in milliseconds before retrying the rejected operation. Included for `RATE_LIMITED_ERROR`; omitted for errors without a retry hint, including resting-order caps and `CAPACITY_LIMITED_ERROR`. The same field appears in the REST HTTP 400 body and the order-entry WebSocket's `{ ok: false, error }` response. When present, it is a positive integer. Wait at least this long; it does not reserve capacity, and concurrent requests can consume the account's available budget."}},"additionalProperties":true},"RequestErrorCode":{"title":"RequestErrorCode","type":"string","enum":["SYMBOL_NOT_FOUND_ERROR","NO_ACCOUNTS_FOUND_ERROR","NO_PRICES_FOUND_FOR_SYMBOL_ERROR","INPUT_VALIDATION_ERROR","CREATE_ORDER_OTHER_ERROR","CANCEL_ORDER_OTHER_ERROR","ORDER_DEADLINE_PASSED_ERROR","ORDER_DEADLINE_TOO_HIGH_ERROR","INVALID_NONCE_ERROR","UNAVAILABLE_MATCHING_ENGINE_ERROR","UNAUTHORIZED_SIGNATURE_ERROR","NUMERIC_OVERFLOW_ERROR","CANCEL_ALL_AFTER_OTHER_ERROR","ORDER_NOT_FOUND_ERROR","POST_ONLY_WOULD_CROSS_ERROR","MODIFY_QTY_BELOW_FILLED_ERROR","EMPTY_MODIFY_ERROR","MODIFY_ORDER_OTHER_ERROR","RATE_LIMITED_ERROR","INSUFFICIENT_BALANCE_ERROR","PRICE_QTY_BOUNDS_ERROR","SERVICE_DISABLED_ERROR","UNAUTHORIZED_ACCOUNT_ERROR","TRADING_HALTED_ERROR","DUPLICATE_CLIENT_ORDER_ID_ERROR","ACCOUNT_BELOW_LIQUIDATION_MARGIN_ERROR","ACCOUNT_BELOW_INITIAL_MARGIN_ERROR","OPEN_INTEREST_CAP_ERROR","OPEN_INTEREST_BUDGET_ERROR","REDUCE_ONLY_CONDITION_NOT_MET_ERROR","CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR","TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR","TRIGGER_LIMIT_OUTSIDE_BAND_ERROR","TRIGGER_ALREADY_EXISTS_ERROR","ORDER_EXPIRES_TOO_SOON_ERROR","OPEN_ORDER_COUNT_EXCEEDED_ERROR","OPEN_ORDER_NOTIONAL_EXCEEDED_ERROR","CAPACITY_LIMITED_ERROR","NOT_WHITELISTED_ERROR","ACCOUNT_SUSPENDED_ERROR","UNAVAILABLE_ACCOUNT_OWNER_ERROR"],"description":"Machine-readable request rejection code. REST returns HTTP 400; the order-entry WebSocket returns the same code in its correlated error response. See the REST API HTTP 400 response reference for per-code meanings and retry guidance."},"ServerError":{"title":"ServerError","type":"object","required":["error","message"],"properties":{"error":{"$ref":"#/components/schemas/ServerErrorCode"},"message":{"type":"string","description":"Human-readable error message"}},"additionalProperties":true},"ServerErrorCode":{"title":"ServerErrorCode","type":"string","enum":["INTERNAL_SERVER_ERROR"],"description":"Standardized error codes for API responses"}},"responses":{"BadRequest":{"description":"Standardized error codes for API responses. Branch on `error`, not the free-text\n`message` or HTTP status. Every venue rejection on REST uses HTTP 400 with a\n`RequestError` body. The order-entry WebSocket returns the same code and optional\n`retryAfterMs` in its `{ ok: false, error }` response. HTTP 429 is reserved for\ninfrastructure-level (per-IP) limits in front of the API and is never a venue\nverdict.\n\nValidation and authorization:\n- `INPUT_VALIDATION_ERROR`: correct the request's fields or order-class combination\n  before resubmitting. Immutable fields on a modify must match the existing order.\n- `SYMBOL_NOT_FOUND_ERROR`, `NO_ACCOUNTS_FOUND_ERROR`,\n  `NO_PRICES_FOUND_FOR_SYMBOL_ERROR`: the requested market, account data, or price\n  data is unavailable; check the request and current market/account state.\n- `NUMERIC_OVERFLOW_ERROR`, `PRICE_QTY_BOUNDS_ERROR`: a numeric value is out of\n  range, or price/quantity is invalid for the market. Check price increments and\n  quantity limits.\n- `UNAUTHORIZED_SIGNATURE_ERROR`: the signature is invalid or unauthorized.\n  `UNAUTHORIZED_ACCOUNT_ERROR`: the signer is not permitted to act on the target\n  order. For an armed protective stop, modify and cancel require the signer that\n  created it.\n- `INVALID_NONCE_ERROR`: use a fresh, monotonically increasing nonce for the signer\n  and re-sign.\n- `ORDER_DEADLINE_PASSED_ERROR`, `ORDER_DEADLINE_TOO_HIGH_ERROR`: the signature's\n  `deadline` has passed or is too far in the future. Correct it and re-sign. This\n  deadline controls request acceptance, not the lifetime of an accepted order.\n- `ORDER_EXPIRES_TOO_SOON_ERROR`: a GTT order's `expiresAfter` leaves insufficient\n  time for execution and settlement. Choose a later expiry and re-sign. GTT orders\n  can be cancelled before their signed expiry to allow settlement; for a protective\n  stop this applies to both its armed phase and its fired child.\n- `SERVICE_DISABLED_ERROR`, `TRADING_HALTED_ERROR`: order entry is unavailable for\n  the market. Check market availability before submitting again.\n- `DUPLICATE_CLIENT_ORDER_ID_ERROR`: the client ID belongs to a live order.\n  Reconcile that order before submitting another.\n- `ORDER_NOT_FOUND_ERROR`: the target order was not found. Refresh its state before\n  retrying.\n- `EMPTY_MODIFY_ERROR`: a LIMIT modification makes no change. An armed trigger may\n  be re-signed at unchanged prices.\n- `MODIFY_QTY_BELOW_FILLED_ERROR`: the modified total quantity must exceed the\n  quantity already filled.\n- `POST_ONLY_WOULD_CROSS_ERROR`: the order would execute immediately. Choose a\n  non-crossing price or change the post-only intent and re-sign.\n- The `*_OTHER_ERROR` codes are operation-specific failures without a more specific\n  code. Use `message` for display or troubleshooting; do not parse it as a stable\n  machine-readable contract.\n\nPre-trade risk checks:\n- `ACCOUNT_BELOW_LIQUIDATION_MARGIN_ERROR`: the account does not meet the required\n  liquidation-margin or balance conditions.\n- `ACCOUNT_BELOW_INITIAL_MARGIN_ERROR`: the proposed trade does not meet the\n  account's initial-margin or collateral requirements. An account already below\n  initial margin may trade only when the trade improves its health.\n- `INSUFFICIENT_BALANCE_ERROR`: the account cannot fund the order.\n- `OPEN_INTEREST_CAP_ERROR`, `OPEN_INTEREST_BUDGET_ERROR`: the trade exceeds the\n  market's available open-interest capacity.\n- `REDUCE_ONLY_CONDITION_NOT_MET_ERROR`: the order would not strictly reduce the\n  current position, for example because there is no position, the side is wrong, or\n  the size would reverse it.\n\nA request refused by risk checks is rejected in full. A rejected create produces no\norder; a rejected modify leaves the existing order unchanged. These failures require\na change in account or market state, a smaller order, more collateral, or a user\ndecision; do not automatically retry them unchanged. Resting-order cancellations\nappear separately as `cancelReason: RISK_CANCELLED`. A protective stop whose child\nfails risk checks is cancelled with `RISK_REJECTED`; see `CancelReason`.\n\nProtective stops:\n- `TRIGGER_IOC_MUST_NOT_EXPIRE_ERROR`: an IOC trigger cannot carry `expiresAfter`.\n  Only GTT orders carry an expiry; GTC and IOC must omit it. Invalid\n  time-in-force/expiry combinations can also return `INPUT_VALIDATION_ERROR`.\n  Correct the combination and re-sign.\n- `TRIGGER_LIMIT_OUTSIDE_BAND_ERROR`: the stop's `limitPx` is outside the permitted\n  range around `triggerPx`, or stops are unavailable for the market. Move the limit\n  closer to the trigger and re-sign when the price is out of range. If the message\n  indicates stops are unavailable, changing the price will not resolve it.\n- `TRIGGER_ALREADY_EXISTS_ERROR`: the account already has an armed stop of the same\n  type on that market. At most one stop-loss and one take-profit may be armed per\n  account and market. Modify or cancel the existing stop before replacing it.\n\nRate limits and resting-order caps:\n- `RATE_LIMITED_ERROR`: the account's request budget for this operation is\n  exhausted. Create and modify share a placement budget; single cancels, bulk\n  cancels, and cancel-all-after control have separate budgets. Budgets are shared\n  across markets, signers, REST, and WebSocket requests for the same account. Wait\n  at least `retryAfterMs` milliseconds before retrying. This is a minimum wait, not\n  a reserved request slot; concurrent traffic can use the available budget.\n  Disarming an armed cancel-all-after countdown is never throttled. A disarm when no\n  countdown is armed can be throttled.\n- `OPEN_ORDER_COUNT_EXCEEDED_ERROR`: a new resting order would exceed the account's\n  total or per-market resting-order count. Cancel orders or allow them to fill\n  before placing more. Modifications do not increase the count.\n- `OPEN_ORDER_NOTIONAL_EXCEEDED_ERROR`: the account's combined resting-order\n  notional would exceed its limit. Notional is remaining quantity multiplied by\n  limit price for resting GTC/GTT orders. Creates are checked against the submitted\n  quantity before any immediate fills; modifications are checked against the\n  resulting notional. IOC orders and armed triggers are exempt; fired trigger\n  children that rest count toward the limits. Cancel or shrink resting orders, or\n  submit a smaller order.\n\nResting-order cap errors carry no `retryAfterMs`: waiting alone does not resolve\nthem. `CAPACITY_LIMITED_ERROR` means the venue temporarily cannot accept a create or\nmodify. It carries no retry hint; use backoff with jitter. Cancels and\ncancel-all-after operations are not refused for venue capacity, though their\nseparate account rate limits still apply.\n\nTemporary availability:\n- `CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR`: an order that would execute\n  immediately cannot currently pass the required pre-trade checks. Retry after a\n  short delay. Existing resting orders remain in place; non-crossing orders and\n  cancellations remain available.\n- `UNAVAILABLE_MATCHING_ENGINE_ERROR`, `UNAVAILABLE_ACCOUNT_OWNER_ERROR`: the\n  request could not be evaluated and was not accepted. Retry it unchanged after a\n  short delay. These differ from `CAPACITY_LIMITED_ERROR`, which calls for backoff\n  with jitter.\n\nPermission errors such as `NOT_WHITELISTED_ERROR` and `ACCOUNT_SUSPENDED_ERROR` are\nnot resolved by automatic retries. Contact support if an expected operation is\nrefused.\n\nRetry policy: retry unchanged after a short delay for\n`CROSSING_ORDERS_TEMPORARILY_UNAVAILABLE_ERROR`,\n`UNAVAILABLE_MATCHING_ENGINE_ERROR`, and `UNAVAILABLE_ACCOUNT_OWNER_ERROR`; retry\n`RATE_LIMITED_ERROR` after at least `retryAfterMs`; retry `CAPACITY_LIMITED_ERROR`\nusing backoff with jitter. Correct validation failures and re-sign where required.\nReconcile order state before retrying an unanswered request, because a transport\ntimeout or disconnect does not establish that the request was rejected.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestError"}}}},"InternalServerError":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServerError"}}}}}}}
```
