Changes the leverage used for future orders on a given market (and optionally toggles margin mode). This does not modify the leverage of already-open positions on Lighter — for that, use update-margin.
Request Body
Mobula market identifier (e.g., lighter-btc-usd).
New leverage value (e.g., 5 for 5x).
0 = cross, 1 = isolated. Omit to keep current.
Endpoint-specific errors
| Status | message |
|---|
| 400 | update-leverage payload action failed — leverage out of range, market not found, or DEX refusal |
Example
Set Lighter BTC-USD leverage to 5x, cross margin:
const endpoint = 'api/2/perp/payloads/update-leverage';
const timestamp = Date.now();
const signature = await wallet.signMessage(`${endpoint}-${timestamp}`);
const res = await fetch(`https://api.mobula.io/${endpoint}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
timestamp,
signature,
dex: 'lighter',
chainId: 'lighter:301',
marketId: 'lighter-btc-usd',
leverage: 5,
marginMode: 0,
}),
}).then(r => r.json());