Developers
Lighter DEX API Guide: REST, WebSocket, Python and Go SDKs, GitHub, Testnet and Rate Limits (2026)
Developer guide to the Lighter DEX API: mainnet and testnet endpoints, how API keys work (up to 253 per account), the official Python (lighter-sdk) and Go SDKs on GitHub, the community TypeScript SDK, WebSocket streams, rate limits by account type, and a minimal order example.

Lighter perpetual DEX gives you a full REST and WebSocket API with official Python and Go SDKs, published on GitHub under the elliottech organization. Every account can create up to 253 API keys, orders are signed locally with an L2 key derived from your wallet, and a public testnet lets you build without risking funds. A standard account trades through the API at 0% fees; Plus and Premium accounts buy higher rate limits and lower latency. This is the fastest route from zero to a signed order, with links to the primary documentation at every step. Verified against apidocs.lighter.xyz in September 2026.
Where the documentation lives
| Resource | URL |
|---|---|
| API reference and guides | https://apidocs.lighter.xyz/docs/get-started |
| Protocol docs (fees, margin, funding, points) | https://docs.lighter.xyz |
| LLM-friendly index of all docs | https://docs.lighter.xyz/llms.txt and https://apidocs.lighter.xyz/llms.txt |
| Python SDK | https://github.com/elliottech/lighter-python (pip install lighter-sdk) |
| Go SDK (reference signer) | https://github.com/elliottech/lighter-go |
| API changes channel | https://t.me/lighter_api_updates |
| GitHub org | https://github.com/elliottech |
Tip: append .md to any docs page URL to get raw Markdown, which is convenient for feeding into tools.
Endpoints
| Environment | REST base | Notes |
|---|---|---|
| Mainnet | https://mainnet.zklighter.elliot.ai | Paths under /api/v1/ |
| Testnet | https://testnet.zklighter.elliot.ai/api/v1/ | Free test USDC via the testnet app |
| WebSocket | wss://mainnet.zklighter.elliot.ai/stream (testnet analogous) | Order book, trades, account, market stats |
Public endpoints (order books, trades, candles, funding, market details) need no authentication. Account and transaction endpoints need an auth token generated by signing with your API key.
Accounts, sub-accounts and API keys
- A main account is created by registering an Ethereum wallet (the sign-message step in the app).
- You can create sub-accounts under the same wallet; each has its own margin and its own account index.
- Each account or sub-account can hold up to 253 API keys (indices 2 through 254; 0 and 1 are reserved for the web app and mobile). Each key has its own nonce sequence.
- API keys are separate cryptographic keys (not your Ethereum private key). You generate one locally and register its public key on your account by signing a transaction with an existing key (initially via the app or the SDK's
system_setupexample). Revoke by overwriting the index.

Never put your Ethereum seed phrase in a bot. Only the derived API private key is needed, and it can only trade, not withdraw to arbitrary addresses.
Python quick start
pip install lighter-sdk
import asyncio
import lighter
BASE_URL = "https://mainnet.zklighter.elliot.ai"
API_KEY_PRIVATE_KEY = "0x..." # your Lighter API private key, NOT your wallet key
ACCOUNT_INDEX = 123
API_KEY_INDEX = 2
async def main():
client = lighter.SignerClient(
url=BASE_URL,
private_key=API_KEY_PRIVATE_KEY,
account_index=ACCOUNT_INDEX,
api_key_index=API_KEY_INDEX,
)
err = client.check_client()
assert err is None, err
# Market 0 is BTC-PERP on mainnet; confirm with /api/v1/orderBookDetails
tx, tx_hash, err = await client.create_order(
market_index=0,
client_order_index=1,
base_amount=1000, # in base units, see decimals in orderBookDetails
price=100000_00, # in price units, see decimals
is_ask=False, # False = buy/long
order_type=lighter.SignerClient.ORDER_TYPE_LIMIT,
time_in_force=lighter.SignerClient.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME,
reduce_only=False,
trigger_price=0,
)
print(tx_hash, err)
await client.close()
asyncio.run(main())
Amounts and prices are integers scaled by each market's size_decimals and price_decimals, which you read from GET /api/v1/orderBookDetails. The SDK repository's examples/ folder includes system_setup.py (create and register an API key), create_cancel_order.py, ws.py (WebSocket) and auth-token generation.
Go SDK
go get github.com/elliottech/lighter-go. The Go repo is the reference implementation of transaction signing and hashing; other SDKs wrap it. It includes a small HTTP client that fetches nonces and validates client setup. Use it if you need the canonical signer or are building in Go.
TypeScript and other languages
There is no official TypeScript SDK from Lighter, but a community lighter-ts package exists that wraps the core APIs with typed clients, WebSocket support and a WASM build of the Go signer so it runs on Windows, macOS and Linux. Rust users typically call the REST API directly and sign via the Go library through FFI or a sidecar. Check the API updates Telegram before relying on a community SDK after a protocol upgrade.
Key REST endpoints
| Purpose | Endpoint |
|---|---|
| Market list and decimals | GET /api/v1/orderBookDetails |
| Order book snapshot | GET /api/v1/orderBooks |
| Recent trades | GET /api/v1/recentTrades |
| Candles | GET /api/v1/candlesticks |
| Funding rates | GET /api/v1/fundings |
| Account by wallet | GET /api/v1/accountsByL1Address |
| Account API keys | GET /api/v1/apikeys |
| Next nonce | GET /api/v1/nextNonce |
| Send signed transaction | POST /api/v1/sendTx |
| Batch send | POST /api/v1/sendTxBatch |
Orders, cancels, transfers and withdrawals are all transactions that you sign locally and submit via sendTx. There is no "place order" endpoint that takes plaintext parameters; that is why the SDK's signer exists.
WebSocket streams
Subscribe to channels such as order_book/{market_id}, trade/{market_id}, account_all/{account_index} (authenticated), and market_stats/all for funding, OI and mark prices. The Python SDK's WsClient handles reconnects and sequencing. For market making, the order-book stream plus the account stream is enough; poll REST only for recovery.
Rate limits and account types
| Account type | Trading fee | sendTx rate limit | Latency |
|---|---|---|---|
| Standard | 0% | Baseline (sufficient for most bots) | 300 ms taker / 200 ms maker |
| Plus | 0.005% flat | 8,000 sendTx / minute | 300 ms |
| Premium | 0.0040% / 0.0280% minus LIT discount | High | 140–200 ms |

If your bot hits 429s on standard, batch with sendTxBatch before paying for Plus. Fee detail: Lighter DEX fees.
Testnet
Step-by-step, including the faucet and a bot graduation plan: Lighter testnet.
The testnet mirrors mainnet with the same API and a faucet for test USDC accessible from the testnet app. Market indices and decimals differ from mainnet, so read orderBookDetails on each environment. Testnet resets occasionally; do not store state that assumes continuity.
Running a node
How the sequencer, prover and Ethereum contracts fit together: the Lighter DEX chain architecture guide.
zkLighter does not offer public full-node software; the sequencer and prover are operated by Lighter. Developers interact through the API. Rollup contracts, state roots and proofs are on Ethereum, so anyone can verify state transitions, but "running a Lighter node" in the Ethereum sense is not currently possible. The prover repository is partially public (recent commits revealed binary-option circuits), but it is not a node.
Frequently asked questions
Does Lighter DEX have an API? Yes: REST and WebSocket, documented at apidocs.lighter.xyz, with official Python and Go SDKs on GitHub.
Is there a Lighter Python SDK?
Yes, lighter-sdk on PyPI, source at github.com/elliottech/lighter-python. Requires Python 3.8+.
Where are the Lighter API docs? apidocs.lighter.xyz for the API, docs.lighter.xyz for protocol rules.
Does Lighter have a testnet? Yes, at testnet.zklighter.elliot.ai with a test-USDC faucet.
Can I trade via API on a free account? Yes. Standard accounts pay 0% fees via API. Plus and Premium buy throughput and latency.
Is the Lighter API key my wallet key? No. API keys are separate L2 keys registered on your account. Keep your wallet key out of bots.
Related guides
Related Lighter DEX guides
Developers
Lighter DEX Trading Bots: Grid, Market-Making, Funding Arbitrage and How to Build One Safely (2026)
Bot strategies that benefit from 0% fees, account-tier choice, open-source starting points, points considerations and a risk-control checklist.
6 min read · Updated
Basics
What Is Lighter DEX? The Zero-Fee ZK Perp Exchange Explained (2026)
Plain-English explanation of Lighter: the ZK rollup, the zero-fee model, the 219+ markets, the LIT token and the risks.
9 min read · Updated
Basics
Lighter DEX Review 2026: Pros, Cons, Fees, Liquidity, Safety and Who It Is For
A year of real use distilled: what is excellent, what is merely fine, what is missing, scored by category, with a verdict per trader type.
6 min read · Updated


