> ## 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 Order

> Cancels an order by its issued `orderId`.



## OpenAPI

````yaml /openapi/v1.json delete /v1/orders/{orderId}
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/{orderId}:
    delete:
      tags:
        - Orders
      summary: Cancel Order
      description: Cancels an order by its issued `orderId`.
      operationId: cancelOrder
      parameters:
        - schema:
            type: string
            minLength: 1
            description: Issued `orderId`.
            example: 3f8b2c9a-2d18-4f7e-9c2a-1b6e1f0c8a4d
          required: true
          name: orderId
          in: path
      responses:
        '200':
          description: Cancel request accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Order'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '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 order = await
            client.cancelOrder("3f8b2c9a-2d18-4f7e-9c2a-1b6e1f0c8a4d");


            console.log("order status:", order.status);
components:
  schemas:
    Order:
      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.
        marketOrders:
          type: array
          items:
            $ref: '#/components/schemas/OrderResult'
          description: >-
            Each market order in this order, in the order submitted — a
            `type`-discriminated entry (market/limit/stop/stop_limit). A
            conditional (stop/stop_limit) rests nothing until it fires, then
            this entry reflects the fills of the order it placed.
        createdAt:
          type: string
          description: ISO-8601 time the order was created.
        updatedAt:
          type: string
          description: ISO-8601 time the order was last updated.
      required:
        - orderId
        - status
        - filledAmount
        - executionCost
        - marketOrders
        - createdAt
        - updatedAt
      title: Order
    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
    AuthError:
      type: object
      properties:
        message:
          type: string
          description: Plain-text explanation of the authentication error.
      required:
        - message
    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
    OrderResult:
      oneOf:
        - $ref: '#/components/schemas/MarketOrderResult'
        - $ref: '#/components/schemas/LimitOrderResult'
        - $ref: '#/components/schemas/StopOrderResult'
        - $ref: '#/components/schemas/StopLimitOrderResult'
        - $ref: '#/components/schemas/IcebergOrderResult'
      discriminator:
        propertyName: type
        mapping:
          market:
            $ref: '#/components/schemas/MarketOrderResult'
          limit:
            $ref: '#/components/schemas/LimitOrderResult'
          stop:
            $ref: '#/components/schemas/StopOrderResult'
          stop_limit:
            $ref: '#/components/schemas/StopLimitOrderResult'
          iceberg:
            $ref: '#/components/schemas/IcebergOrderResult'
      title: OrderResult
    ApiErrorCode:
      type: string
      enum:
        - INVALID_REQUEST
        - NOT_FOUND
        - INSUFFICIENT_BALANCE
        - IDEMPOTENCY_CONFLICT
        - ORDER_NOT_CANCELLABLE
        - INTERNAL_ERROR
      description: Stable identifier for the error category.
    MarketOrderResult:
      type: object
      properties:
        type:
          type: string
          enum:
            - market
          description: 'Discriminator: a market order.'
          example: market
        marketInfo:
          $ref: '#/components/schemas/MarketInfo'
        status:
          $ref: '#/components/schemas/OrderStatus'
        filledAmount:
          type: number
          description: >-
            Amount filled on this market order so far, in USDC (filled shares ×
            average price).
        averagePrice:
          type: number
          nullable: true
          minimum: 0
          maximum: 1
          description: >-
            Average fill price for this market order as implied probability
            (0–1); null until it has a fill.
        executionCost:
          type: number
          description: >-
            Cost to execute this market order, in USDC — any venue fees charged
            on it. Order-level conversion slippage is reported on the order, not
            the individual market order. Excludes gas (covered by ParlayX).
        error:
          type: object
          nullable: true
          properties:
            code:
              $ref: '#/components/schemas/OrderResultErrorCode'
            message:
              type: string
              description: Plain-text explanation of the error.
          required:
            - code
            - message
          description: Why this market order failed when status is failed; null otherwise.
      required:
        - type
        - marketInfo
        - status
        - filledAmount
        - averagePrice
        - executionCost
        - error
      title: MarketOrderResult
    LimitOrderResult:
      type: object
      properties:
        type:
          type: string
          enum:
            - limit
          description: 'Discriminator: a limit order.'
          example: limit
        marketInfo:
          $ref: '#/components/schemas/MarketInfo'
        status:
          $ref: '#/components/schemas/OrderStatus'
        filledAmount:
          type: number
          description: >-
            Amount filled on this market order so far, in USDC (filled shares ×
            average price).
        averagePrice:
          type: number
          nullable: true
          minimum: 0
          maximum: 1
          description: >-
            Average fill price for this market order as implied probability
            (0–1); null until it has a fill.
        executionCost:
          type: number
          description: >-
            Cost to execute this market order, in USDC — any venue fees charged
            on it. Order-level conversion slippage is reported on the order, not
            the individual market order. Excludes gas (covered by ParlayX).
        error:
          type: object
          nullable: true
          properties:
            code:
              $ref: '#/components/schemas/OrderResultErrorCode'
            message:
              type: string
              description: Plain-text explanation of the error.
          required:
            - code
            - message
          description: Why this market order failed when status is failed; null otherwise.
      required:
        - type
        - marketInfo
        - status
        - filledAmount
        - averagePrice
        - executionCost
        - error
      title: LimitOrderResult
    StopOrderResult:
      type: object
      properties:
        type:
          type: string
          enum:
            - stop
          description: 'Discriminator: a stop (conditional) order.'
          example: stop
        marketInfo:
          $ref: '#/components/schemas/MarketInfo'
        status:
          $ref: '#/components/schemas/OrderStatus'
        filledAmount:
          type: number
          description: >-
            Amount filled on this market order so far, in USDC (filled shares ×
            average price).
        averagePrice:
          type: number
          nullable: true
          minimum: 0
          maximum: 1
          description: >-
            Average fill price for this market order as implied probability
            (0–1); null until it has a fill.
        executionCost:
          type: number
          description: >-
            Cost to execute this market order, in USDC — any venue fees charged
            on it. Order-level conversion slippage is reported on the order, not
            the individual market order. Excludes gas (covered by ParlayX).
        error:
          type: object
          nullable: true
          properties:
            code:
              $ref: '#/components/schemas/OrderResultErrorCode'
            message:
              type: string
              description: Plain-text explanation of the error.
          required:
            - code
            - message
          description: Why this market order failed when status is failed; null otherwise.
        conditionalStatus:
          $ref: '#/components/schemas/ConditionalOrderStatus'
      required:
        - type
        - marketInfo
        - status
        - filledAmount
        - averagePrice
        - executionCost
        - error
        - conditionalStatus
      title: StopOrderResult
    StopLimitOrderResult:
      type: object
      properties:
        type:
          type: string
          enum:
            - stop_limit
          description: 'Discriminator: a stop-limit (conditional) order.'
          example: stop_limit
        marketInfo:
          $ref: '#/components/schemas/MarketInfo'
        status:
          $ref: '#/components/schemas/OrderStatus'
        filledAmount:
          type: number
          description: >-
            Amount filled on this market order so far, in USDC (filled shares ×
            average price).
        averagePrice:
          type: number
          nullable: true
          minimum: 0
          maximum: 1
          description: >-
            Average fill price for this market order as implied probability
            (0–1); null until it has a fill.
        executionCost:
          type: number
          description: >-
            Cost to execute this market order, in USDC — any venue fees charged
            on it. Order-level conversion slippage is reported on the order, not
            the individual market order. Excludes gas (covered by ParlayX).
        error:
          type: object
          nullable: true
          properties:
            code:
              $ref: '#/components/schemas/OrderResultErrorCode'
            message:
              type: string
              description: Plain-text explanation of the error.
          required:
            - code
            - message
          description: Why this market order failed when status is failed; null otherwise.
        conditionalStatus:
          allOf:
            - $ref: '#/components/schemas/ConditionalOrderStatus'
            - description: >-
                The stop-limit's conditional lifecycle state (always present on
                a stop-limit). Once `fired`, this entry's
                status/filledAmount/averagePrice/executionCost reflect the
                resting limit order it placed.
      required:
        - type
        - marketInfo
        - status
        - filledAmount
        - averagePrice
        - executionCost
        - error
        - conditionalStatus
      title: StopLimitOrderResult
    IcebergOrderResult:
      type: object
      properties:
        type:
          type: string
          enum:
            - iceberg
          description: 'Discriminator: an iceberg (working) order.'
          example: iceberg
        marketInfo:
          $ref: '#/components/schemas/MarketInfo'
        status:
          $ref: '#/components/schemas/OrderStatus'
        filledAmount:
          type: number
          description: >-
            Amount filled on this market order so far, in USDC (filled shares ×
            average price).
        averagePrice:
          type: number
          nullable: true
          minimum: 0
          maximum: 1
          description: >-
            Average fill price for this market order as implied probability
            (0–1); null until it has a fill.
        executionCost:
          type: number
          description: >-
            Cost to execute this market order, in USDC — any venue fees charged
            on it. Order-level conversion slippage is reported on the order, not
            the individual market order. Excludes gas (covered by ParlayX).
        error:
          type: object
          nullable: true
          properties:
            code:
              $ref: '#/components/schemas/OrderResultErrorCode'
            message:
              type: string
              description: Plain-text explanation of the error.
          required:
            - code
            - message
          description: Why this market order failed when status is failed; null otherwise.
        totalShares:
          type: number
          description: >-
            Total outcome shares this iceberg works toward (the full order size,
            in shares).
        filledShares:
          type: number
          description: >-
            Outcome shares filled across all worked slices so far. Progress
            toward `totalShares`; `averagePrice` is the VWAP across those fills.
      required:
        - type
        - marketInfo
        - status
        - filledAmount
        - averagePrice
        - executionCost
        - error
        - totalShares
        - filledShares
      title: IcebergOrderResult
    MarketInfo:
      oneOf:
        - $ref: '#/components/schemas/PolymarketMarketInfo'
        - $ref: '#/components/schemas/LimitlessMarketInfo'
        - $ref: '#/components/schemas/PredictFunMarketInfo'
      discriminator:
        propertyName: venue
        mapping:
          polymarket:
            $ref: '#/components/schemas/PolymarketMarketInfo'
          limitless:
            $ref: '#/components/schemas/LimitlessMarketInfo'
          predict_fun:
            $ref: '#/components/schemas/PredictFunMarketInfo'
      description: The market and outcome to trade.
      title: MarketInfo
    OrderResultErrorCode:
      type: string
      enum:
        - INSUFFICIENT_FUNDS
        - PRICE_EXCEEDED
        - NOT_EXECUTABLE
        - VENUE_REJECTED
        - INTERNAL_ERROR
      description: Stable identifier for the error category.
    ConditionalOrderStatus:
      type: string
      enum:
        - armed
        - triggered
        - fired
        - cancelled
        - expired
        - failed
      description: >-
        The stop's conditional lifecycle state (always present on a stop). Once
        `fired`, this entry's status/filledAmount/averagePrice/executionCost
        reflect the order it placed.
      example: armed
    PolymarketMarketInfo:
      type: object
      properties:
        venue:
          type: string
          enum:
            - polymarket
        outcomeId:
          type: string
          minLength: 1
          description: The outcome's venue-native id from discovery.
      required:
        - venue
        - outcomeId
      additionalProperties: false
      title: PolymarketMarketInfo
    LimitlessMarketInfo:
      type: object
      properties:
        venue:
          type: string
          enum:
            - limitless
        marketId:
          type: string
          minLength: 1
          description: The market's `marketId` from discovery (the Limitless market slug).
        outcomeId:
          type: string
          minLength: 1
          description: The outcome's venue-native id from discovery.
      required:
        - venue
        - marketId
        - outcomeId
      additionalProperties: false
      title: LimitlessMarketInfo
    PredictFunMarketInfo:
      type: object
      properties:
        venue:
          type: string
          enum:
            - predict_fun
        marketId:
          type: string
          pattern: ^[1-9]\d*$
          description: predict.fun numeric market id — a positive integer, as a string.
          example: '481'
        outcomeId:
          type: string
          minLength: 1
          description: The outcome's venue-native id from discovery.
      required:
        - venue
        - marketId
        - outcomeId
      additionalProperties: false
      title: PredictFunMarketInfo
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````