Skip to content
LogoLogo

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

FieldTypeRequiredMeaning
actionObjectYesThe supported action described below.
nonceUnsigned integerYesTrading nonce; native-style millisecond timestamp convention.
signatureObjectYesWallet signature containing r, s and recovery byte v (27 or 28).
expiresAfterUnsigned integer or nullNoRequest expiry in Unix milliseconds.
vaultAddressNullNoOmit or use null; customer subaccount/vault routing is outside this profile.

The action object contains:

FieldTypeRequiredMeaning
action.typeStringYes"cancel".
action.cancelsArrayYesBetween 1 and 32 cancellation objects.
action.cancels[].aUnsigned integerYesSupported perpetual asset index.
action.cancels[].oUnsigned integerYesNonzero 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

FieldMeaning
status"ok" for an admitted request or "err" for a request-level rejection.
responseResponse object on success; a reason string for a request-level rejection.
response.type"cancel" for the cancellation response.
response.data.statusesOne 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.