---
title: "Cancel orders in batch"
method: POST
path: "/orders/cancel"
tags: ["Flash"]
---

# Cancel orders in batch

`POST /orders/cancel`

## Request

- Base URL: `https://flash.definitive.fi/v1`
- URL: `https://flash.definitive.fi/v1/orders/cancel`
- Auth: API key in header `x-definitive-api-key`

Cancel up to 25 flash orders with one funder signature. Returns 200 with one result per order id, in request order; partial success is reported per order, never as a whole-call failure.

**Signature required.** Construct the canonical UTF-8 batch cancel message and sign it with the funder wallet:

- Message format: `"Definitive Flash v1 — Cancel Orders\nOrders:\n<orderId>\n<orderId>..."` — one lowercase UUID per line, in the same order as `orderIds`, no trailing newline. Identical bytes across EVM and SVM; only the signing primitive differs.
- **EVM chains** — sign with EIP-191 `personal_sign` over the message bytes; pass the 65-byte 0x-prefixed hex signature as `userSignature`.
- **SVM** (`solana`) — sign with Ed25519 over the message bytes; pass the 64-byte base58 signature as `userSignature`.
- Echo the exact message text back as `cancelMessage`.

One wallet per batch: ids the signer does not fund come back `NOT_FOUND` and the rest proceed. A `userSignature` that is not valid hex or base58 is rejected with `400 INVALID_SIGNATURE` before any lookup; a well-formed signature that fails to verify is reported per order as `NOT_FOUND`, never as a 4xx.

Each result mirrors single cancel: `ok: true` for a fresh or already-cancelled order; otherwise `ok: false` with an `errorCode` standing in for the status single cancel would have returned. `PENDING_CANCEL` means a cancel is already in flight — treat it as cancelled and confirm via `GET /orders/{orderId}`.

Cancelling an entry order never cancels its attached bracket pair; include the bracket's own id to cancel it.

## Request body

- BatchCancelOrderRequest
  - `orderIds` string[], required: 1–25 order ids to cancel, as lowercase hyphenated UUIDs, in the same order as the lines of `cancelMessage`. Duplicates are rejected.
  - `cancelMessage` string, required: UTF-8 plaintext the funder wallet signed. Format: "Definitive Flash v1 — Cancel Orders\nOrders:\n<orderId>\n<orderId>..." — one lowercase UUID per line in `orderIds` order, no trailing newline. Same bytes across EVM and SVM.
  - `userSignature` string, required: Funder wallet signature over cancelMessage. Accepts 0x-prefixed hex (EVM convention) or base58 (Solana convention). EVM: 65 bytes from EIP-191 personal_sign. SVM: 64 bytes from Ed25519.

## Response `200`

Per-order results, in request order

- BatchCancelOrderResponse
  - `results` BatchCancelOrderResult[], required: One result per requested order id, in request order.
    - `orderId` string, required: The requested order id.
    - `ok` boolean, required: True when the order was cancelled or was already cancelled; false otherwise.
    - `errorCode` string: Present only when `ok` is false. Why that order was not cancelled: - `NOT_FOUND` — no such order, not a root Flash order, or the signer is not its funder. Drop it. - `ALREADY_FILLED` — the order filled before the cancel landed. Drop it. - `REJECTED` — the order was already rejected. Drop it. - `PENDING_CANCEL` — a cancel is already in flight for this order. Treat as cancelled and confirm via `GET /orders/{orderId}`. - `SETTLING` — the order's status is not known yet; re-check shortly. - `INTERNAL_ERROR` — transient failure; retry this id. Treat any other value as terminal for that order and do not retry it.

## Other responses

- `400`: Invalid request parameters
- `401`: Authentication failed
- `403`: Permission denied
- `404`: Resource not found
- `422`: Resource state prevents the requested operation
- `429`: Rate limit exceeded
- `500`: Internal server error
- `503`: Service temporarily unavailable
- `504`: Gateway timeout

## Changes

- **2026-09-26** `3dd24f76b185`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/definitive/apis/definitive-flash-api/changes/orders/cancel/post.md)

---

[API](https://skmtc.dev/definitive/apis/definitive-flash-api.md) - [All operations](https://skmtc.dev/definitive/apis/definitive-flash-api/llms.txt) - [OpenAPI document](https://skmtc.dev/definitive/apis/definitive-flash-api/revisions/50f9100cb188?raw)
