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

> ## Agent Instructions
> To integrate AGG, start with Quickstart: REST (https://docs.agg.market/quickstart/rest), then Order lifecycle & statuses (https://docs.agg.market/concepts/order-lifecycle).
> Track every trade until it reaches a terminal status. Before retrying a failed or timed-out call, read Errors, retries & idempotency (https://docs.agg.market/concepts/errors).
> The API reference is generated from https://docs.agg.market/openapi/openapi.json.

# Cancel an order

> Send `orderId` to cancel an agg order (same behaviour as the deprecated `/execution/orders/{orderId}/cancel`). Send `venue`, `venueOrderId`, `signerAddress` and `cancelSignature` to cancel a Polymarket or Hyperliquid limit order that one of your linked self-custody wallets placed outside AGG. `signerAddress` must be a wallet linked to this user and must be the wallet that produced `cancelSignature`. For an external order AGG reads the order from the venue, cancels it, and only after the venue confirms records it as a `cancelled` order; the returned `orderIds[0]` appears in `GET /execution/orders?orderId=<id>`. Fills that happened before the cancel are not recorded by AGG. An order that is already filled, cancelled or not owned by the wallet returns 409.



## OpenAPI

````yaml /openapi/openapi.json post /execution/orders/cancel
openapi: 3.0.2
info:
  title: AGG API
  version: 1.0.0
  description: >-
    Prediction market aggregator REST API — authentication, users, venue events,
    venue markets, orderbooks, charts, and execution workflows.
servers:
  - url: https://api.agg.market
    description: Production
security: []
tags:
  - name: Authentication
    description: Sign users in and manage their session tokens.
  - name: Markets
    description: Find events, markets and outcomes to trade.
  - name: Market Data
    description: Live orderbooks, prices, charts and scores for those markets.
  - name: Trading
    description: Quote, place, sign, track and cancel orders.
  - name: Portfolio
    description: A user's orders, positions, balances and activity.
  - name: Funding
    description: Deposit addresses, withdrawals, balance refills and fiat on-ramp.
  - name: Users
    description: The signed-in user's profile, linked accounts, KYC and venue keys.
  - name: Hosted Venue Accounts
    description: Provision, fund and withdraw from venue accounts hosted for the user.
  - name: Webhooks
    description: Configure and operate webhook delivery to your server.
  - name: Partner Admin
    description: Server-side reads across your app's users, orders and analytics.
  - name: Paper Trading
    description: Simulated accounts and orders for testing without real funds.
  - name: News
    description: News feeds linked to markets.
  - name: Correlated Markets
    description: Markets related to a given market and the effect of its resolution.
paths:
  /execution/orders/cancel:
    post:
      tags:
        - Trading
      summary: Cancel an order
      description: >-
        Send `orderId` to cancel an agg order (same behaviour as the deprecated
        `/execution/orders/{orderId}/cancel`). Send `venue`, `venueOrderId`,
        `signerAddress` and `cancelSignature` to cancel a Polymarket or
        Hyperliquid limit order that one of your linked self-custody wallets
        placed outside AGG. `signerAddress` must be a wallet linked to this user
        and must be the wallet that produced `cancelSignature`. For an external
        order AGG reads the order from the venue, cancels it, and only after the
        venue confirms records it as a `cancelled` order; the returned
        `orderIds[0]` appears in `GET /execution/orders?orderId=<id>`. Fills
        that happened before the cancel are not recorded by AGG. An order that
        is already filled, cancelled or not owned by the wallet returns 409.
      operationId: cancelOrder
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
                - additionalProperties: false
                  type: object
                  required:
                    - orderId
                  properties:
                    orderId:
                      minLength: 1
                      type: string
                    cancelSignature:
                      anyOf:
                        - additionalProperties: false
                          description: >-
                            Self-custody Polymarket limit orders only; omit it
                            for managed orders. An EIP-712 signature by the
                            order's signing wallet (the `signingAddress` the
                            order was placed with) over Polymarket's CLOB L1
                            auth message: domain `{ name: "ClobAuthDomain",
                            version: "1", chainId: 137 }`, primary type
                            `ClobAuth` with fields `address` (address),
                            `timestamp` (string), `nonce` (uint256), `message`
                            (string), where `address` is the signing wallet,
                            `timestamp` is the `timestamp` below encoded as a
                            decimal string, `nonce` is 0, and `message` is "This
                            message attests that I control the given wallet".
                            Ask the user to sign when they cancel. The signature
                            is never persisted or logged. The CLOB credentials
                            derived from it are used only for this request and
                            are not stored.
                          type: object
                          required:
                            - signature
                            - timestamp
                          properties:
                            signature:
                              pattern: ^0x[0-9a-fA-F]{130}$
                              description: >-
                                A 65-byte hex signature (`0x` + 130 hex
                                characters).
                              type: string
                            timestamp:
                              minimum: 0
                              description: >-
                                Unix seconds — the value that was signed. Use
                                the current time. Rejected if more than 480
                                seconds in the future; Polymarket rejects one
                                older than about two minutes.
                              type: integer
                        - additionalProperties: false
                          description: >-
                            Hyperliquid cancellation signed by the linked EOA or
                            its currently approved agg agent. Sign the
                            single-order cancel action using the Hyperliquid L1
                            action signer, with nonce Date.now(). The asset and
                            order ID must match this order. Never send the
                            private key.
                          type: object
                          required:
                            - venue
                            - action
                            - nonce
                            - signature
                          properties:
                            venue:
                              type: string
                              enum:
                                - hyperliquid
                            action:
                              additionalProperties: false
                              type: object
                              required:
                                - type
                                - cancels
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - cancel
                                cancels:
                                  minItems: 1
                                  maxItems: 1
                                  type: array
                                  items:
                                    additionalProperties: false
                                    type: object
                                    required:
                                      - a
                                      - o
                                    properties:
                                      a:
                                        minimum: 0
                                        maximum: 9007199254740991
                                        type: integer
                                      o:
                                        minimum: 1
                                        maximum: 9007199254740991
                                        type: integer
                            nonce:
                              minimum: 1
                              maximum: 9007199254740991
                              type: integer
                            signature:
                              additionalProperties: false
                              type: object
                              required:
                                - r
                                - s
                                - v
                              properties:
                                r:
                                  pattern: ^0x[0-9a-fA-F]{64}$
                                  type: string
                                s:
                                  pattern: ^0x[0-9a-fA-F]{64}$
                                  type: string
                                v:
                                  type: number
                                  enum:
                                    - 27
                                    - 28
                - additionalProperties: false
                  type: object
                  required:
                    - venue
                    - venueOrderId
                    - signerAddress
                    - cancelSignature
                  properties:
                    venue:
                      type: string
                      enum:
                        - polymarket
                        - hyperliquid
                    venueOrderId:
                      minLength: 1
                      maxLength: 128
                      type: string
                    signerAddress:
                      pattern: ^0x[0-9a-fA-F]{40}$
                      type: string
                    cancelSignature:
                      anyOf:
                        - additionalProperties: false
                          description: >-
                            Self-custody Polymarket limit orders only; omit it
                            for managed orders. An EIP-712 signature by the
                            order's signing wallet (the `signingAddress` the
                            order was placed with) over Polymarket's CLOB L1
                            auth message: domain `{ name: "ClobAuthDomain",
                            version: "1", chainId: 137 }`, primary type
                            `ClobAuth` with fields `address` (address),
                            `timestamp` (string), `nonce` (uint256), `message`
                            (string), where `address` is the signing wallet,
                            `timestamp` is the `timestamp` below encoded as a
                            decimal string, `nonce` is 0, and `message` is "This
                            message attests that I control the given wallet".
                            Ask the user to sign when they cancel. The signature
                            is never persisted or logged. The CLOB credentials
                            derived from it are used only for this request and
                            are not stored.
                          type: object
                          required:
                            - signature
                            - timestamp
                          properties:
                            signature:
                              pattern: ^0x[0-9a-fA-F]{130}$
                              description: >-
                                A 65-byte hex signature (`0x` + 130 hex
                                characters).
                              type: string
                            timestamp:
                              minimum: 0
                              description: >-
                                Unix seconds — the value that was signed. Use
                                the current time. Rejected if more than 480
                                seconds in the future; Polymarket rejects one
                                older than about two minutes.
                              type: integer
                        - additionalProperties: false
                          description: >-
                            Hyperliquid cancellation signed by the linked EOA or
                            its currently approved agg agent. Sign the
                            single-order cancel action using the Hyperliquid L1
                            action signer, with nonce Date.now(). The asset and
                            order ID must match this order. Never send the
                            private key.
                          type: object
                          required:
                            - venue
                            - action
                            - nonce
                            - signature
                          properties:
                            venue:
                              type: string
                              enum:
                                - hyperliquid
                            action:
                              additionalProperties: false
                              type: object
                              required:
                                - type
                                - cancels
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - cancel
                                cancels:
                                  minItems: 1
                                  maxItems: 1
                                  type: array
                                  items:
                                    additionalProperties: false
                                    type: object
                                    required:
                                      - a
                                      - o
                                    properties:
                                      a:
                                        minimum: 0
                                        maximum: 9007199254740991
                                        type: integer
                                      o:
                                        minimum: 1
                                        maximum: 9007199254740991
                                        type: integer
                            nonce:
                              minimum: 1
                              maximum: 9007199254740991
                              type: integer
                            signature:
                              additionalProperties: false
                              type: object
                              required:
                                - r
                                - s
                                - v
                              properties:
                                r:
                                  pattern: ^0x[0-9a-fA-F]{64}$
                                  type: string
                                s:
                                  pattern: ^0x[0-9a-fA-F]{64}$
                                  type: string
                                v:
                                  type: number
                                  enum:
                                    - 27
                                    - 28
            example:
              orderId: cmf3r1a2b00c4mw0lq8y7e3uj
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                required:
                  - quoteId
                  - orderIds
                  - status
                properties:
                  quoteId:
                    description: >-
                      Quote whose orders were cancelled. `null` for limit orders
                      and for orders placed directly on the venue.
                    type: string
                    nullable: true
                  orderIds:
                    description: >-
                      Ids of the affected orders. Can be empty for a venue order
                      AGG did not know.
                    type: array
                    items:
                      type: string
                  status:
                    description: >-
                      `cancelled`: done. `cancel_pending`: the venue has not
                      confirmed yet; the order moves to `cancelled` (or fills)
                      later.
                    type: string
                    enum:
                      - cancelled
                      - cancel_pending
              example:
                quoteId: null
                orderIds:
                  - cmf3r1a2b00c4mw0lq8y7e3uj
                status: cancelled
        '400':
          description: '400'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: '401'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: '403'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: '404'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: '409'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      security:
        - appId: []
          bearerAuth: []
components:
  schemas:
    ErrorMessage:
      type: object
      required:
        - message
      properties:
        message:
          type: string
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: x-app-id
      description: Your application ID. Required for all app-tier and user-tier routes.
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT access token returned by POST /auth/verify. Required for user-tier
        routes.

````