updateLeverage
Sets the leverage the account uses for one instrument.
updateLeverageSet leverage for one instrument (requires no open orders in scope).Agent-signed
Instrument's external id — the `index` value from `perpMeta`; Outcome markets use the `instrument_id`.
Target leverage. Must be positive in one-way mode; in hedge mode with isolated margin the sign selects which side is affected.
Must be `updateLeverage`.
"updateLeverage"Defaults to the instrument's current mode.
"cross""isolated"curl -X POST https://rpc.txflow-testnet.xyz/exchange \
-H "Content-Type: application/json" \
-H "x-api-version: 2026-08-16" \
-d '{
"action": {
"type": "updateLeverage",
"asset": 1,
"leverage": 20,
"marginMode": "cross"
},
"signature": {
"r": "0x<r>",
"s": "0x<s>",
"v": 27
},
"nonce": 1757992743994,
"vaultAddress": null,
"signatureChainId": null
}'`0` on success.
The action's internal name, which does not always match the request `type`.
"UpdateLeverage"A rejected request returns `err` with a non-zero `code` and the reason in `message` (or `response`).
"ok"{
"status": "ok",
"code": 0,
"data": {
"type": "UpdateLeverage",
"data": {
"statuses": [
"success"
]
}
}
}Preconditions
The action is rejected while the scope it touches still has working orders:
| Error | Cause |
|---|---|
Cannot update leverage while you have open orders | Non-TWAP orders exist for that instrument and margin mode |
Cannot update leverage while you have TPSL orders | Take-profit / stop-loss orders exist in scope |
Cannot update leverage while you have trigger orders | Trigger orders exist in scope |
Maximum leverage exceeded for <instrument> | Above the margin tier's cap for the current position size |
Margin tier not found | No margin tier is configured for the instrument |
With no open position, the cap is the first margin tier's maximum; with a position, it is the tier matching that position's size. Cancel the orders in scope first, then retry.
Next steps
Read the applied leverage back from clearinghouseState or activeAssetData.