# Cancel Multiple Orders

<mark style="color:red;">**`DELETE`**</mark> `https://api.sfox.com/v1/orders?ids=<order_id1>,<order_id2>,<...>`

Cancel a list of order IDs. sFOX will attempt to cancel each order included in the list and respond with the orders that were able to be canceled.

### **Query Parameters**

<table><thead><tr><th width="240">Parameter</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>ids</code></strong> <mark style="color:red;">required</mark></td><td>string</td><td><p>List of order IDs separated by a comma (,) </p><p>e.g. /orders?ids=123,456,789</p></td></tr></tbody></table>

### Responses

<details>

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

Responds with an array of all of the orders listed in the request that were able to begin cancelation (`Cancel Pending`) or were successfully canceled (`Canceled`)

```json
{ 
  "orders": [
    {"id": 2, "status": "Cancel pending"},
    {"id": 3, "status": "Canceled"}
  ]
}
```

</details>

<details>

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

If all of the provided order IDs were invalid, or were already in a `Done` or `Canceled` state, the response will contain an error.

{% code overflow="wrap" %}

```json
{ 
  "error": "the order ids provided were invalid or the orders were already done/canceled"
}
```

{% endcode %}

</details>

### Example Requests

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

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

{% endtab %}

{% tab title="NodeJS" %}

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

axios({
  method: 'delete',
  url: 'https://api.sfox.com/v1/orders',
  headers: {
    'Authorization': 'Bearer <API_KEY>'
  },
  params: {
    ids: '123,456'
  }
}).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",
  headers={
    "Authorization": "Bearer <API_KEY>",
  },
  params={
   "ids": "123,456"
  }
)
print(data)
```

{% endtab %}
{% endtabs %}


---

# 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.sfox.com/rest-api/orders/cancel-multiple-orders.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.
