> For the complete documentation index, see [llms.txt](https://api-documentation.autoshares.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-documentation.autoshares.dev/rest-api/trading-api/orders/cancel-order.md).

# Cancel an Order

## Overview

This DELETE endpoint enables you to cancel an outstanding order of the user whose authorization token is provided in the header request. If the user has pending buy, sell, short-sell, or buy-to-cover orders, you can cancel each one of them by sending this API request.

There are five required parameters that must be provided in the request header:

1. **Et-App-Key** (header). This is the unique key of your app that identifies your app when communicating with our service. Contact your administrator to get this key.
2. **Authorization** (header). This is the authorization token from the very first [token request](/rest-api/trading-api/authentication/requesting-tokens.md).
3. **orderId** (path). This is the numeric ID of the order that must be cancelled.&#x20;
4. **version** (path). Unless necessary, leave it at "1.0"
5. **accountID** (path). This is the numeric ID of the trading account on which the order must be canceled.

This API request must be sent to the following URL:

* For orders that will only be verified by the API but not the execution venue (quick):

```
DELETE apiURL/v1.0/accounts/6303/orders/73552
```

* For orders that will be verified by the API and the execution venue too (slow):

```
DELETE apiURL/v1.0/accounts/6303/syncorders/73552
```

## Response

In response to this API request — if the order was successfully deleted — you'll receive no JSON file. The status code of the request will be 204 (successful order cancellation).

## Common Mistakes

Here are some of the common mistakes that developers make when trying to cancel an outstanding order.

### Failing to Specify the Et-App-Key Parameter

If you specify the wrong Et-App-Key parameter or fail to include it in the header altogether, you'll get the following error:

```javascript
{
    "error": "Application key is not defined or does not exist"
}
```

### Specifying the ID of a Completed Order

Another common mistake when making this request is specifying the order ID of an already filled order. In this case the cancellation will be rejected because only outstanding orders can be cancelled.

In the following article we provide in-depth coverage of the syntax for this API request.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://api-documentation.autoshares.dev/rest-api/trading-api/orders/cancel-order.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
