> For the complete documentation index, see [llms.txt](https://sunx.gitbook.io/sunx/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sunx.gitbook.io/sunx/developer/rest/order/automatic-order-cancellation.md).

# Automatic Order Cancellation

#### /sapi/v1/trade/cancel-after&#x20;

Request type: POST

Signature verification: Yes

Interface permission: Trade

Rate Limit: 144 requests per UID per 3 seconds. This limit is shared across all trading interfaces (72 requests/3 seconds) and query interfaces (72 requests/3 seconds) for all symbols and contracts with different expiry dates for a given UID.

Interface description: SunX Futures launches the automatic order cancellation interface to prevent API users from incurring unexpected losses in the event of network failures or client system failures that result in a loss of communication with the SunX system. When users experience an unexpected disconnection from SunX's system, this interface automatically cancels all pending orders (including both opening and closing orders) to mitigate potential losses through its Dead Man's Switch functionality. If the interface is not called again within the specified period, all of the user's pending futures orders will be canceled.

### Request Address

| Environment                         | Address                                     |
| ----------------------------------- | ------------------------------------------- |
| Online                              | [https://api.sunx.io](https://api.sunx.io/) |
| Online (preferred by aws customers) | [https://api.sunx.io](https://api.sunx.io/) |

### Request Parameter

| Parameter | Data Type | Required | Description                                                                                                                                                                                                                                                                                                   | Value Range                                                    |
| --------- | --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| on\_off   | String    | true     | Enable and disable the automatic order cancellation feature                                                                                                                                                                                                                                                   | 1 refers to enable the feature;0 refers to disable the feature |
| time\_out | String    | false    | Configure a countdown timer for automatic order cancellation. If the feature is not disabled when the countdown ends, all pending orders placed by the user will be canceled. It is advisable to set the timer when enabling the feature; otherwise, the default countdown is 5,000 milliseconds (5 seconds). | ≥ 5,000 ms                                                     |

### Response Parameter

| Parameter     | Data Type | Required | Description                                    |
| ------------- | --------- | -------- | ---------------------------------------------- |
| current\_time | String    | true     | Current time (subject to platform server time) |
| trigger\_time | String    | true     | Trigger time (subject to platform server time) |

### Request example

```
{
"on_off":"1"
"time_out":"5000"
}
```

### Response Example

```
Success Example
{
  "code": 200,
  "data":
  {      
        "trigger_time": "1767149164445",
        "current_time": "1767149159445"
 
  }
  "message": "Success",
  "ts": 1737103890390
}
```
