# Cancel order

This endpoint is used to cancel a limit order which hasn’t already been executed at a given time. Please note that this is a <mark style="background-color:purple;">Private 🔒</mark> route which means it needs to be authorised by the account initiating this request.

> Note: You will need to include the JWT Auth token to request headers to access this endpoint. To get the JWT Auth Token, refer the [login](/tech/api-documentation/account/login.md) section of the documentation.

### Endpoint <a href="#endpoint" id="endpoint"></a>

```bash
POST /sapi/v1/orders/cancel/
```

### Request Headers <a href="#request-headers" id="request-headers"></a>

```json
{
  "Authorization": "JWT ***"
}
```

### Request Body <a href="#request-body" id="request-body"></a>

| Field     | Type    | Mandatory |
| --------- | ------- | --------- |
| order\_id | INTEGER | YES       |

#### Example

```json
{
  "order_id": 3
}
```

#### Response <a href="#response" id="response"></a>

```json
{
    "status": "success",
    "message": "Order is successfully queued for cancellation",
    "payload": {
        "id": 25768879,
        "uuid": "17be02d1-34ef-49df-9b92-264705047d99",
        "side": "buy",
        "ord_type": "limit",
        "price": "68733.81",
        "stop_price": null,
        "avg_price": "68733.81",
        "state": "wait",
        "market": "btcusdc",
        "created_at": "2024-05-31T09:02:00+02:00",
        "updated_at": "2024-05-31T09:02:03+02:00",
        "origin_volume": "0.0425",
        "remaining_volume": "0.0335",
        "executed_volume": "0.009000000000000001",
        "maker_fee": "0.0004",
        "taker_fee": "0.0004",
        "trades_count": 2,
        "cancel_reason": null
    }
}
```

> #### Possible Cancel Reasons:
>
> You may receive the following cancel reasons in the response:
>
> * '**Order cancelled by user**': The user requested to cancel the order directly, or through a bulk cancel request.
> * ‘**Slippage greater than 30%. Order cancelled to prevent loss of funds**’: The order was cancelled because its price changed by more than 30% from the time it was placed to the time it was matched.
> * ‘**Order cancellation was initiated by system**’: The order was cancelled for reasons such as order expiration, slippage exceeding a specified threshold, inconsistent order matching, or detection of suspicious activity. However, cancellations due to these reasons are infrequent.
> * ‘**Something went wrong, order was cancelled to prevent loss of funds**’: The order was cancelled because it didn't meet the matching criteria due to unexpected reasons.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tanx.fi/tech/api-documentation/trading/cancel-order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
