---
title: "Cancel all of the authenticated user's open orders on an exchange"
method: POST
path: "/orders/cancel-all"
tags: ["Orders"]
---

# Cancel all of the authenticated user's open orders on an exchange

`POST /orders/cancel-all`

## Request

- Base URL: `https://execution.kairos.trade`
- URL: `https://execution.kairos.trade/orders/cancel-all`
- Auth: API key in header `X-Client-Id` and API key in header `X-Api-Key` and API key in header `X-Api-Secret`

Kill-switch endpoint: cancels every open order the caller has on `exchange_id` (optionally scoped further to a single `market_id`) via the venue's native cancel-all call, then reconciles local `Order` rows up to however many the venue actually reported cancelled. If the venue reports `0` cancellations, no local rows are touched — a mismatch between "0 cancelled" and locally-tracked active orders is reconciled automatically in the background rather than being blindly marked cancelled.
Unlike `POST /orders/{order_id}/cancel` and `POST /orders/cancel-batch`, input errors here (e.g. an unsupported `exchange_id`) surface as a real `400`, not a `success: false` 200 — this is the kill-switch path, so a caller-input problem must be visibly distinct from "the venue kept orders resting."
**Auth & scope.** Requires `trade:execute`.

## Request body

- OrderCancelAllRequest: Body for `POST /orders/cancel-all`.
  - `user_id` string: Ignored. The authenticated caller's id is always used.
  - `exchange_id` string, required: Venue to cancel all open orders on.
  - `market_id` string, nullable: Optionally scope the cancel-all to a single market/contract id instead of every open order on the exchange.

## Response `200`

Cancel-all result. `cancelled_count` is the venue's authoritative count; `cancelled_order_ids` lists the local rows actually updated (may be fewer than `cancelled_count` if some local rows lag).

- OrderCancelAllResponse: Response for `POST /orders/cancel-all`.
  - `cancelled_count` integer, required: Authoritative count of orders the venue reported cancelled.
  - `failed_count` integer, required: Local rows that failed to update to `cancelled` after the venue confirmed the cancel.
  - `cancelled_order_ids` string[], required: Internal order ids (as strings) whose local status was updated. May be fewer than `cancelled_count` if the venue cancelled more than the locally-tracked active set.

## Other responses

- `400`: No executor is registered for `exchange_id` — `VALIDATION_INVALID_ORDER`, message `unknown exchange_id '<id>'` — or the venue rejected the cancel-all call as an invalid request (e.g. bad `market_id`).
- `401`: The user's venue credentials could not be loaded (`AUTH_CREDENTIALS_NOT_FOUND`). NOTE this is a `401`, not a `500`.
- `403`: Missing `trade:execute` scope (`AUTH_INSUFFICIENT_SCOPE`), or API-key access to this provider is disabled.
- `500`: An unclassified internal failure. Per-order local-row update failures are NOT errors — they only increment `failed_count` in a `200` response.
- `502`: The venue's cancel-all call failed (network/exchange error).
- `503`: API-key access to this provider could not be checked (`INTERNAL_ERROR`, fails closed).
- `504`: `NETWORK_TIMEOUT` — the venue's cancel-all call timed out.

---

[API](https://skmtc.dev/kairos/apis/kairos-order-execution-api.md) - [All operations](https://skmtc.dev/kairos/apis/kairos-order-execution-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kairos/apis/kairos-order-execution-api/revisions/9ba7d463d505?raw)
