Choose your integration
Pick the integration pattern that fits your product before writing any code.
Most integrations are one of four patterns. They differ in who holds the keys and who signs transactions.
| Pattern | Who owns the Lighter account | Who signs trades | Typical product |
|---|---|---|---|
| A. Self-custodial frontend | End user (their L1 wallet) | End user's API key, generated in their browser/app | Wallets, trading UIs, super-apps |
| B. Server-side on behalf of users | End user | Your backend, with an API key the user approved | Copy trading, managed strategies, agents |
| C. Your own account | You | Your backend | Market makers, bots, funds |
| D. Read-only | – | Nobody (no signing) | Dashboards, analytics, portfolio trackers |
A. Self-custodial frontend (most wallets and apps)
- User connects their Ethereum wallet (the L1 address).
- User deposits → Lighter creates an account index for them. See Deposits, Transfers and Withdrawals.
- Your app generates an API key pair locally (WASM
GenerateAPIKey), then the user signs a one-timeChangePubKeywith their wallet to register it. See Create accounts programmatically. - From then on your app signs orders locally with that API key – no wallet pop-ups per trade.
- Optionally, the user approves you as an integrator so you earn a fee on their trades. See Partner Attribution.
The API private key never leaves the user's device.
B. Server-side on behalf of users
Same as A, but the API key used for trading lives on your server. The user still registers the key with a one-time L1 signature. Treat these keys as highly sensitive: an API key can trade and can request secure withdrawals (which only go back to the user's own L1 address).
C. Your own account
Create an account by depositing, register API keys, sign and send from your backend. Consider the Premium tier for low latency and higher limits. See Account Types.
D. Read-only
No keys needed for public market data. For a specific account's private data use a read-only auth token (valid up to 10 years). See API keys.
Checklist of what you'll need
| Need | Self-custodial frontend | Server-side for users | Your own account | Read-only |
|---|---|---|---|---|
| WASM (or Go/Python) signer | ✅ | ✅ | ✅ | – |
| User's L1 signature (once per API key) | ✅ | ✅ | – | – |
Builder API key for bridge.lighter.xyz deposits | optional | optional | – | – |
| Plus or Premium tier (for partner fees) | if charging fees | if charging fees | optional | – |
| Auth token | for private data | for private data | for private data | read-only token |
Updated 3 days ago
