> ## 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.

# cancel: Cancel Resting Orders by Exchange Order ID

> Cancel one or more resting orders using the exchange-assigned order IDs (oid) returned when the orders were placed. Supports batches of up to 10.

The `cancel` action removes resting orders from the order book using the exchange-assigned order IDs returned in the `resting.oid` field when you originally placed them. You can cancel up to 10 orders in a single signed request, mixing contracts freely within the batch.

## Endpoint

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

## Request Body

```json theme={"system"}
{
  "action": {
    "type": "cancel",
    "cancels": [
      { "a": 1, "o": 3 }
    ]
  },
  "signature": { "r": "0x...", "s": "0x...", "v": 28 },
  "nonce": 1778572961403
}
```

## Action Fields

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

<ParamField body="cancels" type="array" required>
  Array of cancel objects. Maximum **10** per request. Each entry must identify the contract and the exchange order ID 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="o" type="int64" required>
  **orderId** — The exchange-assigned order ID from the `resting.oid` field returned when the order was placed.
</ParamField>

## Responses

The response contains one status entry per cancel object in the same index order as your request.

<Tabs>
  <Tab title="Success">
    All cancellations were accepted. Each successful entry is the plain string `"success"`.

    ```json theme={"system"}
    {
      "status": "ok",
      "requestId": "req-144115188075855907",
      "response": {
        "type": "cancel",
        "data": { "statuses": ["success"] }
      }
    }
    ```
  </Tab>

  <Tab title="Order Not Found">
    The provided order ID does not match any active order. The entry is an error object instead of the string `"success"`.

    ```json theme={"system"}
    {
      "status": "ok",
      "response": {
        "type": "cancel",
        "data": { "statuses": [{ "error": "orderId 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 found and removed from the book.
  * An object `{"error": "<reason>"}` — the cancellation failed; the reason string explains why.
</ResponseField>

<Note>
  A top-level `"status": "ok"` does **not** mean every individual cancellation succeeded. Always inspect each element of `statuses` to detect per-order failures.
</Note>
