Skip to main content
Mainnet currently supports Spot DEX only. Perpetuals, Oracle, Margin Trading, Lending, and Vaults are Testnet-Only. Use Testnet endpoints and assets for those products.
Canceling an ordinary Spot order releases its unused token escrow, reflected as lower used and higher free on Balances after processing. Perpetual cancellation releases order-margin reservations. Margin Trading releases Lending collateral reservations and can apply its configured cancel repayment; it does not necessarily return wallet funds or clear debt. Cancellation is a signed transaction, like placement, using /ault.clob.v1.MsgCancelOrders. The message is plural, so one transaction can cancel several orders at once. See Place or Modify Order for how orders reach the chain.

Identifying the Order

Cancel by the chain order id, or by the client order id if the order carried one. Both are available from Orders as id and clientOrderId, and from orderUpdates on Subscriptions as oidHex and cloid. To list what is currently resting for one account before a bulk cancel:
Follow every pagination page. This Spot read is not an inventory of all native Perpetual, conditional (Testnet-Only), or TWAP state. Use native order queries and TWAP queries for those scopes.

Batch Results

MsgCancelOrders takes explicit order IDs or client IDs and returns succeeded and failed lists. A missing order can be reported as a failed item while other IDs succeed. Other validation errors can reject the transaction, so inspect its committed code before interpreting the lists. A successful transaction is not proof that every requested ID was canceled. Cancellation and modification reject an order created in the current block. A quote just accepted may need to reach the next block before it can be canceled. Reconcile the failure and current state before retrying. Use Trading Operations for a shutdown across several accounts and order families.

Cancelling a TWAP Schedule

Cancel the parent TWAP ID, not merely a slice ID, through the native /ault.clob.v1.MsgCancelOrders transaction. Python SDK 0.9 exposes the same route:
twap_id is the parent’s byte ID returned at placement. A committed parent cancellation removes the parent and its schedule, stopping new slices. It does not cancel or reverse an already-created slice or its fills; those follow their own order lifecycle. Slice IDs are not valid targets for user cancellation or modification and can be reported as not found. Use the parent ID to stop the schedule, then reconcile the slices already created. Confirm the parent cancellation result and TwapOrderClosed event, then check the native TWAP queries and any already-created child orders. A missing parent alone can also mean completion or expiry, so reconcile the close reason and fills.

Racing a Fill

A cancellation is a transaction, ordered against every other transaction by the chain.
  • If a match is processed first, the fill stands. An execution cannot be cancelled.
  • A partially filled order cancels only its remaining quantity.
  • An order that has already fully filled cannot be found to cancel.
An order-not-found error does not tell you why: the order may have filled, expired, been replaced, or already been canceled, or the query may address the wrong account. Reconcile it before retrying. Check User Fills before assuming the exposure is gone.

Cancels You Did Not Send

An order can leave the book without a cancellation from the account: Expiry arrives on the user channel as a nonUserCancel entry, which is currently emitted only for expired orders. See Subscriptions.
Halting a market does not cancel anything. A halt rejects new orders, while resting orders keep their escrow until they fill, expire, or are cancelled by the account. Do not count on a halt to flatten exposure.

Confirming

Check the released escrow on Balances and the terminal state on Orders. A cancelled order reports status as canceled, the same value an expired order reports, so read info.chain_status to tell the two apart.