Schedule Cancel (Dead Man's Switch)
Schedule an automatic cancel-all operation at a future time as a safety feature if you lose connectivity or system access.
Endpoint
POST https://papi.synthetix.io/v1/tradeRequests
Request Format
Schedule Cancel
{
"params": {
"action": "scheduleCancel",
"subAccountId": "1867542890123456789",
"timeoutSeconds": 300
},
"nonce": 1704067200000,
"expiresAfter": 1704067300,
"signature": {
"v": 28,
"r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
}
}Cancel Dead Man's Switch
{
"params": {
"action": "scheduleCancel",
"subAccountId": "1867542890123456789",
"timeoutSeconds": 0
},
"nonce": 1704067200000,
"signature": {
"v": 28,
"r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
}
}Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
params | object | Yes | Request parameters wrapper |
params.action | string | Yes | Must be "scheduleCancel" |
params.subAccountId | string | Yes | SubAccount ID |
params.timeoutSeconds | integer | Yes | Timeout in seconds; use 0 to cancel an existing schedule |
nonce | integer (uint64) | Yes | Unix milliseconds timestamp, incrementing |
expiresAfter | integer | No | Optional expiration timestamp in seconds |
signature | object | Yes | EIP-712 signature object |
Time Requirements
- Minimum timeout: 5 seconds (
timeoutSeconds >= 5) - Maximum timeout: 86400 seconds (24 hours)
- Cancel schedule: set
timeoutSeconds: 0
Response
Success Response - Scheduled
{
"status": "ok",
"response": {
"isActive": true,
"message": "dead-man-switch armed",
"timeoutSeconds": 300,
"triggerTime": 1704067500000
},
"request_id": "5ccf215d37e3ae6d",
"requestId": "5ccf215d37e3ae6d",
"timestamp": 1704067200123
}Success Response - Cancelled
{
"status": "ok",
"response": {
"isActive": false,
"message": "dead-man-switch disabled",
"timeoutSeconds": 0
},
"request_id": "5ccf215d37e3ae6d",
"requestId": "5ccf215d37e3ae6d",
"timestamp": 1704067200456
}Error Response
{
"status": "error",
"error": {
"code": "VALIDATION_ERROR",
"message": "timeoutSeconds must be less than or equal to 86400"
},
"request_id": "5ccf215d37e3ae6d",
"requestId": "5ccf215d37e3ae6d",
"timestamp": 1704067200000
}Code Examples
Schedule Cancel in 5 Minutes
{
"params": {
"action": "scheduleCancel",
"subAccountId": "1867542890123456789",
"timeoutSeconds": 300
},
"nonce": 1704067200000,
"signature": {
"v": 28,
"r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
}
}Schedule Cancel in 1 Hour
{
"params": {
"action": "scheduleCancel",
"subAccountId": "1867542890123456789",
"timeoutSeconds": 3600
},
"nonce": 1704067200000,
"expiresAfter": 1704067300,
"signature": {
"v": 28,
"r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
}
}Dead Man's Switch Behavior
- Automatic Trigger: All open orders are cancelled at the scheduled time
- Single Use: Each schedule is used once and then removed
- Overwrite: New schedule replaces existing one
- Cancellation: Send
timeoutSeconds: 0to cancel an existing schedule
Use Cases
- Trading Bot Safety: Cancel orders if bot loses connection
- Manual Trading: Safety net for manual traders
- Risk Management: Automatic order cancellation during volatile periods
- Maintenance Windows: Clear orders before system maintenance
Validation Rules
noncemust be a timestamp in milliseconds and must be increasingtimeoutSecondsmust be0(cancel) or between 5 and 86400 (inclusive)- Only one schedule can be active at a time; a new schedule overwrites the existing one
- Must be signed by account owner or authorized delegate
Signing
All trading methods are signed using EIP-712. Each successful trading request will contain:
- A piece of structured data that includes the sender address
- A signature of the hash of that structured data, signed by the sender
For detailed information on EIP-712 signing, see EIP-712 Signing.
Nonce Management
The nonce system prevents replay attacks and ensures order uniqueness:
- Use any positive integer as nonce
- Each nonce must be greater than the previous one (incrementing)
Date.now()is a convenient option, not a requirement- If nonce conflicts occur, increment by 1 and retry
:::note SubAccountAction Exception
SubAccountAction endpoints (getPositions, getOpenOrders, getOrdersHistory, getTrades, getFundingPayments, getSubAccount, getSubAccounts, getDelegatedSigners, getBalanceUpdates) do not require a nonce. Only the signature and optional expiresAfter parameters are needed.
:::
Error Handling
Common error scenarios:
| Error Code | Description | Retryable |
|---|---|---|
UNAUTHORIZED | EIP-712 signature validation failed | No |
VALIDATION_ERROR | Request validation failed | No |
MISSING_REQUIRED_FIELD | Required field is missing | No |
INVALID_FORMAT | Field format is invalid | No |
INVALID_VALUE | Invalid parameter value | No |
RATE_LIMIT_EXCEEDED | Too many requests in time window | Yes |
INSUFFICIENT_MARGIN | Not enough margin for trade | No |
ORDER_NOT_FOUND | Order does not exist | No |
OPERATION_TIMEOUT | Operation timed out | Yes |
| Error | Description |
|---|---|
timeoutSeconds too small | Must be 0 or at least 5 |
timeoutSeconds too large | Exceeds maximum of 86400 seconds |
| Request expired | expiresAfter timestamp has passed |
