> For the complete documentation index, see [llms.txt](https://docs.pangolin.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pangolin.exchange/pangoperps/trading-api/order-management/cancel-all-after.md).

# Cancel All After

Set a timer that cancels all pending regular and algorithmic orders.

### Endpoint

**POST /v1/order/cancel\_all\_after**

Mainnet: `POST https://api.orderly.org/v1/order/cancel_all_after`

Testnet: `POST https://testnet-api.orderly.org/v1/order/cancel_all_after`

Rate limit: 1 request per second. This is a dead-man switch: after the configured interval elapses, all of the account's regular and algorithmic orders are cancelled. Access must be enabled for the account before this endpoint can be used.

### Authentication headers

* orderly-timestamp — signed-request timestamp in milliseconds.
* orderly-account-id — PangoPerps account ID.
* orderly-key — public API key.
* orderly-signature — request signature.
* Content-Type: application/json — JSON request body.

### Request body

| Field          | Type   | Required | Description                                                                          |
| -------------- | ------ | -------- | ------------------------------------------------------------------------------------ |
| trigger\_after | number | Yes      | Timer in milliseconds. Minimum: 5000. Maximum: 900000. Set to 0 to cancel the timer. |

### Example request

```bash
curl --request POST \
  --url 'https://api.orderly.org/v1/order/cancel_all_after' \
  --header 'Content-Type: application/json' \
  --header 'orderly-account-id: <account-id>' \
  --header 'orderly-key: <public-api-key>' \
  --header 'orderly-signature: <signature>' \
  --header 'orderly-timestamp: <timestamp-in-ms>' \
  --data '{"trigger_after": 5000}'
```

### Successful response

HTTP 200 returns the expected time at which the timer will trigger.

```json
{
  "success": true,
  "data": {
    "expected_trigger_time": "1711534302938"
  },
  "timestamp": 1702989203989
}
```
