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

Account, positions, and fills

Request parameters and responses for account, positions, and fills.

View Markdown ↗
OrdersPreviousLeverage, margin, and TWAPsNext

All paths are relative to the base URL. See authentication and errors and idempotency.

Balances include native perpetual, supported HIP-3, and spot balances. Top-level balances describe the unified account: equity is spot USDC plus the mark value of other spot tokens and already includes perpetual PnL. cash is spot USDC, withdrawable is unheld USDC, and margin_used sums margin across supported perpetual DEXes. Do not add perpetual equity or PnL again. available_to_trade_estimate matches the app header estimate; it is not market-specific buying power. The perpetuals array exposes these metrics per DEX ("" for native, "xyz" for XYZ). Do not sum these balances blindly: collateral may be shared across account modes. Positions include all supported DEXes by default; pass ?dex=xyz to select XYZ or ?dex= for native markets only. Fills come from Legend’s indexed history and can lag the venue; they are isolated by user, wallet, and network. Pagination cursors are opaque and must not be edited.

Read account balances

GET /v1/account

Requires trading:read.

Example request

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

Response

FieldTypeRequiredDetails
objectstringYesaccount
accountstringYesFormat: uuid
networkstringYeshyperliquid_mainnet
userobjectYesAccount owner ID, username, and display name.
balance_modestringYesunified
equitystringYesUnified net worth; perpetual PnL is already included.
cashstringYesSpot USDC total.
available_to_trade_estimatestringYesmax(0, USDC total - hold); an estimate.
displayobjectYesFormatted text for display; never use as order inputs.
withdrawablestringYes
margin_usedstringYes
perpetualsarrayYesPer-DEX balances; each entry includes dex, equity, withdrawable, and margin_used.
spotarrayYesSpot token balances.

See the OpenAPI schema for nested response objects and validation patterns.

Illustrative successful response:

{
  "object": "account",
  "account": "00000000-0000-4000-8000-000000000001",
  "network": "hyperliquid_mainnet",
  "user": {
    "id": "00000000-0000-4000-8000-000000000002",
    "username": "trader",
    "display_name": "Trader"
  },
  "balance_mode": "unified",
  "equity": "100",
  "cash": "100",
  "available_to_trade_estimate": "100",
  "display": {
    "equity": "$100.00",
    "cash": "$100.00",
    "margin_used": "$0.00",
    "available_to_trade_estimate": "$100.00",
    "withdrawable": "$100.00"
  },
  "withdrawable": "100",
  "margin_used": "0",
  "perpetuals": [
    { "dex": "", "equity": "100", "withdrawable": "100", "margin_used": "0" },
    { "dex": "xyz", "equity": "0", "withdrawable": "0", "margin_used": "0" }
  ],
  "spot": [{ "token": "USDC", "total": "100", "held": "0" }]
}

Read positions across supported DEXes or filter by DEX

GET /v1/positions

Requires trading:read.

Parameters

NameLocationRequiredType
dexqueryNostring
cursorqueryNostring
limitqueryNointeger

Example request

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

Response

FieldTypeRequiredDetails
objectstringYeslist
dataarrayYes
has_morebooleanYes
next_cursorstring or nullYes

See the OpenAPI schema for nested response objects and validation patterns.

Illustrative successful response:

{
  "object": "list",
  "data": [],
  "has_more": false,
  "next_cursor": null
}

List account fills indexed by Legend

GET /v1/fills

Requires trading:read.

Parameters

NameLocationRequiredType
limitqueryNointeger
cursorqueryNostring

Example request

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

Response

FieldTypeRequiredDetails
objectstringYeslist
dataarrayYes
has_morebooleanYes
next_cursorstring or nullYes

See the OpenAPI schema for nested response objects and validation patterns.

Illustrative successful response:

{
  "object": "list",
  "data": [],
  "has_more": false,
  "next_cursor": null
}