# Cancel Order

<mark style="color:red;">**`DELETE`**</mark> `https://api.sfox.com/v1/orders/:order_id`

Cancels a specified order. If the order has already been canceled or completed, the API will return an error.

### **Path Parameters**

<table><thead><tr><th width="240">Parameter</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>order_id</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td>The order ID generated by sFOX upon order creation.</td></tr></tbody></table>

### Responses

<details>

<summary><mark style="color:green;">200</mark>: Cancelation Confirmed</summary>

```json
{ 
    "status": "canceled" 
}
```

</details>

<details>

<summary><mark style="color:green;">200</mark>: Cancelation In-Progress</summary>

<pre class="language-json"><code class="lang-json"><strong>{ 
</strong>    "status": "cancel pending" 
}
</code></pre>

</details>

<details>

<summary><mark style="color:green;">200</mark>: Order Completed – Could Not Be Canceled</summary>

```json
{
    "status": "order already finished"
}
```

</details>

<details>

<summary><mark style="color:red;">400</mark>: Bad Request</summary>

```json
//order_id does not exist in your account
{
    "error": "internal error"
}
```

</details>

### Example Requests

{% tabs %}
{% tab title="Shell" %}

```bash
curl -X DELETE
  -H 'Authorization: Bearer <API_TOKEN>' \
  'https://api.sfox.com/v1/orders/123'
```

{% endtab %}

{% tab title="NodeJS" %}

```javascript
const axios = require('axios');

axios({
  method: 'delete',
  url: 'https://api.sfox.com/v1/orders/123',
  headers: {
    'Authorization': 'Bearer <API_KEY>'
  }
}).then(response => {
  console.log(response)
}).catch(err => {
  console.error(err)
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

data = requests.delete(
  "https://api.sfox.com/v1/orders/123",
  headers={
    "Authorization": "Bearer <API_KEY>",
  }
)
print(data)
```

{% endtab %}
{% endtabs %}
