curl "$LEGEND_API_BASE/v1/account" \
-H "Authorization: Bearer $LEGEND_API_KEY"
Legend documentation
Request parameters and responses for account, positions, and fills.
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.
GET /v1/account
Requires trading:read.
curl "$LEGEND_API_BASE/v1/account" \
-H "Authorization: Bearer $LEGEND_API_KEY"
| Field | Type | Required | Details |
|---|---|---|---|
object | string | Yes | account |
account | string | Yes | Format: uuid |
network | string | Yes | hyperliquid_mainnet |
user | object | Yes | Account owner ID, username, and display name. |
balance_mode | string | Yes | unified |
equity | string | Yes | Unified net worth; perpetual PnL is already included. |
cash | string | Yes | Spot USDC total. |
available_to_trade_estimate | string | Yes | max(0, USDC total - hold); an estimate. |
display | object | Yes | Formatted text for display; never use as order inputs. |
withdrawable | string | Yes | |
margin_used | string | Yes | |
perpetuals | array | Yes | Per-DEX balances; each entry includes dex, equity, withdrawable, and margin_used. |
spot | array | Yes | Spot 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" }]
}
GET /v1/positions
Requires trading:read.
| Name | Location | Required | Type |
|---|---|---|---|
dex | query | No | string |
cursor | query | No | string |
limit | query | No | integer |
curl "$LEGEND_API_BASE/v1/positions" \
-H "Authorization: Bearer $LEGEND_API_KEY"
| Field | Type | Required | Details |
|---|---|---|---|
object | string | Yes | list |
data | array | Yes | |
has_more | boolean | Yes | |
next_cursor | string or null | Yes |
See the OpenAPI schema for nested response objects and validation patterns.
Illustrative successful response:
{
"object": "list",
"data": [],
"has_more": false,
"next_cursor": null
}
GET /v1/fills
Requires trading:read.
| Name | Location | Required | Type |
|---|---|---|---|
limit | query | No | integer |
cursor | query | No | string |
curl "$LEGEND_API_BASE/v1/fills" \
-H "Authorization: Bearer $LEGEND_API_KEY"
| Field | Type | Required | Details |
|---|---|---|---|
object | string | Yes | list |
data | array | Yes | |
has_more | boolean | Yes | |
next_cursor | string or null | Yes |
See the OpenAPI schema for nested response objects and validation patterns.
Illustrative successful response:
{
"object": "list",
"data": [],
"has_more": false,
"next_cursor": null
}