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

# Cancel order

> Prepare an order cancellation.

Returns EIP-712 typed data for the user to sign. After signing, submit
the signature via the /execute endpoint.



## OpenAPI

````yaml /v2/combined_spec.json post /v2/global_markets_perps/cancel_order
openapi: 3.1.0
info:
  title: Compass API
  description: Compass Labs DeFi API
  version: 0.0.1
servers:
  - url: https://api.compasslabs.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v2/global_markets_perps/cancel_order:
    post:
      tags:
        - Global Markets Perps
      summary: Cancel order
      description: |-
        Prepare an order cancellation.

        Returns EIP-712 typed data for the user to sign. After signing, submit
        the signature via the /execute endpoint.
      operationId: v2_global_markets_perps_cancel_order
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GlobalMarketsPerpsCancelOrderRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GlobalMarketsPerpsSignableActionResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: python
          label: Python (SDK)
          source: |-
            from compass_api_sdk import CompassAPI


            with CompassAPI(
                api_key_auth="<YOUR_API_KEY_HERE>",
            ) as compass_api:

                res = compass_api.global_markets_perps.global_markets_perps_cancel_order(owner="0x06A9aF046187895AcFc7258450B15397CAc67400", asset="AAPL", order_id=12345)

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (SDK)
          source: |-
            import { CompassApiSDK } from "@compass-labs/api-sdk";

            const compassApiSDK = new CompassApiSDK({
              apiKeyAuth: "<YOUR_API_KEY_HERE>",
            });

            async function run() {
              const result = await compassApiSDK.globalMarketsPerps.globalMarketsPerpsCancelOrder({
                owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
                asset: "AAPL",
                orderId: 12345,
              });

              console.log(result);
            }

            run();
components:
  schemas:
    GlobalMarketsPerpsCancelOrderRequest:
      properties:
        owner:
          type: string
          title: Owner
          description: Owner of the global markets perps product account
          default: '0x06A9aF046187895AcFc7258450B15397CAc67400'
          examples:
            - '0x06A9aF046187895AcFc7258450B15397CAc67400'
        asset:
          type: string
          title: Asset
          description: Asset ticker symbol (e.g. AAPL, GOLD, EUR)
          default: AAPL
          examples:
            - AAPL
        order_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Order Id
          description: Hyperliquid order ID to cancel
          default: 12345
          examples:
            - 12345
        client_order_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Client Order Id
          description: Client order ID to cancel (alternative to order_id)
      type: object
      required:
        - owner
        - asset
      title: GlobalMarketsPerpsCancelOrderRequest
      description: Request to cancel an open order on a global markets perps market.
      default:
        owner: '0x06A9aF046187895AcFc7258450B15397CAc67400'
        asset: AAPL
        order_id: 12345
    GlobalMarketsPerpsSignableActionResponse:
      properties:
        typed_data:
          additionalProperties: true
          type: object
          title: Typed Data
          description: >-
            EIP-712 typed data for wallet signing (domain, types, primaryType,
            message)
        action:
          additionalProperties: true
          type: object
          title: Action
          description: Raw Hyperliquid action (passed back to the execute endpoint)
        nonce:
          type: integer
          title: Nonce
          description: Timestamp-based nonce used during signing
      type: object
      required:
        - typed_data
        - action
        - nonce
      title: GlobalMarketsPerpsSignableActionResponse
      description: >-
        Returned by prepare endpoints — contains EIP-712 typed data for the user
        to sign.
      example:
        action:
          grouping: na
          orders:
            - a: 12
              b: true
              p: '213.50'
              r: false
              s: '5.00'
              t:
                limit:
                  tif: Gtc
          type: order
        nonce: 1747010983250
        typed_data:
          domain:
            chainId: 1337
            name: Exchange
            verifyingContract: '0x0000000000000000000000000000000000000000'
            version: '1'
          message:
            connectionId: '0xc4e1f04d6b1bf2f2f7a6c0e8a5f3b1d2c9e0a4b7d1c3e5f7a9b1d3e5f7a9e9a2'
            source: a
          primaryType: Agent
          types:
            Agent:
              - name: source
                type: string
              - name: connectionId
                type: bytes32
            EIP712Domain:
              - name: name
                type: string
              - name: version
                type: string
              - name: chainId
                type: uint256
              - name: verifyingContract
                type: address
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Your Compass API Key. Get your key
        [here](https://www.compasslabs.ai/dashboard).

````