# Cancel all open orders

> Cancel every resting order on the account.

Source: https://docs.stxapp.io/api/rest/orders/cancel-all-orders/

Cancel every resting order on the account. Requires a `read_write` key.

```http
DELETE /api/v1/orders/all
```

Send it with your own demo key: [Try it](/quick-start/?op=orders_all_delete#try-it).

:::tip[In the SDKs]
- TypeScript: [`STX.cancelAllOrders()`](/sdks/typescript/reference/stx/#cancelallorders)
- Python: [`STX.cancel_all_orders()`](/sdks/python/reference/stx/#cancel_all_orders)
- C#: [`STXOrderService.CancelAllOrdersAsync()`](/sdks/csharp/reference/trading/#stxorderservice)
:::

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `geo_location` | string,null | no | Location code from the STX geolocation check, covering this cancel. Read only in environments that enforce geo-fencing, and ignored elsewhere. Where it is read, omitting it is a 422 (`Placing Order(s) from this IP address … is disallowed.`) unless that environment accepts the network location the request arrives from in its place, which it can refuse for an address identified as a VPN, proxy or hosting provider. Do not rely on omitting it: send the code whenever you have one. A code that is sent is always checked, so a bad one is a 422 even where omitting it would have been accepted. |

## Responses

| Status | Description | Schema |
|---|---|---|
| `200` | Success | object |
| `400` | A parameter was missing or invalid. | Error |
| `401` | Missing, malformed or unrecognized signature, or a timestamp outside the 30-second window. Body: &#123;"error":"Missing or invalid API key credentials"&#125; | Error |
| `403` | This API key does not have write access. The account behind this key is not active, for example it is pending approval or suspended. Body: &#123;"error":"Your account is suspended. Contact support."&#125;, the message naming the account's status. | Error |
| `422` | The cancel was refused, for example by the location check or because the order can no longer be cancelled. The body's `error` says why. | Error |

## Example

Request:

```bash
curl --request DELETE \
  --url 'https://demo.stxapp.io/api/v1/orders/all' \
  --header 'X-STX-ACCESS-KEY: <key-id>' \
  --header 'X-STX-ACCESS-TIMESTAMP: <unix-ms>' \
  --header 'X-STX-ACCESS-SIGNATURE: <base64-ed25519>' \
  --header 'Content-Type: application/json' \
  --data '{
  "geo_location": null
}'
```

Response `200`:

```json
{
  "cancellations": [
    {
      "order_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
      "status": "cancelled"
    }
  ]
}
```

### Response fields

| Field | Type | Description |
|---|---|---|
| `order_id` | uuid | The order this outcome relates to. |
| `status` | string | The order status after cancelling, or a reason it was not cancelled, such as "Order not found" for an unknown id. |
