# Otto AI x402 — Trade Perpetuals

> Otto AI x402 — Trade Perpetuals is a paid API for AI agents from x402.ottoai.services, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Opens a leveraged perpetual futures position on Hyperliquid with optional take-profit and stop-loss orders via x402 micropayment

## Facts

- Endpoint: POST https://x402.ottoai.services/trade-perpetuals
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/otto-ai-x402-trade-perpetuals-7404a8f9
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_kkKqUcb8xzhE8qWlCMamj

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 otto-ai-x402-trade-perpetuals-7404a8f9 -d '<json body>'
```

Example prompt: Open a long BTC perpetual position on Hyperliquid for me — set the take-profit at $72,000 and the stop-loss at $64,000, and pay for the call with USDC on Base.

## When to prefer this

Use this endpoint when you need to programmatically execute a leveraged perpetual futures trade on Hyperliquid with optional risk management orders (TP/SL) in a single atomic call, paying per-use via USDC micropayment on Base, Polygon, or Solana. Prefer this over manual Hyperliquid interaction when automating trading strategies or building agent-driven DeFi workflows.

## Known failure modes

- Insufficient margin or collateral in Otto AI Safe account — returns error indicating underfunded account
- Invalid asset symbol or unsupported perpetual market — returns error or empty response
- Hyperliquid API downtime or connectivity issue — returns upstream service error
- x402 payment failure due to insufficient USDC balance — returns 402 payment required error
- Invalid side parameter (not long or short) — returns validation error
- Stop-loss price above entry for long or below entry for short — may return order rejection

## How this service works

Open leveraged perpetual positions on Hyperliquid with optional native TP/SL trigger orders. Min notional $10. Max leverage varies by asset (BTC 40x, ETH 25x, SOL 20x). Supports BTC, ETH, SOL, and 100+ other markets.

## Output

Returns a JSON object confirming the trade was placed, including the main order ID, take-profit order ID, stop-loss order ID, the asset traded (e.g. BTC), the side (long or short), the entry price achieved, and a success boolean.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "side": {
   "enum": [
    "long",
    "short"
   ],
   "type": "string",
   "description": "Position direction"
  },
  "size": {
   "type": "number",
   "description": "Notional size in USDC (NOT margin). For '$10 margin at 25x', use size=250. Required — an omitted size is rejected, never defaulted."
  },
  "asset": {
   "type": "string",
   "description": "Asset ticker (BTC, ETH, SOL, etc.). HIP-3 stock perps also accept 'xyz:TSLA' form."
  },
  "leverage": {
   "type": "number",
   "description": "Leverage multiplier (1-40 depending on asset)"
  },
  "stopLoss": {
   "type": "object",
   "properties": {
    "price": {
     "type": "number",
     "description": "SL as an absolute price level"
    },
    "percentage": {
     "type": "number",
     "description": "SL as a percentage loss from entry (e.g. 5 = -5%)"
    }
   },
   "description": "Optional stop-loss trigger. Provide EITHER percentage OR price, not both."
  },
  "orderType": {
   "enum": [
    "market",
    "limit"
   ],
   "type": "string",
   "description": "Default: market."
  },
  "limitPrice": {
   "type": "number",
   "description": "Required when orderType is 'limit'."
  },
  "marginMode": {
   "enum": [
    "cross",
    "isolated"
   ],
   "type": "string",
   "description": "Default: cross. Stock perps (xyz DEX) are always isolated."
  },
  "takeProfit": {
   "type": "object",
   "properties": {
    "price": {
     "type": "number",
     "description": "TP as an absolute price level"
    },
    "percentage": {
     "type": "number",
     "description": "TP as a percentage gain from entry (e.g. 10 = +10%)"
    }
   },
   "description": "Optional take-profit trigger. Provide EITHER percentage OR price, not both."
  },
  "userAddress": {
   "type": "string",
   "description": "Optional for external x402 callers — the operated account is your verified payment payer, not this field. Internal/dApp callers must send a valid EVM address."
  },
  "stopLossPrice": {
   "type": "number",
   "description": "Alias for stopLoss.price. Send exactly one of the two — supplying stopLoss and stopLossPrice together is rejected, including when their values are equal."
  },
  "takeProfitPrice": {
   "type": "number",
   "description": "Alias for takeProfit.price. Send exactly one of the two — supplying takeProfit and takeProfitPrice together is rejected, including when their values are equal."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "side": "long",
  "asset": "BTC",
  "entry": {
   "side": "long",
   "size": 250,
   "orderId": "12345",
   "outcome": "filled",
   "leverage": 25,
   "orderType": "market",
   "entryPrice": 67000,
   "filledSize": 0.0037,
   "marginMode": "cross",
   "positionOpen": true,
   "amountConfirmed": true,
   "sizeInContracts": 0.0037,
   "requestedNotional": 250,
   "requestedSizeInContracts": 0.0037
  },
  "status": "partial",
  "message": "Entry filled; stop-loss unconfirmed — verify with /modify-hl-order.",
  "orderId": "12345",
  "tpOrderId": "12346",
  "entryPrice": 67000,
  "protection": {
   "legs": [
    {
     "leg": "takeProfit",
     "state": "resting",
     "orderId": "12346"
    },
    {
     "leg": "stopLoss",
     "state": "unknown",
     "detail": "Venue did not confirm; order list unread."
    }
   ],
   "failed": [],
   "filled": [],
   "placed": [
    "takeProfit"
   ],
   "unknown": [
    "stopLoss"
   ],
   "requested": [
    "takeProfit",
    "stopLoss"
   ],
   "actionRequired": true
  },
  "action_required": true
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/otto-ai-x402-trade-perpetuals-7404a8f9/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.ottoai.services](https://www.zero.xyz/host/x402.ottoai.services/llms.txt)
