> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chainstack.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel order by cloid | Hyperliquid exchange

> Cancels one or multiple open orders by client order ID (cloid) on the Hyperliquid exchange. Chainstack Hyperliquid exchange reference.

<Info>
  You can only use this endpoint on the official Hyperliquid public API. It is not available through Chainstack, as the open-source node implementation does not support it yet. See [Hyperliquid methods](/docs/hyperliquid-methods) for the full availability breakdown.
</Info>

<Note>
  This endpoint requires signature authentication. See our comprehensive [Authentication via Signatures guide](/docs/hyperliquid-authentication-guide) for implementation details.
</Note>

Cancels one or multiple open orders by client order ID (cloid) on the Hyperliquid exchange. This is useful when you want to cancel orders using your own tracking IDs rather than the exchange-generated order IDs.

## Parameters

### Required parameters

* `action` (object, required) — The cancel action object containing:
  * `type` (string) — Must be `"cancelByCloid"`
  * `cancels` (array) — Array of cancel objects with:
    * `asset` (number) — Asset index
    * `cloid` (string) — Client order ID (128-bit hex string, e.g., `0x1234567890abcdef1234567890abcdef`)

* `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` — `"cancelByCloid"`
  * `data.statuses` — Array of status results for each cancellation attempt

## Example request

<CodeGroup>
  ```shell cURL theme={"system"}
  curl -X POST https://api.hyperliquid.xyz/exchange \
    -H "Content-Type: application/json" \
    -d '{
      "action": {
        "type": "cancelByCloid",
        "cancels": [{
          "asset": 0,
          "cloid": "0x1234567890abcdef1234567890abcdef"
        }]
      },
      "nonce": 1234567890123,
      "signature": {...}
    }'
  ```

  ```python hyperliquid-python-sdk theme={"system"}
  from hyperliquid.exchange import Exchange
  from hyperliquid.utils import constants
  from hyperliquid.utils.types import Cloid
  import eth_account

  # Initialize with your private key
  account = eth_account.Account.from_key("0x...")
  exchange = Exchange(account, constants.MAINNET_API_URL)

  # Cancel an order by client order ID
  cancel_result = exchange.cancel_by_cloid(
      name="BTC",
      cloid=Cloid.from_str("0x1234567890abcdef1234567890abcdef"),
  )

  print(cancel_result)
  ```

  ```typescript @nktkas/hyperliquid theme={"system"}
  import { ExchangeClient, HttpTransport } from "@nktkas/hyperliquid";
  import { privateKeyToAccount } from "viem/accounts";

  // Set up the client with a wallet and the public transport
  const wallet = privateKeyToAccount("0x...");
  const transport = new HttpTransport();
  const exchange = new ExchangeClient({ transport, wallet });

  // Cancel an order by client order ID
  const result = await exchange.cancelByCloid({
    cancels: [
      { asset: 0, cloid: "0x1234567890abcdef1234567890abcdef" },
    ],
  });

  console.log(result);
  ```
</CodeGroup>

## Client Order ID (cloid)

The client order ID is a 128-bit hexadecimal string that you provide when placing an order. It allows you to:

* Track orders using your own identification system
* Cancel orders without needing to store exchange-generated order IDs
* Implement idempotent order placement strategies

Example cloid format: `0x1234567890abcdef1234567890abcdef`

## Use cases

* **Custom order tracking** — Cancel orders using your internal order management system IDs
* **Failover systems** — Cancel orders without needing to query order IDs first
* **Multi-system integration** — Use consistent order IDs across different systems
* **Idempotent operations** — Safely retry cancellations using deterministic IDs

<Note>
  Client order IDs must be unique per user. Attempting to place an order with a duplicate cloid will be rejected.
</Note>

<Warning>
  Make sure to store the cloid when placing orders if you plan to use this cancellation method. The cloid must match exactly what was provided during order placement.
</Warning>


## OpenAPI

````yaml openapi/hyperliquid_node_api/hypercore_exchange/exchange_cancel_by_cloid.json post /exchange
openapi: 3.0.0
info:
  title: Hyperliquid Exchange API
  version: 1.0.0
  description: >-
    API for trading operations on Hyperliquid exchange requiring authentication.
    ⚠️ WARNING: These endpoints require EIP-712 signatures for authentication.
    The example values provided will NOT work without proper cryptographic
    signing. You must implement EIP-712 signing to use these endpoints
    successfully.
servers:
  - url: https://api.hyperliquid.xyz
security: []
paths:
  /exchange:
    post:
      tags:
        - hyperliquid exchange
      summary: Cancel order by cloid
      operationId: cancelOrderByCloid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                action:
                  type: object
                  properties:
                    type:
                      type: string
                      default: cancelByCloid
                      enum:
                        - cancelByCloid
                      description: Action type for canceling orders by client order ID
                    cancels:
                      type: array
                      description: Array of cancel objects
                      items:
                        type: object
                        properties:
                          asset:
                            type: integer
                            description: Asset index
                          cloid:
                            type: string
                            description: Client order ID (128-bit hex string)
                        required:
                          - asset
                          - cloid
                  required:
                    - type
                    - cancels
                nonce:
                  type: integer
                  description: Current timestamp in milliseconds
                signature:
                  type: object
                  description: EIP-712 signature of the action with r, s, v components
                  properties:
                    r:
                      type: string
                      description: ECDSA signature r component (hex string)
                      example: >-
                        0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
                    s:
                      type: string
                      description: ECDSA signature s component (hex string)
                      example: >-
                        0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321
                    v:
                      type: integer
                      description: ECDSA recovery id (27 or 28)
                      example: 27
                  required:
                    - r
                    - s
                    - v
                vaultAddress:
                  type: string
                  description: >-
                    Address when trading on behalf of a vault or subaccount
                    (optional)
                  nullable: true
                expiresAfter:
                  type: integer
                  description: >-
                    Timestamp in milliseconds after which the request is
                    rejected (optional)
              required:
                - action
                - nonce
                - signature
            example:
              action:
                type: cancelByCloid
                cancels:
                  - asset: 0
                    cloid: '0x1234567890abcdef1234567890abcdef'
              nonce: 1705234567890
              signature:
                r: >-
                  0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
                s: >-
                  0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321
                v: 27
              vaultAddress: null
      responses:
        '200':
          description: Cancellation result
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: Request status
                  response:
                    type: object
                    properties:
                      type:
                        type: string
                      data:
                        type: object
                        properties:
                          statuses:
                            type: array
                            description: Array of status results

````