---
title: "Set Auto-Cancel"
method: PATCH
path: "/v1/trade/auto-cancel"
---

# Set Auto-Cancel

`PATCH /v1/trade/auto-cancel`

Set a dead man's switch that cancels all your open orders at the chosen
time. The time must be at least 5 seconds in the future. Send 0 to clear
an active schedule without triggering it; posting a new time replaces the
current one.

The switch fires once, then clears itself. It does not cover orders you
place after it fires, so re-arm it if you still need protection.

An account can trigger auto-cancel up to 1000 times per UTC day. After
that, the API rejects new schedules with the error
`auto_cancel_daily_limit_reached` until the next UTC day. Clearing a
schedule is always allowed. To check the active deadline and today's
trigger count, call [Get Auto-Cancel Status](/api-reference/get-auto-cancel-status).

Requires proxy signature, see [proxy signing](/http/signing#2-proxy-signing).

## Request body

- AutoCancelRequest
  - `op` OpAutoCancel, required
    - `type` 'autoCancel', required
    - `args` object, required
      - `time` integer, required — Timestamp in milliseconds
  - `sig` string, required — Signature in hex format
  - `salt` integer, required — Salt
  - `ts` integer, required — Request timestamp. Unix milliseconds for most operations; Unix seconds for withdrawals (must match the on-chain EIP-712 struct verified against block.timestamp).

## Response `200`

The effective auto-cancel schedule after the update.

- AutoCancelResponse — The auto-cancel schedule now in effect. The deadline field echoes the armed time in Unix milliseconds, or 0 if you cleared the schedule.
  - `status` 'ok', required
  - `deadline` integer, required — Deadline of the armed auto-cancel schedule, in Unix milliseconds. Zero means no schedule is armed. When the deadline passes, the exchange cancels every open order on the account and the schedule clears.

## Other responses

- `400` — Bad request — the request was malformed or failed validation (bad query parameters, unparseable body, invalid signature, or a domain pre-check). The `error` field is a human-readable validation detail.
- `404` — Not found — the endpoint is disabled on this venue (e.g. auto-cancel) or the route does not exist. `error` is `not_found`.
- `422` — Unprocessable Entity — the request was well-formed but a domain rule rejected it on its merits (insufficient balance, invalid leverage, proxy already exists, …). The body is the discriminated rejection (`status: err`) with the engine error identifier in `error`.
- `429` — Too Many Requests. `error` distinguishes the limit that was hit: `ip_rate_limited` (per-IP token bucket), `action_rate_limited` (per-account action rate), or `open_orders_limit` (resting open-order cap).
- `500` — Internal server error. `error` is `internal_error`.

---

[API](https://skmtc.net/polymarket/apis/polymarket-perps-http-api.md) · [All operations](https://skmtc.net/polymarket/apis/polymarket-perps-http-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/polymarket/polymarket-perps-http-api/revisions/76e4e47cf3aa/schema)
