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

# Cancel Order

> Cancel an order

# Cancel Order

Cancel an existing order.

<Note>Requires `write:orders` scope.</Note>

## Request

```bash theme={null}
POST /api/v1/orders/{id}/cancel
```

### Path Parameters

<ParamField path="id" type="string" required>
  The order ID or order\_tenant\_id
</ParamField>

### Body Parameters

<ParamField body="order_tenant_id" type="string">
  Alternative: your external order ID
</ParamField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.zenflow.com.ar/api/v1/orders/ORD-001/cancel" \
    -H "X-API-Key: zenflow_live_your_key" \
    -H "Content-Type: application/json"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch(
    "https://api.zenflow.com.ar/api/v1/orders/ORD-001/cancel",
    {
      method: "POST",
      headers: { "X-API-Key": "zenflow_live_your_key" },
    }
  );
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.zenflow.com.ar/api/v1/orders/ORD-001/cancel',
      headers={'X-API-Key': 'zenflow_live_your_key'}
  )
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "data": {
    "message": "Order cancelled successfully",
    "order_id": "ORD-001"
  }
}
```

## Error Responses

### 404 Not Found

```json theme={null}
{
  "success": false,
  "error": {
    "code": "not_found",
    "message": "Order not found"
  }
}
```

### 400 Cannot Cancel

```json theme={null}
{
  "success": false,
  "error": {
    "code": "cancel_error",
    "message": "Cannot cancel order that is already completed"
  }
}
```
