cancel
Endpoint
WebSocket /ws
Selector: request.payload.action.type: "cancel"
Purpose
Cancel orders by asset and order ID.
Authorization
Owner or permitted trading agent. The SDK signs the payload. HTTP and WebSocket share trading nonces.
Request fields
| Field | Type | Required | Meaning |
|---|---|---|---|
method | String | Yes | "post". |
id | Integer | Yes | 0–9,007,199,254,740,991; unique among outstanding requests. |
request.type | String | Yes | "action". |
request.payload.action | Object | Yes | Action fields below. |
request.payload.nonce | Unsigned integer | Yes | Trading nonce in Unix milliseconds. |
request.payload.signature | Object | Yes | r, s, v; recovery byte 27 or 28. |
request.payload.expiresAfter | Unsigned integer or null | No | Expiry in Unix milliseconds. |
request.payload.vaultAddress | Null | No | Omit or use null. |
Action fields:
| Field | Type | Required | Meaning |
|---|---|---|---|
request.payload.action.type | String | Yes | "cancel". |
request.payload.action.cancels | Array | Yes | Between 1 and 32 cancellation objects. |
request.payload.action.cancels[].a | Unsigned integer | Yes | Supported perpetual asset index. |
request.payload.action.cancels[].o | Unsigned integer | Yes | Nonzero order ID returned by the account interface. |
Shared envelope: message format.
Request example
Example values. Use a fresh nonce and signature.
{
"method": "post",
"id": 257,
"request": {
"type": "action",
"payload": {
"action": {
"type": "cancel",
"cancels": [
{
"a": 0,
"o": 12345
}
]
},
"nonce": 1796250000000,
"signature": {
"r": "0x1111111111111111111111111111111111111111111111111111111111111111",
"s": "0x2222222222222222222222222222222222222222222222222222222222222222",
"v": 27
}
}
}
}Response fields
| Field | Type | Meaning |
|---|---|---|
channel | String | "post". |
data.id | Integer | Request ID. |
data.response.type | String | "action", or "error" for request errors. |
data.response.payload | Object or string | Action result below, or an error string. |
Action result fields:
| Field | Meaning |
|---|---|
data.response.payload.status | "ok" for an admitted request or "err" for a request-level rejection. |
data.response.payload.response | Response object on success; a reason string for a request-level rejection. |
data.response.payload.response.type | "cancel" for the cancellation response. |
data.response.payload.response.data.statuses | One result per cancellation, in request order: "success" or an error object. |
Inspect the action status and each child result.
Response example
{
"channel": "post",
"data": {
"id": 257,
"response": {
"type": "action",
"payload": {
"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.
Match responses by data.id. Transport rules.