Skip to content
Lighter DEX PerpOpen Lighter App

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 DEX API quick reference: REST at mainnet.zklighter.elliot.ai, WebSocket stream, Python lighter-sdk, Go lighter-go, up to 253 API keys, public testnet
Quick reference. Data as of September 2026, compiled by Lighter DEX Perp.

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

ResourceURL
API reference and guideshttps://apidocs.lighter.xyz/docs/get-started
Protocol docs (fees, margin, funding, points)https://docs.lighter.xyz
LLM-friendly index of all docshttps://docs.lighter.xyz/llms.txt and https://apidocs.lighter.xyz/llms.txt
Python SDKhttps://github.com/elliottech/lighter-python (pip install lighter-sdk)
Go SDK (reference signer)https://github.com/elliottech/lighter-go
API changes channelhttps://t.me/lighter_api_updates
GitHub orghttps://github.com/elliottech

Tip: append .md to any docs page URL to get raw Markdown, which is convenient for feeding into tools.

Endpoints

EnvironmentREST baseNotes
Mainnethttps://mainnet.zklighter.elliot.aiPaths under /api/v1/
Testnethttps://testnet.zklighter.elliot.ai/api/v1/Free test USDC via the testnet app
WebSocketwss://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_setup example). Revoke by overwriting the index.
Lighter API order flow: generate an API key, register it on your account, sign the order locally with the SDK, send it with sendTx, the sequencer matches it, and updates arrive over WebSocket
Life of an order sent through the Lighter API

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

PurposeEndpoint
Market list and decimalsGET /api/v1/orderBookDetails
Order book snapshotGET /api/v1/orderBooks
Recent tradesGET /api/v1/recentTrades
CandlesGET /api/v1/candlesticks
Funding ratesGET /api/v1/fundings
Account by walletGET /api/v1/accountsByL1Address
Account API keysGET /api/v1/apikeys
Next nonceGET /api/v1/nextNonce
Send signed transactionPOST /api/v1/sendTx
Batch sendPOST /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 typeTrading feesendTx rate limitLatency
Standard0%Baseline (sufficient for most bots)300 ms taker / 200 ms maker
Plus0.005% flat8,000 sendTx / minute300 ms
Premium0.0040% / 0.0280% minus LIT discountHigh140–200 ms
Lighter API account tiers table: Standard has 0 percent fees and 300 millisecond taker latency, Plus has 0.005 percent flat fees and 8,000 sendTx per minute, Premium has 0.004 and 0.028 percent fees with 140 to 200 millisecond latency
Fees, rate limits and latency for each Lighter account type

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.