# Cancel All Orders


:::warning[]
You must be authenticated and [subscribed](https://docs.onetrading.com/websocket/subscribe.md) to the `TRADING` channel in order to send trading messages.
:::

Allows a client to cancel all open orders, an optional instrument_code can be passed, which will result in even faster cancellations.

## Cancel All Orders Request

```json
{
    "type": "CANCEL_ALL_ORDERS",
    "instrument_code": "BTC_EUR" // Optional
 }
```

<DataSchema id="408020" />

## Cancel All Orders Response

### Error

#### No orders to cancel

```json
{
    "error": "no orders to cancel"
}
```

#### Invalid request

```json
{
    "error": "PAIR_ERROR",
    "payload": {
        "type": "CANCEL_ALL_ORDERS",
        "instrument_code": "BTC_PEPE"
    }
}
```

### Success

On initial request, if there are open orders, you will receive a notification that the cancellations are booked.

```json
{
    "channel_name": "TRADING",
    "type": "BOOKED",
    "details": "cancelling 2 orders"
}
```

This will be followed by separate [Order Closed](https://docs.onetrading.com/348529m0.md) notifications for each order.
