Cancel orders
Endpoint
POST /exchange
Selector: action.type: "cancel"
Purpose
Requests cancellation of one or more orders identified by asset and order ID.
Authorization
Owner or permitted trading agent. The SDK signs the action; see raw signing for custom clients.
Request fields
| Field | Type | Required | Meaning |
|---|---|---|---|
action | Object | Yes | The supported action described below. |
nonce | Unsigned integer | Yes | Trading nonce; native-style millisecond timestamp convention. |
signature | Object | Yes | Wallet signature containing r, s and recovery byte v (27 or 28). |
expiresAfter | Unsigned integer or null | No | Request expiry in Unix milliseconds. |
vaultAddress | Null | No | Omit or use null; customer subaccount/vault routing is outside this profile. |
The action object contains:
| Field | Type | Required | Meaning |
|---|---|---|---|
action.type | String | Yes | "cancel". |
action.cancels | Array | Yes | Between 1 and 32 cancellation objects. |
action.cancels[].a | Unsigned integer | Yes | Supported perpetual asset index. |
action.cancels[].o | Unsigned integer | Yes | Nonzero order ID returned by the account interface. |
See the shared trading envelope for the common signing and routing fields.
Request example
The proof and identifiers are illustrative.
{
"action": {
"type": "cancel",
"cancels": [
{
"a": 0,
"o": 12345
}
]
},
"nonce": 1796250000000,
"signature": {
"r": "0x1111111111111111111111111111111111111111111111111111111111111111",
"s": "0x2222222222222222222222222222222222222222222222222222222222222222",
"v": 27
}
}Response fields
| Field | Meaning |
|---|---|
status | "ok" for an admitted request or "err" for a request-level rejection. |
response | Response object on success; a reason string for a request-level rejection. |
response.type | "cancel" for the cancellation response. |
response.data.statuses | One result per cancellation, in request order: "success" or an error object. |
A batch can contain both successful and failed cancellations.
Response example
{
"status": "ok",
"response": {
"type": "cancel",
"data": {
"statuses": [
"success"
]
}
}
}Constraints
1–32 cancellations per batch. The asset must match the order. Unknown fields are rejected.
Cancellation can race with fills. If the result is uncertain, reconcile orders and fills before releasing reservations.