POST
/
exchange
Cancel order
curl --request POST \
  --url https://api.hyperliquid.xyz/exchange \
  --header 'Content-Type: application/json' \
  --data '{
  "action": {
    "type": "cancel",
    "cancels": [
      {
        "a": 0,
        "o": 123456789
      }
    ]
  },
  "nonce": 1705234567890,
  "signature": {
    "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321",
    "v": 27
  },
  "vaultAddress": null
}'
{
  "status": "ok",
  "response": {
    "type": "cancel",
    "data": {
      "statuses": [
        "success"
      ]
    }
  }
}
This endpoint requires signature authentication. See our comprehensive Authentication via Signatures guide for implementation details.
Cancels one or multiple open orders by order ID (oid) on the Hyperliquid exchange.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

Required parameters

  • action (object, required) — The cancel action object containing:
    • type (string) — Must be "cancel"
    • cancels (array) — Array of cancel objects with:
      • a (number) — Asset index
      • o (number) — Order ID to cancel
  • nonce (number, required) — Current timestamp in milliseconds (must be recent)
  • signature (object, required) — EIP-712 signature of the action

Optional parameters

  • vaultAddress (string, optional) — Address when trading on behalf of a vault or subaccount
  • expiresAfter (number, optional) — Timestamp in milliseconds after which the request is rejected

Returns

Returns an object with cancellation status:
  • status"ok" if request processed
  • response — Contains cancellation details:
    • type"cancel"
    • data.statuses — Array of status results:
      • "success" — Order successfully canceled
      • error — Object with error message if cancellation failed

Example request

curl -X POST https://api.hyperliquid.xyz/exchange \
  -H "Content-Type: application/json" \
  -d '{
    "action": {
      "type": "cancel",
      "cancels": [{
        "a": 0,
        "o": 77738308
      }]
    },
    "nonce": 1234567890123,
    "signature": {...}
  }'

Response examples

Successful cancellation

{
  "status": "ok",
  "response": {
    "type": "cancel",
    "data": {
      "statuses": [
        "success"
      ]
    }
  }
}

Failed cancellation

{
  "status": "ok",
  "response": {
    "type": "cancel",
    "data": {
      "statuses": [{
        "error": "Order was never placed, already canceled, or filled."
      }]
    }
  }
}

Multiple orders mixed results

{
  "status": "ok",
  "response": {
    "type": "cancel",
    "data": {
      "statuses": [
        "success",
        {
          "error": "Order was never placed, already canceled, or filled."
        }
      ]
    }
  }
}

Use cases

  • Risk management — Quickly cancel orders when market conditions change
  • Order management — Clean up open orders that are no longer needed
  • Algorithmic trading — Programmatically manage order lifecycle
  • Portfolio rebalancing — Cancel orders before placing new ones
You can cancel multiple orders in a single request by including multiple objects in the cancels array. Each cancellation is processed independently.
Attempting to cancel an order that doesn’t exist, was already canceled, or was filled will return an error but won’t affect other cancellations in the same request.

Body

application/json

Response

200 - application/json

Cancellation result

The response is of type object.