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

# Cancel Order

## Endpoint

```text theme={null}
POST /exchange
```

## Request Body

| Parameter              | Type             | Description                         |
| ---------------------- | ---------------- | ----------------------------------- |
| `action`\*             | object           | See below                           |
| `action.type`\*        | string           | Must be `"cancel"`                  |
| `action.cancels`\*     | array            | Cancel items                        |
| `action.cancels[].a`\* | string \| number | Compatibility asset selector        |
| `action.cancels[].o`\* | string           | Internal Notional order id          |
| `nonce`\*              | number           | Replay-protection nonce             |
| `expiresAfter`         | number           | Optional expiration timestamp in ms |
| `signature`\*          | object           | EIP-712 signature                   |

## Response

```json theme={null}
{
  "status": "ok",
  "response": {
    "type": "cancel",
    "data": {
      "statuses": [{ "success": true }, { "pending": { "cloid": "0x1a2b3c..." } }]
    }
  },
  "metadata": {
    "results": [
      {
        "oid": "0x1a2b3c...",
        "status": "confirmed",
        "orderId": "0x1a2b3c..."
      },
      {
        "oid": "0x4d5e6f...",
        "status": "pending",
        "orderId": "0x4d5e6f..."
      }
    ]
  }
}
```

## Status Variants

| Response status | Meaning                                                  |
| --------------- | -------------------------------------------------------- |
| `success: true` | Exchange confirmed the cancel                            |
| `pending.cloid` | Cancel was submitted but exchange confirmation timed out |
| `error`         | Validation or exchange failure                           |

`metadata.results[].status` may be `confirmed`, `failed`, `pending`, `rejected`, `not_found`, `no_venue_id`, or `invalid_state`.

## Example Request

```bash theme={null}
curl -X POST https://api.notional.xyz/exchange \
  -H "Content-Type: application/json" \
  -d '{
    "action": {
      "type": "cancel",
      "cancels": [
        {
          "a": "BTC",
          "o": "0x1a2b3c4d5e6f7890..."
        }
      ]
    },
    "nonce": 1701234567890,
    "signature": {
      "r": "0x1234...",
      "s": "0x5678...",
      "v": 27
    }
  }'
```

## Notes

<Note>
  * Cancelable states are `open`, `partial`, `waitingForTrigger`, `pending_trigger`,
    `pending_parent_fill`, and prefund-pending spot buy orders. - Maximum batch size is 256 cancels. -
    Duplicate order ids in one cancel request are rejected. - `action.cancels[].o` is always the
    internal Notional order id, not the exchange order id.
</Note>
