Skip to main content

Build Leverage or Margin Action REST API Endpoint

Build a leverage or margin action (updateLeverage, updateIsolatedMargin, topUpIsolatedOnlyMargin). Returns a hash to sign with your wallet.

Updated on
Jun 29, 2026
info

Exchange API calls do not consume Quicknode API credits. Transactions through this endpoint are appended with a builder fee. See hyperliquidapi.com for a full breakdown. To white-label with your own builder code, contact us.


Body Parameters

action
object
REQUIRED

Leverage or margin action object. The type field determines which operation is performed and which additional fields are required.

type
string

Action type. Supported values: "updateLeverage", "updateIsolatedMargin", "topUpIsolatedOnlyMargin".

asset
string or integer

Market name (e.g. "BTC") or native asset index. Resolved to a numeric asset index in the response.

isCross
boolean

Whether to use cross margin (true) or isolated margin (false). Required for updateLeverage.

leverage
number or string

Leverage value to set. Required for updateLeverage.

isBuy
boolean

Position side the margin change applies to (true for long, false for short). Required for updateIsolatedMargin.

ntli
number

Isolated margin delta to add (positive) or remove (negative). Required for updateIsolatedMargin.

Returns

hash
string

Hash to sign with wallet (0x-prefixed hex string)

nonce
integer

Unique nonce for this action (timestamp in milliseconds)

action
object

Processed action object with the asset resolved to a numeric asset index

actionType
string

The action type as submitted (e.g. "updateLeverage", "updateIsolatedMargin", "topUpIsolatedOnlyMargin")

nextStep
string

Instructions for next step: sign the hash with private key (ECDSA), then POST /exchange with action, nonce, and signature (r, s, v)

Request
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free