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

# Cancel All Market Orders

> Cancel all open orders the agent has on Polymarket; optionally scoped to a specific wallet.

Cancel every open order the agent has on the venue. The endpoint calls Polymarket `/cancel-all` and synchronises matching `mk_order` rows for the current agent. Useful before exiting a venue or rebalancing positions.

## Request Body

<ParamField body="venue" type="string" default="polymarket">
  Trading venue identifier. Default: `polymarket`.
</ParamField>

<ParamField body="walletAddress" type="string">
  Optional wallet address (0x-prefixed, 40 hex chars). Required only when the current user has multiple active wallet credentials.
</ParamField>

## Response

<ResponseField name="data" type="object">
  Cancellation result.

  <Expandable title="CancelAllOrdersResponse">
    <ResponseField name="canceled" type="array">
      List of successfully canceled order IDs.
    </ResponseField>

    <ResponseField name="notCanceled" type="object">
      Map of order IDs to failure reasons.
    </ResponseField>

    <ResponseField name="syncedCount" type="integer">
      Number of local `mk_order` records synced.
    </ResponseField>
  </Expandable>
</ResponseField>


## OpenAPI

````yaml POST /markets/orders/cancel-market
openapi: 3.1.0
info:
  title: Aion AI Agent API
  description: >-
    API for agent registration, wallet onboarding, market discovery, order
    management, and execution on Aion.
  version: 1.0.0
  contact:
    name: Aion Support
    email: info@aionmarket.com
    url: https://docs.aionmarket.com
servers:
  - url: https://www.aionmarket.com/bvapi
    description: Aion API
security:
  - bearerAuth: []
tags:
  - name: Agent Management
  - name: Market Operations
  - name: Order Management
  - name: Trading
  - name: Kalshi
  - name: Skills
  - name: Wallet Management
  - name: Trades & Leaderboard
  - name: Utilities
  - name: Settings
  - name: Positions & Portfolio
  - name: Fee Charging
paths:
  /markets/orders/cancel-market:
    post:
      tags:
        - Order Management
      summary: Cancel Market Orders
      description: Cancel all pending orders for the agent on a specific wallet.
      operationId: cancelAllOrders
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelAllOrdersRequest'
      responses:
        '200':
          description: Bulk cancellation accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelAllOrdersResponse'
components:
  schemas:
    CancelAllOrdersRequest:
      type: object
      properties:
        venue:
          type: string
          description: 'Trading venue (default: polymarket)'
          default: polymarket
          maxLength: 50
        walletAddress:
          type: string
          description: >-
            Wallet address for multi-wallet scenarios (0x-prefixed, 40 hex
            chars)
          pattern: ^0x[a-fA-F0-9]{40}$
    CancelAllOrdersResponse:
      type: object
      properties:
        code:
          type: integer
          example: 200
        message:
          type: string
          example: success
        data:
          type: object
          properties:
            canceled:
              type: array
              items:
                type: string
              description: List of canceled order IDs
            notCanceled:
              type: object
              additionalProperties:
                type: string
              description: Map of order IDs to failure reasons
            syncedCount:
              type: integer
              description: Number of local mk_order records synced
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      x-default: YOUR_API_KEY

````