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

# cancelByCloid: Cancel Orders by Client Order ID

> Cancel resting orders using the client order IDs you assigned at placement. Useful when you track orders by your own IDs without storing exchange oids.

The `cancelByCloid` action lets you cancel orders using the client order ID (`c` field) you assigned when placing each order. This is useful when your system manages its own order identifiers and you want to avoid storing the exchange-assigned `oid` alongside them. You can include multiple cancels in a single signed request.

## Endpoint

```
POST https://dev.upsidemax.xyz/exchange
Content-Type: application/json
```

## Request Body

```json theme={"system"}
{
  "action": {
    "type": "cancelByCloid",
    "cancels": [
      { "a": 1, "cloid": "1778763737044" }
    ]
  },
  "signature": { "r": "0x...", "s": "0x...", "v": 28 },
  "nonce": 1778763737200
}
```

## Action Fields

<ParamField body="type" type="string" required>
  Fixed value: `"cancelByCloid"`.
</ParamField>

<ParamField body="cancels" type="array" required>
  Array of cancel-by-cloid objects. Each entry identifies the contract and the client order ID of the order to cancel.
</ParamField>

## Cancel Object Fields

<ParamField body="a" type="int32" required>
  **asset** — The integer contract ID for the order you want to cancel. Must match the contract the order was placed on.
</ParamField>

<ParamField body="cloid" type="string" required>
  **clientOrderId** — The client order ID you set in the `c` field when placing the order (an int64 decimal string, e.g. `"1778763737044"`). This value must match exactly.
</ParamField>

## Responses

<Tabs>
  <Tab title="Success">
    The order was found by its client order ID and removed from the book.

    ```json theme={"system"}
    {
      "status": "ok",
      "response": {
        "type": "cancelByCloid",
        "data": { "statuses": ["success"] }
      }
    }
    ```
  </Tab>

  <Tab title="Not Found">
    No active order matches the provided `cloid` for the given contract.

    ```json theme={"system"}
    {
      "status": "ok",
      "response": {
        "type": "cancelByCloid",
        "data": { "statuses": [{ "error": "clOrdId not found" }] }
      }
    }
    ```
  </Tab>
</Tabs>

### Response Fields

<ResponseField name="statuses" type="array">
  One entry per cancel object in request order. Each entry is either:

  * The string `"success"` — the order was located by client order ID and cancelled.
  * An object `{"error": "<reason>"}` — the cancellation failed; inspect the reason string for details.
</ResponseField>

<Tip>
  To use `cancelByCloid`, you must have set the `c` field on the original `order` request. If you did not provide a client order ID at placement, use the standard `cancel` action with the exchange `oid` instead.
</Tip>
