# ChainHilt Hyperliquid Perp Leverage Preview

> ChainHilt Hyperliquid Perp Leverage Preview is a paid API for AI agents from chainhilt.ai, paid per call via x402, $0.001/call, status unknown (last checked 2026-11-16).

Generates an unsigned EIP-712 typed-data payload to update cross or isolated leverage for a Hyperliquid perpetual asset, ready for L1 signing and submission.

## Facts

- Endpoint: POST https://chainhilt.ai/api/v1/perp/hyperliquid/leverage/preview?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-16
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/chainhilt-hyperliquid-perp-leverage-preview-ce6c467d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_mXGBI2AQ_MT6-2hLvTmY2

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability chainhilt-hyperliquid-perp-leverage-preview-ce6c467d -d '<json body>'
```

Example prompt: Prepare a leverage update for Hyperliquid perp asset 0 — set it to 5x cross margin using my account 0x1234...abcd so I can sign and submit it.

## When to prefer this

Use this endpoint when you need to change cross/isolated margin mode or leverage level for a Hyperliquid perpetual asset via an agent that holds an EIP-712 signing key. It is a preview-only step (no state change until execute is called), making it safe for validation before committing. Prefer this over direct exchange API calls when operating under x402 micropayment auth and no API key management is desired.

## Known failure modes

- 400 Bad Request — invalid input such as leverage <= 0, missing required fields, or malformed address
- 422 Unprocessable Entity — exchange rejected the action (e.g. leverage exceeds market maximum)
- 502 Bad Gateway — upstream Hyperliquid provider failure or timeout

## How this service works

Discover, pay for, and execute the on-chain actions your agent needs. No API keys. Compatible with x402. Your wallet stays local.

## Output

Returns an EIP-712 typed-data object (domain, types, message, primaryType) bundled with the original action payload and a submitPath pointing to /perp/hyperliquid/leverage/execute. The agent must sign this typed data unchanged and POST it to the execute endpoint to apply the leverage change on-chain. Any validation errors or exchange rejections are surfaced in the errors array before signing occurs.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "nonce": {
   "type": "integer",
   "minimum": 0,
   "description": "Action nonce in milliseconds since the epoch; defaults to the current time."
  },
  "action": {
   "type": "object",
   "required": [
    "type",
    "asset",
    "isCross",
    "leverage"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "updateLeverage",
     "description": "Always \"updateLeverage\"."
    },
    "asset": {
     "type": "integer",
     "minimum": 0,
     "description": "Perp asset ID"
    },
    "isCross": {
     "type": "boolean",
     "description": "true for cross margin, false for isolated."
    },
    "leverage": {
     "type": "integer",
     "description": "Integer leverage; market limits apply",
     "exclusiveMinimum": 0
    }
   },
   "description": "Leverage update action.",
   "additionalProperties": false
  },
  "expiresAfter": {
   "type": "integer",
   "minimum": 0,
   "description": "Millisecond timestamp after which Hyperliquid rejects the action. Signed with the action."
  },
  "vaultAddress": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]{40}$",
   "description": "Vault or subaccount to act for; omit to act for the signer. Signed with the action."
  },
  "accountAddress": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]{40}$",
   "description": "Signing account's address, returned as response metadata; not part of the signed action."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "response": {
   "errors": [],
   "actions": [
    {
     "data": {
      "nonce": 1710000000000,
      "action": {
       "type": "updateLeverage",
       "asset": 0,
       "isCross": true,
       "leverage": 5
      },
      "typedData": {
       "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"
         }
        ]
       },
       "domain": {
        "name": "Exchange",
        "chainId": 1337,
        "version": "1",
        "verifyingContract": "0x0000000000000000000000000000000000000000"
       },
       "message": {
        "source": "a",
        "connectionId": "0x1b6c24cfbc406e6ceef5dfa941dcdabe39aa07e6fe967545327c1c4c29bc8b20"
       },
       "primaryType": "Agent"
      }
     },
     "type": "signature",
     "chainId": 42161,
     "protocol": "hyperliquid",
     "submitPath": "/perp/hyperliquid/leverage/execute"
    }
   ],
   "warnings": []
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/chainhilt-hyperliquid-perp-leverage-preview-ce6c467d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from chainhilt.ai](https://www.zero.xyz/host/chainhilt.ai/llms.txt)
