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

# Orders

## Place Order

> Submit one or more orders. Supports limit, market, and conditional (TP/SL) orders.\
> \
> \*\*Signature:\*\* Agent · \*\*Protobuf:\*\* \`MsgPlaceOrders\`\
> \
> \*\*Outer request fields:\*\*\
> \- \`nonce\`: \`uint64\` Unix timestamp in milliseconds. Use the current millisecond timestamp and do not reuse the same nonce for another signed request.\
> \- \`expiryAfter\`: optional \`uint64\` Unix timestamp in milliseconds. The request expires after this timestamp; \`null\` means no expiry and must be signed as \`0\`.\
> \
> \`\`\`protobuf\
> message MsgPlaceOrder {\
> &#x20; int64  cl\_ord\_id           = 1;\
> &#x20; int64  symbol\_code         = 2;\
> &#x20; string ord\_px              = 3;\
> &#x20; string ord\_qty             = 4;\
> &#x20; string trigger\_px          = 5;\
> &#x20; OrdType                   ord\_type           = 6;\
> &#x20; OrdSide                   ord\_side           = 7;\
> &#x20; OrdTIF                    time\_in\_force      = 8;\
> &#x20; ReduceOnlyOption          reduce\_only\_option = 9;\
> &#x20; int64  parent\_ord\_id      = 10;\
> &#x20; ConditionalOrdTriggerType tpsl\_trigger\_type  = 11;\
> &#x20; string slippage\_pct       = 12;\
> }\
> message MsgPlaceOrders {\
> &#x20; repeated MsgPlaceOrder orders = 1;\
> }\
> \`\`\`\
> \
> \*\*Enum Reference:\*\*\
> \| Enum | Values |\
> \|------|--------|\
> \| OrdType | LIMIT=1, MARKET=2 |\
> \| OrdSide | BUY=1, SELL=2, BUY\_CLOSE\_HEDGE=3, SELL\_CLOSE\_HEDGE=4 |\
> \| OrdTIF | GTC=1, IOC=2, FOK=3, POST\_ONLY=4 |\
> \| ReduceOnlyOption | REDUCE\_ONLY=1, TP\_FROM\_POSITION=2, SL\_FROM\_POSITION=3 |\
> \| ConditionalOrdTriggerType | LAST\_PRICE=1, MARK\_PRICE=2, INDEX\_PRICE=3 |\
> \
> \`NONE\` is the proto default value. \`MARKET\_LIQ\_SELLOFF\`, \`LIMIT\_LIQ\_SELLOFF\`, \`ADL\`, and \`LIQUIDATION\` are display-only \`OrdType\` values used by query or stream data. Do not send those values in order requests.\
> \
> \`slippagePct\` is a decimal ratio string for market orders. For example, \`"0.001"\` means 0.1%, \`"0.01"\` means 1%, and \`"0.05"\` means 5%. Check each product's \`maxSlippagePct\` from \`GET /info/public/product-meta\`.\
> \
> Field names differ by layer:\
> \
> \| Concept | Python SDK | Protobuf | REST action |\
> \|---------|------------|----------|-------------|\
> \| Symbol code | \`symbol\_code\` | \`symbol\_code\` | \`symbolCode\` |\
> \| Order price | \`px\` | \`ord\_px\` | \`ordPx\` |\
> \| Order quantity | \`qty\` | \`ord\_qty\` | \`ordQty\` |\
> \| Reduce-only option | \`reduce\_only\_option\` | \`reduce\_only\_option\` | \`reduceOnlyOption\` |\
> \| Trigger type | \`trigger\_type\` | \`tpsl\_trigger\_type\` | \`tpslTriggerType\` |<br>

````json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"servers":[{"url":"https://api.afx.xyz","description":"Mainnet"},{"url":"https://api-testnet.afx.xyz","description":"Testnet"}],"paths":{"/exchange/placeOrder":{"post":{"operationId":"placeOrder","summary":"Place Order","tags":["Orders"],"description":"Submit one or more orders. Supports limit, market, and conditional (TP/SL) orders.\n\n**Signature:** Agent · **Protobuf:** `MsgPlaceOrders`\n\n**Outer request fields:**\n- `nonce`: `uint64` Unix timestamp in milliseconds. Use the current millisecond timestamp and do not reuse the same nonce for another signed request.\n- `expiryAfter`: optional `uint64` Unix timestamp in milliseconds. The request expires after this timestamp; `null` means no expiry and must be signed as `0`.\n\n```protobuf\nmessage MsgPlaceOrder {\n  int64  cl_ord_id           = 1;\n  int64  symbol_code         = 2;\n  string ord_px              = 3;\n  string ord_qty             = 4;\n  string trigger_px          = 5;\n  OrdType                   ord_type           = 6;\n  OrdSide                   ord_side           = 7;\n  OrdTIF                    time_in_force      = 8;\n  ReduceOnlyOption          reduce_only_option = 9;\n  int64  parent_ord_id      = 10;\n  ConditionalOrdTriggerType tpsl_trigger_type  = 11;\n  string slippage_pct       = 12;\n}\nmessage MsgPlaceOrders {\n  repeated MsgPlaceOrder orders = 1;\n}\n```\n\n**Enum Reference:**\n| Enum | Values |\n|------|--------|\n| OrdType | LIMIT=1, MARKET=2 |\n| OrdSide | BUY=1, SELL=2, BUY_CLOSE_HEDGE=3, SELL_CLOSE_HEDGE=4 |\n| OrdTIF | GTC=1, IOC=2, FOK=3, POST_ONLY=4 |\n| ReduceOnlyOption | REDUCE_ONLY=1, TP_FROM_POSITION=2, SL_FROM_POSITION=3 |\n| ConditionalOrdTriggerType | LAST_PRICE=1, MARK_PRICE=2, INDEX_PRICE=3 |\n\n`NONE` is the proto default value. `MARKET_LIQ_SELLOFF`, `LIMIT_LIQ_SELLOFF`, `ADL`, and `LIQUIDATION` are display-only `OrdType` values used by query or stream data. Do not send those values in order requests.\n\n`slippagePct` is a decimal ratio string for market orders. For example, `\"0.001\"` means 0.1%, `\"0.01\"` means 1%, and `\"0.05\"` means 5%. Check each product's `maxSlippagePct` from `GET /info/public/product-meta`.\n\nField names differ by layer:\n\n| Concept | Python SDK | Protobuf | REST action |\n|---------|------------|----------|-------------|\n| Symbol code | `symbol_code` | `symbol_code` | `symbolCode` |\n| Order price | `px` | `ord_px` | `ordPx` |\n| Order quantity | `qty` | `ord_qty` | `ordQty` |\n| Reduce-only option | `reduce_only_option` | `reduce_only_option` | `reduceOnlyOption` |\n| Trigger type | `trigger_type` | `tpsl_trigger_type` | `tpslTriggerType` |\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaceOrderRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/ExchangeOk"}}}}},"components":{"schemas":{"PlaceOrderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","orders"],"properties":{"type":{"type":"string","enum":["placeOrder"]},"orders":{"type":"array","minItems":1,"items":{"type":"object","required":["symbolCode","ordPx","ordQty","ordType","ordSide","timeInForce"],"properties":{"symbolCode":{"type":"integer","format":"int64"},"ordPx":{"type":"string","description":"Limit `> 0`, Market `\"0\"`"},"ordQty":{"type":"string"},"ordType":{"type":"string","enum":["LIMIT","MARKET"],"description":"NONE and display-only values MARKET_LIQ_SELLOFF, LIMIT_LIQ_SELLOFF, ADL, and LIQUIDATION must not be sent in requests."},"ordSide":{"type":"string","enum":["BUY","SELL","BUY_CLOSE_HEDGE","SELL_CLOSE_HEDGE"]},"timeInForce":{"type":"string","enum":["GTC","IOC","FOK","POST_ONLY"]},"clOrdId":{"type":"integer","format":"int64"},"parentOrdId":{"type":"integer","format":"int64"},"reduceOnlyOption":{"type":"string","enum":["REDUCE_ONLY","TP_FROM_POSITION","SL_FROM_POSITION"]},"triggerPx":{"type":"string"},"tpslTriggerType":{"type":"string","enum":["LAST_PRICE","MARK_PRICE","INDEX_PRICE"]},"slippagePct":{"type":"string"}}}}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Unix timestamp in milliseconds after which the request expires. null = no expiry; use 0 in the signature payload when this field is null."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}},"ExchangeResponse":{"type":"object","properties":{"code":{"type":"integer","description":"`0` = success. See Error Codes section for non-zero values."},"message":{"type":"string"},"data":{"type":"object","nullable":true,"properties":{"txHash":{"type":"string"},"txCode":{"type":"integer"},"txMsg":{"type":"string"}}}}}},"responses":{"ExchangeOk":{"description":"Transaction submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeResponse"}}}}}}}
````

## Replace Order

> Replace an existing order by \`ordId\` or \`clOrdId\`.\
> \
> \*\*Signature:\*\* Agent · \*\*Protobuf:\*\* \`MsgReplaceOrder\`\
> \
> \`\`\`protobuf\
> message MsgReplaceOrder {\
> &#x20; int64  cl\_ord\_id           = 1;\
> &#x20; int64  symbol\_code         = 2;\
> &#x20; string ord\_px              = 3;\
> &#x20; string ord\_qty             = 4;\
> &#x20; string trigger\_px          = 5;\
> &#x20; OrdType                   ord\_type           = 6;\
> &#x20; OrdSide                   ord\_side           = 7;\
> &#x20; OrdTIF                    time\_in\_force      = 8;\
> &#x20; ReduceOnlyOption          reduce\_only\_option = 9;\
> &#x20; int64  parent\_ord\_id      = 10;\
> &#x20; ConditionalOrdTriggerType tpsl\_trigger\_type  = 11;\
> &#x20; string slippage\_pct       = 12;\
> &#x20; int64  ord\_id             = 13;\
> }\
> \`\`\`\
> \
> At least one of \`ordId\` or \`clOrdId\` must identify the existing order.<br>

````json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"servers":[{"url":"https://api.afx.xyz","description":"Mainnet"},{"url":"https://api-testnet.afx.xyz","description":"Testnet"}],"paths":{"/exchange/replaceOrder":{"post":{"operationId":"replaceOrder","summary":"Replace Order","tags":["Orders"],"description":"Replace an existing order by `ordId` or `clOrdId`.\n\n**Signature:** Agent · **Protobuf:** `MsgReplaceOrder`\n\n```protobuf\nmessage MsgReplaceOrder {\n  int64  cl_ord_id           = 1;\n  int64  symbol_code         = 2;\n  string ord_px              = 3;\n  string ord_qty             = 4;\n  string trigger_px          = 5;\n  OrdType                   ord_type           = 6;\n  OrdSide                   ord_side           = 7;\n  OrdTIF                    time_in_force      = 8;\n  ReduceOnlyOption          reduce_only_option = 9;\n  int64  parent_ord_id      = 10;\n  ConditionalOrdTriggerType tpsl_trigger_type  = 11;\n  string slippage_pct       = 12;\n  int64  ord_id             = 13;\n}\n```\n\nAt least one of `ordId` or `clOrdId` must identify the existing order.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplaceOrderRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/ExchangeOk"}}}}},"components":{"schemas":{"ReplaceOrderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","symbolCode","ordPx","ordQty","ordType","ordSide","timeInForce"],"properties":{"type":{"type":"string","enum":["replaceOrder"]},"symbolCode":{"type":"integer","format":"int64"},"ordPx":{"type":"string","description":"Limit `> 0`, Market `\"0\"`"},"ordQty":{"type":"string"},"ordType":{"type":"string","enum":["LIMIT","MARKET"],"description":"NONE and display-only values MARKET_LIQ_SELLOFF, LIMIT_LIQ_SELLOFF, ADL, and LIQUIDATION must not be sent in requests."},"ordSide":{"type":"string","enum":["BUY","SELL","BUY_CLOSE_HEDGE","SELL_CLOSE_HEDGE"]},"timeInForce":{"type":"string","enum":["GTC","IOC","FOK","POST_ONLY"]},"clOrdId":{"type":"integer","format":"int64","description":"Client order ID. clOrdId or ordId is required."},"ordId":{"type":"integer","format":"int64","description":"System order ID. clOrdId or ordId is required."},"parentOrdId":{"type":"integer","format":"int64"},"reduceOnly":{"type":"string","enum":["REDUCE_ONLY","TP_FROM_POSITION","SL_FROM_POSITION"]},"triggerPx":{"type":"string"},"tpslTriggerType":{"type":"string","enum":["LAST_PRICE","MARK_PRICE","INDEX_PRICE"]},"slippagePct":{"type":"string"}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Unix timestamp in milliseconds after which the request expires. null = no expiry; use 0 in the signature payload when this field is null."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}},"ExchangeResponse":{"type":"object","properties":{"code":{"type":"integer","description":"`0` = success. See Error Codes section for non-zero values."},"message":{"type":"string"},"data":{"type":"object","nullable":true,"properties":{"txHash":{"type":"string"},"txCode":{"type":"integer"},"txMsg":{"type":"string"}}}}}},"responses":{"ExchangeOk":{"description":"Transaction submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeResponse"}}}}}}}
````

## Place Bracket Order

> Place a main order with one or two attached TP/SL child orders.\
> \
> \*\*Signature:\*\* Agent · \*\*Protobuf:\*\* \`MsgPlaceBracketOrder\`\
> \
> \`\`\`protobuf\
> message MsgPlaceBracketOrder {\
> &#x20; MsgPlaceOrder main\_order        = 1;\
> &#x20; MsgPlaceOrder take\_profit\_order = 2;\
> &#x20; MsgPlaceOrder stop\_loss\_order   = 3;\
> }\
> \`\`\`\
> \
> The request must contain 2 or 3 orders. The first order is the main order. Child orders must use \`reduceOnly\` as \`TP\_FROM\_POSITION\` or \`SL\_FROM\_POSITION\`.<br>

````json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"servers":[{"url":"https://api.afx.xyz","description":"Mainnet"},{"url":"https://api-testnet.afx.xyz","description":"Testnet"}],"paths":{"/exchange/placeBracketOrder":{"post":{"operationId":"placeBracketOrder","summary":"Place Bracket Order","tags":["Orders"],"description":"Place a main order with one or two attached TP/SL child orders.\n\n**Signature:** Agent · **Protobuf:** `MsgPlaceBracketOrder`\n\n```protobuf\nmessage MsgPlaceBracketOrder {\n  MsgPlaceOrder main_order        = 1;\n  MsgPlaceOrder take_profit_order = 2;\n  MsgPlaceOrder stop_loss_order   = 3;\n}\n```\n\nThe request must contain 2 or 3 orders. The first order is the main order. Child orders must use `reduceOnly` as `TP_FROM_POSITION` or `SL_FROM_POSITION`.\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaceBracketOrderRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/ExchangeOk"}}}}},"components":{"schemas":{"PlaceBracketOrderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","orders"],"properties":{"type":{"type":"string","enum":["placeBracketOrder"]},"orders":{"type":"array","minItems":2,"maxItems":3,"items":{"type":"object","required":["symbolCode","ordPx","ordQty","ordType","ordSide","timeInForce"],"properties":{"symbolCode":{"type":"integer","format":"int64"},"ordPx":{"type":"string","description":"Limit `> 0`, Market `\"0\"`"},"ordQty":{"type":"string"},"ordType":{"type":"string","enum":["LIMIT","MARKET"],"description":"NONE and display-only values MARKET_LIQ_SELLOFF, LIMIT_LIQ_SELLOFF, ADL, and LIQUIDATION must not be sent in requests."},"ordSide":{"type":"string","enum":["BUY","SELL","BUY_CLOSE_HEDGE","SELL_CLOSE_HEDGE"]},"timeInForce":{"type":"string","enum":["GTC","IOC","FOK","POST_ONLY"]},"clOrdId":{"type":"integer","format":"int64"},"parentOrdId":{"type":"integer","format":"int64"},"reduceOnly":{"type":"string","enum":["REDUCE_ONLY","TP_FROM_POSITION","SL_FROM_POSITION"]},"triggerPx":{"type":"string"},"tpslTriggerType":{"type":"string","enum":["LAST_PRICE","MARK_PRICE","INDEX_PRICE"]},"slippagePct":{"type":"string"}}}}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"expiryAfter":{"type":"integer","format":"int64","nullable":true,"description":"Unix timestamp in milliseconds after which the request expires. null = no expiry; use 0 in the signature payload when this field is null."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}},"ExchangeResponse":{"type":"object","properties":{"code":{"type":"integer","description":"`0` = success. See Error Codes section for non-zero values."},"message":{"type":"string"},"data":{"type":"object","nullable":true,"properties":{"txHash":{"type":"string"},"txCode":{"type":"integer"},"txMsg":{"type":"string"}}}}}},"responses":{"ExchangeOk":{"description":"Transaction submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeResponse"}}}}}}}
````

## Cancel Order

> Cancel one or more orders by orderId or clOrdId.\
> \
> \*\*Signature:\*\* Agent · \*\*Protobuf:\*\* \`MsgCancelOrders\`\
> \
> \*\*Outer request fields:\*\*\
> \- \`nonce\`: \`uint64\` Unix timestamp in milliseconds. Use the current millisecond timestamp and do not reuse the same nonce for another signed request.\
> \
> \`\`\`protobuf\
> message MsgCancelOrder {\
> &#x20; int64 symbol\_code = 1;\
> &#x20; int64 cl\_ord\_id   = 2;\
> &#x20; int64 ord\_id      = 3;\
> }\
> message MsgCancelOrders {\
> &#x20; repeated MsgCancelOrder orders = 1;\
> }\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"servers":[{"url":"https://api.afx.xyz","description":"Mainnet"},{"url":"https://api-testnet.afx.xyz","description":"Testnet"}],"paths":{"/exchange/cancelOrder":{"post":{"operationId":"cancelOrder","summary":"Cancel Order","tags":["Orders"],"description":"Cancel one or more orders by orderId or clOrdId.\n\n**Signature:** Agent · **Protobuf:** `MsgCancelOrders`\n\n**Outer request fields:**\n- `nonce`: `uint64` Unix timestamp in milliseconds. Use the current millisecond timestamp and do not reuse the same nonce for another signed request.\n\n```protobuf\nmessage MsgCancelOrder {\n  int64 symbol_code = 1;\n  int64 cl_ord_id   = 2;\n  int64 ord_id      = 3;\n}\nmessage MsgCancelOrders {\n  repeated MsgCancelOrder orders = 1;\n}\n```\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelOrderRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/ExchangeOk"}}}}},"components":{"schemas":{"CancelOrderRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","cancels"],"properties":{"type":{"type":"string","enum":["cancelOrder"]},"cancels":{"type":"array","minItems":1,"items":{"type":"object","required":["symbolCode"],"properties":{"symbolCode":{"type":"string"},"clOrdId":{"type":"string","description":"Client order ID (clOrdId or ordId required)"},"ordId":{"type":"string","description":"System order ID (clOrdId or ordId required)"}}}}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}},"ExchangeResponse":{"type":"object","properties":{"code":{"type":"integer","description":"`0` = success. See Error Codes section for non-zero values."},"message":{"type":"string"},"data":{"type":"object","nullable":true,"properties":{"txHash":{"type":"string"},"txCode":{"type":"integer"},"txMsg":{"type":"string"}}}}}},"responses":{"ExchangeOk":{"description":"Transaction submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeResponse"}}}}}}}
````

## Cancel All Orders

> Cancel all orders for a symbol.\
> \
> \*\*Signature:\*\* Agent · \*\*Protobuf:\*\* \`MsgCancelAll\`\
> \
> \*\*Outer request fields:\*\*\
> \- \`nonce\`: \`uint64\` Unix timestamp in milliseconds. Use the current millisecond timestamp and do not reuse the same nonce for another signed request.\
> \
> \`\`\`protobuf\
> message MsgCancelAll {\
> &#x20; int64 symbol\_code          = 1;\
> &#x20; bool  is\_conditional\_order = 2;\
> }\
> \`\`\`<br>

````json
{"openapi":"3.0.3","info":{"title":"AFX DEX Exchange API","version":"1.0.0"},"servers":[{"url":"https://api.afx.xyz","description":"Mainnet"},{"url":"https://api-testnet.afx.xyz","description":"Testnet"}],"paths":{"/exchange/cancelAll":{"post":{"operationId":"cancelAll","summary":"Cancel All Orders","tags":["Orders"],"description":"Cancel all orders for a symbol.\n\n**Signature:** Agent · **Protobuf:** `MsgCancelAll`\n\n**Outer request fields:**\n- `nonce`: `uint64` Unix timestamp in milliseconds. Use the current millisecond timestamp and do not reuse the same nonce for another signed request.\n\n```protobuf\nmessage MsgCancelAll {\n  int64 symbol_code          = 1;\n  bool  is_conditional_order = 2;\n}\n```\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelAllRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/ExchangeOk"}}}}},"components":{"schemas":{"CancelAllRequest":{"type":"object","required":["action","signature","nonce"],"properties":{"action":{"type":"object","required":["type","symbolCode"],"properties":{"type":{"type":"string","enum":["cancelAll"]},"symbolCode":{"type":"integer","format":"int64"},"conditionalOrder":{"type":"boolean","default":false}}},"signature":{"$ref":"#/components/schemas/Signature"},"nonce":{"type":"integer","format":"int64","description":"Request nonce as a Unix timestamp in milliseconds. Recommended: current time in milliseconds. Must be unique; do not reuse the same nonce for another signed request."},"vaultAddress":{"type":"string","nullable":true}}},"Signature":{"type":"object","required":["r","s","v"],"properties":{"r":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"s":{"type":"string","description":"32-byte hex, zero-padded to 64 chars"},"v":{"type":"integer","description":"27 or 28"}}},"ExchangeResponse":{"type":"object","properties":{"code":{"type":"integer","description":"`0` = success. See Error Codes section for non-zero values."},"message":{"type":"string"},"data":{"type":"object","nullable":true,"properties":{"txHash":{"type":"string"},"txCode":{"type":"integer"},"txMsg":{"type":"string"}}}}}},"responses":{"ExchangeOk":{"description":"Transaction submitted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExchangeResponse"}}}}}}}
````


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.afx.xyz/api-reference/exchange/orders.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
