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

# Cancel an order

> Cancels the unfilled portion of an open order. The account's email must be verified.

Requires the `ORDER_CANCEL` scope.




## OpenAPI

````yaml /openapi.yaml delete /orders/{orderId}
openapi: 3.1.0
info:
  title: PaperDrill REST API
  version: 1.0.0
  description: >
    Trade PaperDrill credit markets and read live market data.


    Prices, quantities, balances, and other decimal values are encoded as
    strings so clients do not lose precision.
servers:
  - url: https://api.paperdrill.dev/v1
    description: Production
security: []
tags:
  - name: Market data
    description: Public markets, tickers, candles, trades, and order-book snapshots.
  - name: Trading
    description: Create, inspect, and cancel orders with a scoped API key.
  - name: Account
    description: Read balances, portfolio performance, and private trade history.
paths:
  /orders/{orderId}:
    delete:
      tags:
        - Trading
      summary: Cancel an order
      description: >
        Cancels the unfilled portion of an open order. The account's email must
        be verified.


        Requires the `ORDER_CANCEL` scope.
      operationId: cancelOrder
      parameters:
        - $ref: '#/components/parameters/OrderId'
      responses:
        '200':
          description: Order cancelled successfully.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/CancelledOrder'
                  - type: object
                    required:
                      - message
                    properties:
                      message:
                        type: string
              examples:
                cancelled:
                  value:
                    id: order_123
                    symbol: SOL_USD
                    status: CANCELLED
                    side: BUY
                    qty: '2.00'
                    filledQty: '0.50'
                    releasedFunds: '188.25'
        '404':
          $ref: '#/components/responses/OrderNotFound'
        '409':
          $ref: '#/components/responses/OrderNotCancellable'
        default:
          $ref: '#/components/responses/RequestError'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    OrderId:
      name: orderId
      in: path
      required: true
      description: Order identifier.
      schema:
        type: string
      example: order_123
  schemas:
    CancelledOrder:
      type: object
      required:
        - id
        - symbol
        - status
        - side
        - qty
        - filledQty
        - releasedFunds
      properties:
        id:
          type: string
        symbol:
          type: string
        status:
          type: string
          const: CANCELLED
        side:
          $ref: '#/components/schemas/Side'
        qty:
          $ref: '#/components/schemas/DecimalString'
        filledQty:
          $ref: '#/components/schemas/DecimalString'
        releasedFunds:
          $ref: '#/components/schemas/DecimalString'
    Side:
      type: string
      enum:
        - BUY
        - SELL
    DecimalString:
      type: string
      pattern: ^\d+(\.\d+)?$
      description: A non-negative decimal encoded as a string.
      example: '125.50'
    ApiError:
      type: object
      required:
        - error
        - requestId
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: array
              items:
                $ref: '#/components/schemas/ApiErrorDetail'
        requestId:
          type: string
          format: uuid
      example:
        error:
          code: VALIDATION_ERROR
          message: Request validation failed
          details:
            - field: qty
              message: invalid decimal format
        requestId: f4c0baf4-b8d2-4c9a-a17b-c8656c4a7b0e
    ApiErrorDetail:
      type: object
      required:
        - message
      properties:
        field:
          type: string
        message:
          type: string
  responses:
    OrderNotFound:
      description: The order does not exist or is not owned by the caller.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    OrderNotCancellable:
      description: The order can no longer be cancelled.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
    RequestError:
      description: The request failed. See Errors and rate limits for recovery guidance.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: A scoped API key created in the PaperDrill dashboard.

````

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