> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pacifica.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel All Orders

> This endpoint allows users to cancel all orders for all/given symbol(s).

The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/rest/cancel_all_orders.py) provides a comprehensive example on using this endpoint

```http theme={null}
POST /api/v1/orders/cancel_all
```

#### Operation Type (for Signing)

| Header Field | Type   | Content               |
| ------------ | ------ | --------------------- |
| `"type"`     | string | `"cancel_all_orders"` |

#### Request Body

<table><thead><tr><th width="184">Field</th><th width="98">Type</th><th width="123">Need</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><code>"account"</code></td><td>string</td><td>required</td><td>User's wallet address</td><td><code>42trU9A5...</code></td></tr><tr><td><code>"signature"</code></td><td>string</td><td>required</td><td>Cryptographic signature</td><td><code>5j1Vy9Uq...</code></td></tr><tr><td><code>"timestamp"</code></td><td>integer</td><td>required</td><td>Current timestamp in milliseconds</td><td><code>1716200000000</code></td></tr><tr><td><code>"all\_symbols"</code></td><td>boolean</td><td>required</td><td>Whether to cancel orders for all symbols</td><td><code>true</code></td></tr><tr><td><code>"exclude\_reduce\_only"</code></td><td>boolean</td><td>required</td><td>Whether to exclude reduce-only orders</td><td><code>false</code></td></tr><tr><td><code>"symbol"</code></td><td>string</td><td>required<br />(if all\_symbols is false)</td><td>Trading pair symbol</td><td /></tr><tr><td><code>"agent\_wallet"</code></td><td>string</td><td>optional</td><td>Agent wallet address</td><td><code>69trU9A5...</code></td></tr><tr><td><code>"expiry\_window"</code></td><td>integer</td><td>optional</td><td>Signature expiry in milliseconds</td><td><code>30000</code></td></tr></tbody></table>

```json theme={null}
{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq...",
  "timestamp": 1716200000000,
  "all_symbols": true,
  "exclude_reduce_only": false,
  "symbol": "BTC",
  "agent_wallet": "69trU9A5...",
  "expiry_window": 30000
}
```

#### Response

* Status 200: All orders cancelled successfully

```json theme={null}
  {
    "cancelled_count": 5
  }
```

* Status 400: Bad request

```json theme={null}
  {
    "error": "Invalid parameters",
    "code": 400
  }
```

* Status 500: Internal server error

#### Code Example (Python)

```python theme={null}
import requests

payload = {
    "account": "42trU9A5...",
    "signature": "5j1Vy9Uq...",
    "timestamp": 1716200000000,
    "all_symbols": True,
    "exclude_reduce_only": False
}

response = requests.post(
    "/api/v1/orders/cancel_all",
    json=payload,
    headers={"Content-Type": "application/json"}
)

data = response.json()
```
