Skip to content
Docs
Open Legend

About

AboutGetting startedWhat is Legend?Why are we building this?Who is this for?

Platform

Web appiOSAndroidTelegram

Trading

TradingOrder typesDeposits and withdrawalsRanks

Capital

Legend CapitalCapital Affiliate Rewards

Autocopy

Copy tradingAutocopyLimits and safeguards

Social

SocialActivityFeedClansChat

Rewards

Referrals and rewards

API reference

Trading APIAuthentication and API keysAPI key actionsOrdersAccount, positions, and fillsLeverage, margin, and TWAPsRate limitsErrors and idempotency

Legend Research

Connect Legend to an AI assistantConnector permissionsMCP tools and order review

Fees

Fees

Support

FAQ
Trade onLEGEND

Trade where legends are made.

Download on theApp StoreGet it onGoogle Play
Product
TradeMobile app
Resources
BlogLearnFAQDocsCareers
© 2026 Legend. All rights reserved.
Privacy policyTerms of service
Ctrl K

Legend documentation

Trading API

Trade through Legend with account-scoped API keys.

View Markdown ↗
Referrals and rewardsPreviousAuthentication and API keysNext

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 /v1/*. API-key registration, revocation, orders, account reads, and execution actions all use /v1. The machine-readable contract is at /v1/openapi.json.

Breaking API changes require a new major path version. The documentation below describes v1.

https://trading-api.legend.trade/v1

Existing integrations using https://app.legend.trade/api/trading/v1 remain supported. API keys and wallet-signing audiences are unchanged.

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.

export LEGEND_API_BASE="https://trading-api.legend.trade"

curl "$LEGEND_API_BASE/v1/account" \
  -H "Authorization: Bearer $LEGEND_API_KEY"

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. Insignificant trailing zeros are removed before storing and signing orders: BTC "81000.0" becomes "81000", and size "0.0001300" becomes "0.00013". This also applies to trigger prices and TWAP sizes.
  • 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.

Price and size precision

Follow Hyperliquid’s tick and lot size rules: prices have at most five significant figures and at most 6 - szDecimals decimal places for perpetuals, or 8 - szDecimals for spot. Integer prices are always valid. Sizes have at most szDecimals decimal places, using the market’s metadata; HIP-3 markets follow the same perpetual rules.

Normalization removes redundant zeros without changing the value. Off-tick prices and off-lot sizes return invalid_precision; the API does not silently round a requested price or size. For example, BTC "81000.1" exceeds five significant figures and is rejected. Use plain decimal strings, without scientific notation.

Retry an action with the same Idempotency-Key and the exact original request body, even if the response uses normalized decimal strings.

Assistant integrations

For Muse API integration and the ChatGPT/Claude MCP preview, see assistant connectors. Host availability and permissions differ from direct API access.