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

# Cancel Order

> Cancel an unfilled or partially filled order. You must specify `order_id` or `order_link_id`. If both are passed, `order_id` is used.

- 200: order canceled
- 400: `EcOrderNotExist` (unknown), `EcTooLateToCancel` (already filled or canceled), `SystemInKillSwitch`
- 202: accepted but not confirmed in time; not a successful cancel



## OpenAPI

````yaml /v2/api-reference/openapi.json post /api/v1/order/cancel
openapi: 3.1.0
info:
  title: ekiden-gateway
  description: >-
    API Gateway and WebSocket proxy based on Axum and Utoipa, handling auth,
    rate limiting, and connection buffering.
  license:
    name: ''
  version: 0.1.1
servers:
  - url: https://api.dev.ekiden.fi/
    description: Production (Canton Mainnet)
security: []
paths:
  /api/v1/order/cancel:
    post:
      tags:
        - Trade
      summary: Cancel Order
      description: >-
        Cancel an unfilled or partially filled order. You must specify
        `order_id` or `order_link_id`. If both are passed, `order_id` is used.


        - 200: order canceled

        - 400: `EcOrderNotExist` (unknown), `EcTooLateToCancel` (already filled
        or canceled), `SystemInKillSwitch`

        - 202: accepted but not confirmed in time; not a successful cancel
      operationId: cancel_order
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelOrderRequest'
        required: true
      responses:
        '200':
          description: Order canceled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelOrderResponse'
        '202':
          description: Accepted but not confirmed. Not a successful cancel.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelOrderResponse'
        '400':
          description: EcOrderNotExist, EcTooLateToCancel, or SystemInKillSwitch
      security:
        - bearer_auth: []
components:
  schemas:
    CancelOrderRequest:
      type: object
      description: >-
        Cancel an unfilled or partially filled order.


        Either `order_id` or `order_link_id` is required. If both are passed,
        `order_id` is used.
      required:
        - sub_account_address
        - symbol
      properties:
        order_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OrderId'
              description: Order ID. Either `order_id` or `order_link_id` is required.
        order_link_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OrderLinkId'
              description: >-
                User-customised order ID. Either `order_id` or `order_link_id`
                is required.
        sub_account_address:
          type: string
        symbol:
          $ref: '#/components/schemas/Symbol'
          description: Symbol name, e.g. `BTC-USDTx`.
    CancelOrderResponse:
      type: object
      description: Acknowledgement of a cancel request.
      properties:
        order_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OrderId'
        order_link_id:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/OrderLinkId'
    OrderId:
      type: string
      format: uuid
    OrderLinkId:
      type: string
    Symbol:
      type: string
      example: BTCUSDC
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer

````

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