> For the complete documentation index, see [llms.txt](https://docs.lighter.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lighter.xyz/api/account/account.md).

# account

Get account by an account's index, or L1 address

```json
{"openapi":"3.0.0","info":{"title":"Lighter API","version":"1.0.0"},"tags":[{"name":"account"}],"servers":[{"url":"https://mainnet.zklighter.elliot.ai","description":"Lighter mainnet"},{"url":"https://testnet.zklighter.elliot.ai","description":"Lighter testnet"},{"url":"https://api.rh.lighter.xyz","description":"Lighter on Robinhood Chain mainnet"},{"url":"https://api.rh-testnet.lighter.xyz","description":"Lighter on Robinhood Chain testnet"}],"paths":{"/api/v1/account":{"get":{"summary":"account","operationId":"account","tags":["account"],"description":"Get account by an account's index, or L1 address","parameters":[{"name":"by","in":"query","required":true,"schema":{"type":"string","enum":["index","l1_address"]},"description":"Field used to identify the requested record."},{"name":"value","in":"query","required":true,"schema":{"type":"string"},"description":"Identifier corresponding to the selected by field."},{"name":"active_only","in":"query","required":false,"description":"Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position.","schema":{"type":"boolean","default":false}},{"name":"cursor","in":"query","required":false,"schema":{"type":"string"},"description":"Opaque pagination cursor returned by the previous response; pass it unchanged."}],"responses":{"200":{"description":"A successful response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DetailedAccounts"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultCode"}}}}}}}},"components":{"schemas":{"DetailedAccounts":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"},"total":{"type":"integer","format":"int64"},"accounts":{"type":"array","items":{"$ref":"#/components/schemas/DetailedAccount"}},"next_cursor":{"type":"string"}},"title":"DetailedAccounts","required":["code","total","accounts"],"description":"Fields with zero or empty values may be omitted; handle optional properties when decoding responses."},"DetailedAccount":{"type":"object","properties":{"code":{"type":"integer","format":"int32","description":"Legacy nested result field; nested account items normally return code 0, unlike the top-level response."},"message":{"type":"string","description":"Legacy nested result field; nested account items normally return code 0, unlike the top-level response."},"account_type":{"type":"integer","format":"uint8"},"account_trading_mode":{"type":"integer","format":"uint8","description":"Classic=0 and Unified=1"},"index":{"type":"integer","format":"int64"},"l1_address":{"type":"string"},"cancel_all_time":{"type":"integer","format":"int64"},"total_order_count":{"type":"integer","format":"int64"},"total_isolated_order_count":{"type":"integer","format":"int64"},"pending_order_count":{"type":"integer","format":"int64"},"available_balance":{"type":"string"},"status":{"type":"integer","format":"uint8"},"collateral":{"type":"string"},"account_index":{"type":"integer","format":"int64"},"name":{"type":"string"},"description":{"type":"string"},"can_invite":{"type":"boolean"},"referral_points_percentage":{"type":"string"},"positions":{"type":"array","items":{"$ref":"#/components/schemas/AccountPosition"}},"assets":{"type":"array","items":{"$ref":"#/components/schemas/AccountAsset"}},"total_asset_value":{"type":"string"},"cross_asset_value":{"type":"string"},"pool_info":{"$ref":"#/components/schemas/PublicPoolInfo"},"shares":{"type":"array","items":{"$ref":"#/components/schemas/PublicPoolShare"}},"created_at":{"type":"integer","format":"int64"},"transaction_time":{"type":"integer","format":"int64","description":"Transaction execution time in Unix microseconds."},"pending_unlocks":{"type":"array","items":{"$ref":"#/components/schemas/PendingUnlock"}},"approved_integrators":{"type":"array","items":{"$ref":"#/components/schemas/ApprovedIntegrator"}},"can_rfq":{"type":"boolean"},"cross_initial_margin_requirement":{"type":"string"},"cross_maintenance_margin_requirement":{"type":"string"},"can_rfq_market_ids":{"type":"array","items":{"type":"string"}},"metadata":{"$ref":"#/components/schemas/SubAccountMetadata"},"agent_enabled":{"type":"boolean"},"bo_positions":{"type":"array","items":{"$ref":"#/components/schemas/AccountBinaryOptionsPosition"}},"instance":{"type":"string"}},"title":"DetailedAccount","required":["code","account_type","index","l1_address","cancel_all_time","total_order_count","total_isolated_order_count","pending_order_count","available_balance","status","collateral","transaction_time","account_index","name","description","can_invite","referral_points_percentage","can_rfq","can_rfq_market_ids","agent_enabled","created_at","metadata","positions","assets","total_asset_value","cross_asset_value","cross_initial_margin_requirement","cross_maintenance_margin_requirement","shares","bo_positions"],"description":"Fields with zero or empty values may be omitted; handle optional properties when decoding responses."},"AccountPosition":{"type":"object","properties":{"market_id":{"type":"integer","format":"int16"},"symbol":{"type":"string"},"initial_margin_fraction":{"type":"string"},"open_order_count":{"type":"integer","format":"int64"},"pending_order_count":{"type":"integer","format":"int64"},"position_tied_order_count":{"type":"integer","format":"int64"},"sign":{"type":"integer","format":"int32"},"position":{"type":"string"},"avg_entry_price":{"type":"string"},"position_value":{"type":"string"},"unrealized_pnl":{"type":"string"},"realized_pnl":{"type":"string"},"liquidation_price":{"type":"string"},"total_funding_paid_out":{"type":"string"},"margin_mode":{"type":"integer","format":"int32"},"allocated_margin":{"type":"string"},"total_discount":{"type":"string"},"margin_set_flag":{"type":"integer","format":"int32"}},"title":"AccountPosition","required":["market_id","symbol","initial_margin_fraction","open_order_count","pending_order_count","position_tied_order_count","sign","position","avg_entry_price","position_value","unrealized_pnl","realized_pnl","liquidation_price","margin_mode","margin_set_flag","allocated_margin"],"description":"Fields with zero or empty values may be omitted; handle optional properties when decoding responses."},"AccountAsset":{"type":"object","properties":{"symbol":{"type":"string"},"asset_id":{"type":"integer","format":"int16"},"balance":{"type":"string"},"locked_balance":{"type":"string"},"margin_balance":{"type":"string"},"margin_mode":{"type":"string","enum":["enabled","disabled"]},"multiplier":{"type":"string"}},"title":"AccountAsset","required":["symbol","asset_id","balance","locked_balance","margin_mode","margin_balance","multiplier"]},"PublicPoolInfo":{"type":"object","properties":{"status":{"type":"integer","format":"uint8"},"operator_fee":{"type":"string"},"min_operator_share_rate":{"type":"string"},"total_shares":{"type":"integer","format":"int64"},"operator_shares":{"type":"integer","format":"int64"},"annual_percentage_yield":{"type":"number","format":"double"},"daily_returns":{"type":"array","items":{"$ref":"#/components/schemas/DailyReturn"}},"share_prices":{"type":"array","items":{"$ref":"#/components/schemas/SharePrice"}},"sharpe_ratio":{"type":"number","format":"double"},"strategies":{"type":"array","items":{"$ref":"#/components/schemas/Strategy"}}},"title":"PublicPoolInfo","required":["status","operator_fee","min_operator_share_rate","total_shares","operator_shares","annual_percentage_yield","daily_returns","share_prices","sharpe_ratio","strategies"]},"DailyReturn":{"type":"object","properties":{"timestamp":{"type":"integer","format":"int64"},"daily_return":{"type":"number","format":"double"}},"title":"DailyReturn","required":["timestamp","daily_return"]},"SharePrice":{"type":"object","properties":{"timestamp":{"type":"integer","format":"int64"},"share_price":{"type":"number","format":"double"}},"title":"SharePrice","required":["timestamp","share_price"]},"Strategy":{"type":"object","properties":{"collateral":{"type":"string"}},"required":["collateral"],"title":"Strategy"},"PublicPoolShare":{"type":"object","properties":{"public_pool_index":{"type":"integer","format":"int64"},"shares_amount":{"type":"integer","format":"int64"},"entry_usdc":{"type":"string"},"entry_timestamp":{"type":"integer","format":"int64"},"principal_amount":{"type":"string"}},"title":"PublicPoolShare","required":["public_pool_index","shares_amount","entry_usdc","entry_timestamp","principal_amount"]},"PendingUnlock":{"type":"object","properties":{"unlock_timestamp":{"type":"integer","format":"int64"},"asset_index":{"type":"integer","format":"int16"},"amount":{"type":"string"}},"required":["unlock_timestamp","asset_index","amount"],"title":"PendingUnlock"},"ApprovedIntegrator":{"type":"object","properties":{"account_index":{"type":"integer","format":"int64"},"name":{"type":"string"},"max_perps_taker_fee":{"type":"integer","format":"int32"},"max_perps_maker_fee":{"type":"integer","format":"int32"},"max_spot_taker_fee":{"type":"integer","format":"int32"},"max_spot_maker_fee":{"type":"integer","format":"int32"},"approval_expiry":{"type":"integer","format":"int64","description":"Timestamp in milliseconds, after which the integrator is no longer approved"}},"title":"ApprovedIntegrator","required":["account_index","name","max_perps_taker_fee","max_perps_maker_fee","max_spot_taker_fee","max_spot_maker_fee","approval_expiry"]},"SubAccountMetadata":{"type":"object","properties":{"color":{"type":"string"}},"title":"SubAccountMetadata","required":["color"]},"AccountBinaryOptionsPosition":{"title":"AccountBinaryOptionsPosition","type":"object","properties":{"market_id":{"type":"integer","format":"int64"},"entry_quote":{"type":"string"},"avg_entry_price":{"type":"string","description":"Average price paid for the held outcome (YES price for sign 1, NO price for sign -1)."},"sign":{"type":"integer","format":"int32","enum":[-1,1],"description":"-1 holds NO/Down; 1 holds YES/Up. Size is the unsigned magnitude."},"size":{"type":"string"}},"required":["market_id","entry_quote","avg_entry_price","sign","size"]},"ResultCode":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}},"title":"ResultCode","required":["code"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lighter.xyz/api/account/account.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
