# Cancel Order by Client ID


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

Submits a request to cancel an open order by providing a valid client_id.


:::caution[Note]
If you have created multiple orders with the same `client_id`, only the most recent will be cancelled with this request. It is your responsibility to ensure uniqueness in your client_ids.
:::

## Cancel Order by Client ID Request

```json
{
    "type": "CANCEL_ORDER",
    "client_id": "8fd80590-4679-4e7d-9ef9-4346dadb5c8f"
 }
```

<DataSchema id="408014" />

## Cancel Order by Client ID Response

### Error

#### Order not found

```json
{
    "error": "ORDER_NOT_FOUND",
    "client_id": "8fd80590-4679-4e7d-9ef9-4346dadb5c8f"
}
```

#### Invalid Client ID

```json
{
    "error": "CLIENT_ID_ERROR",
    "payload": {
        "type": "CANCEL_ORDER",
        "client_id": "not valid"
    }
}
```

### Success

If a cancel order by client ID request is valid, you will receive an [Order Closed](https://docs.onetrading.com/348529m0.md) notification.