Skip to main content
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

dex
string
required
gains or lighter.
chainId
string
required
Chain of the market.
marketId
string
required
Mobula market identifier (e.g., lighter-btc-usd).
leverage
number
required
New leverage value (e.g., 5 for 5x).
marginMode
number
0 = cross, 1 = isolated. Omit to keep current.

Endpoint-specific errors

Statusmessage
400update-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());