For AI agents: the documentation index is at /llms.txt, and this page is available as Markdown at /api/gateway/prepare-cancel-order.md.
Cancel a limit or TP/SL order (CeFi or DeFi)
Venue-polymorphic cancel. The payloads field is the signal:
- CeFi orders are canceled immediately and return
202 Acceptedwith nopayloads. PollGET /orders/{id}/statusfor the terminal state. - DeFi (Hyperliquid) resting orders return
200 OKwith unsignedpayloads. Sign each locally and post the signatures toPOST /orders/{id}/cancel/execute.
Only cancellable orders (CeFi pending/active limit orders, DeFi
active limit or TP/SL trigger orders) can be canceled. An order that
is no longer open (complete, canceled or failed) returns 422
with code order_not_open; refetch it for its final status. Other
orders return 400. An order with strategy_managed set is cancelled by
its strategy, not here, and returns 422.
bearerAuthAuthorizationBearer <JWT>An access token from POST /v1/auth/api-key/token. An organization token lasts one hour and has no refresh token; a personal token can be refreshed.
id*stringOrder ID
TM-On-Behalf-Of?stringAct as one of your organization's users. The value is the user_id returned when the user was created; the request then reads and writes that user's account. Requires an organization token and a user your organization created: 400 for a personal token, a repeated header or a non-UUID, 403 for a user outside your organization. Not accepted on organization-scoped routes.
uuidResting DeFi order; unsigned cancel payloads to sign and execute
application/json- response
Response from the cancel endpoint. A resting DeFi order returns unsigned payloads the client must sign and submit to the cancel-execute endpoint. A CeFi order is canceled immediately and returns 202 with no payloads.
payloads?array<>Unsigned cancel payloads the client signs and returns via the cancel-execute endpoint. Present for resting DeFi orders, absent for CeFi orders.
curl -X POST 'https://api.truemarkets.co/v1/gateway/orders/string/cancel' \ -H 'TM-On-Behalf-Of: 3f6d2c0e-8a41-4c2b-9f1e-2b7d5c0a9e11'{ "payloads": [ { "digest": "string", "payload": "string" } ]}Cancel all open orders on a venue POST
Cancels all of your open orders on the given venue and returns how many were canceled. Cancellation is asynchronous — confirm final per-order state via GET /orders. Only cefi is supported today; defi returns 501 Not Implemented.
Execute a resting DeFi order cancellation POST
Submits the client's signatures over the payloads returned by POST /orders/{id}/cancel to cancel a resting DeFi limit or TP/SL order. The order moves to canceled once the venue confirms, keeping any quantity that filled before the cancel in executed_qty/executed_vwap. An order that filled before the cancel landed moves to complete. An order that is no longer open, including one the venue reports closed before it can say how, returns 422 with code order_not_open.