> This page is for WebSocket.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://okx-demo.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://okx-demo.ferndocs.com/_mcp/server.

# Batch Cancel Orders

GET /ws/v5/private

Reference: https://okx-demo.ferndocs.com/ws/web-socket-api/batch-cancel-orders/batch-cancel-orders

## AsyncAPI Specification

```yaml
asyncapi: 2.6.0
info:
  title: Batch Cancel Orders
  version: subpackage_batch-cancel-orders.batch-cancel-orders
channels:
  /ws/v5/private:
    publish:
      operationId: subpackage_batch-cancel-orders.batch-cancel-orders-publish
      summary: Server message
      message:
        name: subscribe
        payload:
          $ref: '#/components/schemas/batchCancelOrders_BatchCancelOrdersResponse'
    subscribe:
      operationId: subpackage_batch-cancel-orders.batch-cancel-orders-subscribe
      summary: Client message
      message:
        name: publish
        payload:
          $ref: '#/components/schemas/batchCancelOrders_BatchCancelOrdersRequest'
servers:
  Production:
    url: wss://ws.okx.com:8443/
    protocol: wss
    x-default: true
components:
  schemas:
    batchCancelOrders_BatchCancelOrdersResult:
      type: object
      properties:
        ordId:
          type: string
          description: Order ID.
        clOrdId:
          type: string
          description: Client-supplied order ID.
        ts:
          type: string
          description: >-
            Timestamp when the cancel request processing finished, Unix
            timestamp in ms.
        sCode:
          type: string
          description: Per-order result code. 0 means success.
        sMsg:
          type: string
          description: Per-order rejection or success message.
      title: BatchCancelOrdersResult
    batchCancelOrders_BatchCancelOrdersResponse:
      type: object
      properties:
        id:
          type: string
        op:
          type: string
        code:
          type: string
          description: 0 = success.
        msg:
          type: string
        data:
          type: array
          items:
            $ref: '#/components/schemas/batchCancelOrders_BatchCancelOrdersResult'
      required:
        - id
        - op
        - code
        - msg
        - data
      title: BatchCancelOrdersResponse
    batchCancelOrders_BatchCancelOrdersArgs:
      type: object
      properties:
        instId:
          type: string
          description: >-
            Instrument ID, e.g. BTC-USDT. Deprecated for WS cancel; ignored if
            sent.
        ordId:
          type: string
          description: Order ID. Either ordId or clOrdId is required per entry.
        clOrdId:
          type: string
          description: Client-supplied order ID.
      title: BatchCancelOrdersArgs
    batchCancelOrders_BatchCancelOrdersRequest:
      type: object
      properties:
        id:
          type: string
          description: Unique client-supplied request ID.
        op:
          type: string
          description: Operation.
        args:
          type: array
          items:
            $ref: '#/components/schemas/batchCancelOrders_BatchCancelOrdersArgs'
          description: Operation arguments.
      required:
        - id
        - op
        - args
      description: >-
        Cancel multiple incomplete orders in one request over the WebSocket. The
        args are an array of cancel objects (each with ordId or clOrdId),
        maximum 20 per request, and may span different instruments. The response
        data is an array of cancel results.
      title: BatchCancelOrdersRequest

```