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

# Cancel All Orders

> Kill-switch: best-effort cancels every open (non-terminal) order. 



## OpenAPI

````yaml /openapi/v1.json delete /v1/orders/all
openapi: 3.0.0
info:
  title: ParlayX API
  version: 1.0.0
  description: Aggregated prediction-market trading API
servers:
  - url: https://api.parlayx.com
security:
  - apiKey: []
tags:
  - name: Markets
    description: Discover markets and find cross-venue matches.
  - name: Orders
    description: Submit, inspect, and cancel orders.
  - name: Rebalances
    description: Move funds between venues and track the transfer.
  - name: Balance
    description: Read account balances and funding state.
paths:
  /v1/orders/all:
    delete:
      tags:
        - Orders
      summary: Cancel All Orders
      description: 'Kill-switch: best-effort cancels every open (non-terminal) order. '
      operationId: cancelAllOrders
      responses:
        '200':
          description: Cancellation sweep completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelAllOrdersResponse'
        '403':
          description: API key missing, malformed, or not recognized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
              example:
                message: Forbidden
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      x-codeSamples:
        - lang: typescript
          label: TypeScript SDK
          source: >
            import { createClient } from "@parlayx/sdk";


            const client = createClient({ apiKey: process.env.PARLAYX_API_KEY!
            });


            const { orders } = await client.cancelAllOrders();


            for (const order of orders) {
              console.log(order.orderId, order.status);
            }
components:
  schemas:
    CancelAllOrdersResponse:
      type: object
      properties:
        orders:
          type: array
          items:
            $ref: '#/components/schemas/OrderSummary'
          description: >-
            Every order that was open when the sweep ran, with its status after
            the cancel attempt.
      required:
        - orders
    AuthError:
      type: object
      properties:
        message:
          type: string
          description: Plain-text explanation of the authentication error.
      required:
        - message
    ApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              $ref: '#/components/schemas/ApiErrorCode'
            message:
              type: string
              description: Plain-text explanation of the error.
          required:
            - code
            - message
      required:
        - error
    OrderSummary:
      type: object
      properties:
        orderId:
          type: string
          minLength: 1
          description: Issued `orderId`.
          example: 3f8b2c9a-2d18-4f7e-9c2a-1b6e1f0c8a4d
        status:
          $ref: '#/components/schemas/OrderStatus'
        filledAmount:
          type: number
          description: Total amount filled across all market orders, in USDC.
        executionCost:
          type: number
          description: >-
            All-in cost to execute this order, in USDC: venue fees plus
            collateral conversion slippage. Excludes gas (covered by ParlayX)
            and recoverable leftover collateral.
      required:
        - orderId
        - status
        - filledAmount
        - executionCost
      title: OrderSummary
    ApiErrorCode:
      type: string
      enum:
        - INVALID_REQUEST
        - NOT_FOUND
        - INSUFFICIENT_BALANCE
        - IDEMPOTENCY_CONFLICT
        - ORDER_NOT_CANCELLABLE
        - INTERNAL_ERROR
      description: Stable identifier for the error category.
    OrderStatus:
      type: string
      enum:
        - pending
        - open
        - partial
        - filled
        - cancelled
        - failed
      description: >-
        Order lifecycle. pending: accepted; funding/signing, not yet resting.
        open: resting on the book, no fills yet. partial: partially filled.
        filled: fully filled. cancelled / failed: terminal.
      example: open
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````