> ## Documentation Index
> Fetch the complete documentation index at: https://flash.definitive.fi/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel orders in batch

> 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.



## OpenAPI

````yaml https://flash.definitive.fi/v1/openapi.json post /orders/cancel
openapi: 3.1.0
info:
  title: Definitive Flash API
  version: 2.0.0
  description: Flash swap API for decentralized token trading.
servers:
  - url: https://flash.definitive.fi/v1
security: []
paths:
  /orders/cancel:
    post:
      tags:
        - Flash
      summary: Cancel orders in batch
      description: >-
        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.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchCancelOrderRequest'
      responses:
        '200':
          description: Per-order results, in request order
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchCancelOrderResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Resource state prevents the requested operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Service temporarily unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: Gateway timeout
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    BatchCancelOrderRequest:
      type: object
      properties:
        orderIds:
          type: array
          items:
            type: string
            pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
          minItems: 1
          maxItems: 25
          description: >-
            1–25 order ids to cancel, as lowercase hyphenated UUIDs, in the same
            order as the lines of `cancelMessage`. Duplicates are rejected.
        cancelMessage:
          type: string
          minLength: 1
          description: >-
            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:
          type: string
          minLength: 1
          description: >-
            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.
      required:
        - orderIds
        - cancelMessage
        - userSignature
    BatchCancelOrderResponse:
      type: object
      properties:
        results:
          type: array
          items:
            $ref: '#/components/schemas/BatchCancelOrderResult'
          description: One result per requested order id, in request order.
      required:
        - results
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details:
              nullable: true
          required:
            - code
            - message
      required:
        - error
    BatchCancelOrderResult:
      type: object
      properties:
        orderId:
          type: string
          description: The requested order id.
        ok:
          type: boolean
          description: >-
            True when the order was cancelled or was already cancelled; false
            otherwise.
        errorCode:
          $ref: '#/components/schemas/BatchCancelErrorCode'
      required:
        - orderId
        - ok
    BatchCancelErrorCode:
      type: string
      minLength: 1
      description: >-
        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.
      example: ALREADY_FILLED
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-definitive-api-key
      description: Your Definitive API key.
      x-default: dpka_513a2bd7_57a2_46d2_927b_2a3857fe271b

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.