Skip to main content
POST
/
2
/
perp
/
payloads
/
update-margin
Build update-margin payload
curl --request POST \
  --url https://demo-api.mobula.io/api/2/perp/payloads/update-margin \
  --header 'Content-Type: application/json' \
  --data '
{
  "timestamp": 123,
  "signature": "<string>",
  "dex": "gains",
  "chainId": "<string>",
  "marketId": "<string>",
  "positionId": "<string>",
  "usdcAmount": 123,
  "increase": true,
  "newLeverage": 123
}
'
{
  "success": true,
  "data": {
    "action": "<string>",
    "dex": "<string>",
    "chainId": "<string>",
    "marketId": "<string>",
    "transport": "<string>",
    "payloadStr": "<string>"
  }
}

Body

application/json
timestamp
number
required
signature
string
required
dex
enum<string>
required
Available options:
gains,
lighter
chainId
string
required
marketId
string
positionId
string

Gains trade index. Required for Gains.

usdcAmount
number

Lighter only. USDC amount to add or remove (> 0).

increase
boolean

Lighter only. true = add margin, false = remove.

newLeverage
number

Gains only. New per-trade leverage (> 0).

Response

200 - application/json

Canonical payload envelope

success
boolean
required
data
object
required