> ## 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.

# Execute signed action

> Submit a signed Hyperliquid action for execution.

Accepts the signature from any prepare endpoint (market_order, limit_order,
cancel_order, withdraw, approve_builder_fee) and POSTs it to the Hyperliquid
exchange API.

The caller must have already hit a prepare endpoint, so no compass_account
registration is performed here.



## OpenAPI

````yaml /v2/combined_spec.json post /v2/global_markets_perps/execute
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/execute:
    post:
      tags:
        - Global Markets Perps
      summary: Execute signed action
      description: >-
        Submit a signed Hyperliquid action for execution.


        Accepts the signature from any prepare endpoint (market_order,
        limit_order,

        cancel_order, withdraw, approve_builder_fee) and POSTs it to the
        Hyperliquid

        exchange API.


        The caller must have already hit a prepare endpoint, so no
        compass_account

        registration is performed here.
      operationId: v2_global_markets_perps_execute
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GlobalMarketsPerpsExecuteRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GlobalMarketsPerpsExecuteResponse'
        '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_execute(action={
                    "key": "<value>",
                    "key1": "<value>",
                }, nonce=511479, signature="<value>")

                # 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.globalMarketsPerpsExecute({
                action: {
                  "key": "<value>",
                  "key1": "<value>",
                },
                nonce: 511479,
                signature: "<value>",
              });

              console.log(result);
            }

            run();
components:
  schemas:
    GlobalMarketsPerpsExecuteRequest:
      properties:
        action:
          additionalProperties: true
          type: object
          title: Action
          description: Raw Hyperliquid action from the prepare step
        nonce:
          type: integer
          title: Nonce
          description: Nonce from the prepare step
        signature:
          type: string
          title: Signature
          description: User's EIP-712 signature (hex, 65 bytes)
        vault_address:
          anyOf:
            - type: string
            - type: 'null'
          title: Vault Address
          description: Optional vault address
      type: object
      required:
        - action
        - nonce
        - signature
      title: GlobalMarketsPerpsExecuteRequest
      description: Submit a signed Hyperliquid action for execution.
    GlobalMarketsPerpsExecuteResponse:
      properties:
        status:
          type: string
          title: Status
          description: '''ok'' or ''error'''
        response:
          additionalProperties: true
          type: object
          title: Response
          description: Hyperliquid response data (order statuses, etc.)
      type: object
      required:
        - status
      title: GlobalMarketsPerpsExecuteResponse
      description: Returned after submitting a signed action to the Hyperliquid exchange.
      example:
        response:
          data:
            statuses:
              - resting:
                  oid: 9182734201
          type: order
        status: ok
    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).

````