Skip to main content
Use the Legend Trading API to place, modify, and cancel orders, manage positions, and read your account’s balances and fills.

Base URL

All trading endpoints are versioned under /api/trading/v1/*. API-key registration, revocation, orders, account reads, and execution actions all use /v1. The machine-readable contract is at /api/trading/v1/openapi.json. Breaking API changes require a new major path version. The documentation below describes v1.

Getting started

  1. Sign in to Legend and open Settings → Trading.
  2. Create an API key. Allow trading is on by default; switch it off for read-only access.
  3. Copy the key and store it securely; Legend does not retain the plaintext key.
  4. Send it in the Authorization: Bearer … header. Include a unique Idempotency-Key for each trading action.
Keys remain valid until revoked. Keys can only be created for your main account on mainnet. Revocation prevents future API actions; it does not cancel existing orders or reverse completed trades. Keys cannot withdraw or transfer funds.
Set LEGEND_API_KEY to your API key. Keep credentials out of URLs and logs.

Exchange conventions

  • Prices and sizes are decimal strings, with Hyperliquid market precision rules.
  • gtc, ioc, and alo map to Hyperliquid’s Gtc, Ioc, and Alo time-in-force values.
  • Market execution uses an IOC order with an explicit worst acceptable price. A partially filled IOC may return canceled with a nonzero filled_size.
  • Markets use the venue symbol, including HIP-3 DEX-qualified names. Order retrieval and mutation accept Legend UUIDs or native Hyperliquid order IDs.
  • There are no API-specific notional, position-size, or cumulative trading-volume budgets. Exchange requirements, available margin, and request rate limits still apply.
  • Legend derives the wallet signer from the authenticated account. Callers cannot supply a wallet signer, vault, or arbitrary exchange action.
Read the orders reference, authentication guide, and retry rules. The OpenAPI document contains the full schema. Hyperliquid’s exchange endpoint documentation describes the underlying order and execution semantics.