> ## 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 Order Strategy

> This endpoint allows users to cancel an order strategy and its open orders.

```http theme={null}
POST /api/v1/order_strategies/cancel
```

Cancels the strategy and the orders it still has open. Fills that already happened stay.

#### Operation Type (for Signing)

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

#### Request Body

<table><thead><tr><th width="200">Field</th><th width="98">Type</th><th width="95">Need</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td>`"account"`</td><td>string</td><td>required</td><td>User's wallet address</td><td>`42trU9A5...`</td></tr><tr><td>`"signature"`</td><td>string</td><td>required</td><td>Cryptographic signature</td><td>`5j1Vy9Uq...`</td></tr><tr><td>`"timestamp"`</td><td>integer</td><td>required</td><td>Current timestamp in milliseconds</td><td>`1716200000000`</td></tr><tr><td>`"strategy_id"`</td><td>string</td><td>required</td><td>Strategy ID (UUID)</td><td>`0f8e7c2a-...`</td></tr><tr><td>`"agent_wallet"`</td><td>string</td><td>optional</td><td>Agent wallet address</td><td>`69trU9A5...`</td></tr><tr><td>`"expiry_window"`</td><td>integer</td><td>optional</td><td>Signature expiry in milliseconds</td><td>`30000`</td></tr></tbody></table>

```json theme={null}
{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq...",
  "timestamp": 1716200000000,
  "strategy_id": "0f8e7c2a-4b1d-4e5f-9a3b-2c1d0e9f8a7b"
}
```

#### Response

* Status 200: Strategy cancelled

```json theme={null}
{
  "success": true,
  "data": {
    "strategy_id": "0f8e7c2a-4b1d-4e5f-9a3b-2c1d0e9f8a7b"
  },
  "error": null,
  "code": null
}
```

* Status 404: Strategy not found (`STRATEGIST_NOT_FOUND`)
* Status 500: Internal server error

#### Code Example (Python)

```python theme={null}
import requests

payload = {
    "account": "42trU9A5...",
    "signature": "5j1Vy9Uq...",
    "timestamp": 1716200000000,
    "strategy_id": "0f8e7c2a-4b1d-4e5f-9a3b-2c1d0e9f8a7b"
}

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

data = response.json()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.