๐Ÿ”Œ API & Developers

Hyperliquid updateLeverage and updateIsolatedMargin API: Exchange Endpoint Reference

โš ๏ธ Disclosure: Some links on this page are affiliate links. If you sign up through them, I may earn a commission โ€” at no extra cost to you.
All leverage and margin adjustments go to POST https://api.hyperliquid.xyz/exchange with Content-Type: application/json. Every request requires a signed action object, a nonce (current timestamp in milliseconds), and a signature. Optionally, vaultAddress routes the action to a subaccount or vault โ€” in that case the master account signs and sets vaultAddress to the target address.

Source: Hyperliquid exchange endpoint docs

updateLeverage

Updates cross or isolated leverage on a single coin.

Action schema:

{
  "type": "updateLeverage",
  "asset": <index of coin>,
  "isCross": true | false,
  "leverage": <integer>
}

FieldTypeDescription
typeString"updateLeverage"
assetNumberPerpetual asset index from meta universe.
isCrossBooleantrue for cross-margin leverage, false for isolated.
leverageIntegerTarget leverage value, subject to per-coin leverage constraints.
Successful response:

{"status": "ok", "response": {"type": "default"}}

updateIsolatedMargin

Adds or removes USDC margin from an isolated position by a specific dollar amount.

Action schema:

{
  "type": "updateIsolatedMargin",
  "asset": <index of coin>,
  "isBuy": true,
  "ntli": <integer with 6 decimals>
}

FieldTypeDescription
typeString"updateIsolatedMargin"
assetNumberPerpetual asset index from the meta response.
isBuyBooleanCurrently has no effect. The docs note this parameter will matter once hedge mode is introduced.
ntliIntegerAmount to add or remove, encoded with 6 decimal places. For example, 1000000 = 1 USDC, 5000000 = 5 USDC. Use a negative value to remove margin.
Example โ€” add 10 USDC to BTC isolated margin (assuming BTC is asset index 0):

{
  "type": "updateIsolatedMargin",
  "asset": 0,
  "isBuy": true,
  "ntli": 10000000
}

Successful response:

{"status": "ok", "response": {"type": "default"}}

๐Ÿ’ก Hyperliquid

Like what you're reading? Try it yourself โ€” this link supports ChartedTrader at no cost to you.

Trade on Hyperliquid with a 4% fee discount on your first $25M volume (Vaults and sub-accounts excluded) โ†’
๐ŸŽ You receive: 4% fee discount on first $25M volume ยท per account, lifetime

topUpIsolatedOnlyMargin

An alternate action for targeting a specific leverage value rather than specifying a USDC amount. The docs describe it as:

{
  "type": "topUpIsolatedOnlyMargin",
  "asset": <asset>,
  "leverage": <float string>
}

This adjusts isolated margin to reach the given leverage target, rather than requiring the caller to calculate the USDC delta themselves. The leverage field is a float string (e.g. "5.0").

Common request fields

FieldRequiredDescription
actionYesThe action object (see above).
nonceYesCurrent timestamp in milliseconds.
signatureYesEIP-712 signature. See the Python SDK for signing details.
vaultAddressNo42-character hex address of a subaccount or vault. When set, the master account signs.
expiresAfterNoMillisecond timestamp after which the action is rejected. Actions consuming a stale expiresAfter count 5ร— against rate limits.

Asset indexing

For perpetuals, asset is the integer index in the universe array returned by the meta info endpoint. See Hyperliquid Asset IDs.

Signing

Signatures use the Python SDK's EIP-712 helpers. The SDK also handles subaccount routing via vaultAddress. Refer to the basic_vault.py example in the SDK for a working pattern.

---

*If you're building on Hyperliquid, the referral link https://app.hyperliquid.xyz/join/RICH888 gives you a 4% fee discount on your first $25M of trading volume (Vaults and sub-accounts excluded). Disclosure: this site may earn a referral commission.*

Continue with Hyperliquid

Browse the Hyperliquid guide hub for the complete user journey.

Related: Hyperliquid vaultTransfer API: Deposit or Withdraw Vault Funds via POST /exchange

๐Ÿงฎ Free Hyperliquid calculators

Fee Calculator โ†’
Hyperliquid vs centralized exchange fee comparison
PnL & Liquidation โ†’
Perp PnL + liquidation price
Position Size โ†’
Risk-aware position sizing for HL perps
Hyperliquid

Ready to get started? Use the link below โ€” it helps support ChartedTrader at no cost to you.

Trade on Hyperliquid with a 4% fee discount on your first $25M volume (Vaults and sub-accounts excluded) โ†’
๐ŸŽ You receive: 4% fee discount on first $25M volume ยท per account, lifetime
๐Ÿ“ˆ

About the author

I'm a systematic trader running live strategies on IB (USDJPY momentum) and Hyperliquid (crypto perps). Questions? Reach out.

๐Ÿ“š Related Articles

๐Ÿ”Œ
API & Developers

Hyperliquid Python SDK Tutorial: Build a Bot (2026)

Build a production-ready trading bot on Hyperliquid using the official Python SDK. Covers API wallet security, order execution, WebSocket feeds, and common pitfalls to avoid.

May 6, 2026 โฑ 12 min read
๐Ÿ“–
Guides

Does Hyperliquid Support Trailing Stops? Setup Guide (2026)

Hyperliquid does not currently list a native trailing-stop order in its official order types. It supports market, limit, stop market, stop limit, take market, take limit, scale, TWAP, and TP/SL orders. To trail a stop, you must either move a reduce-only stop manually or automate cancel-and-replace through the API. A normal TP/SL is not a trailing stop: its trigger stays fixed until you change or cancel it.

March 4, 2026 โฑ 3 min read
๐Ÿ“–
Guides

Hyperliquid Getting Started: Wallet to First Perp 2026

Complete beginner's guide to Hyperliquid: install MetaMask, add Arbitrum, bridge USDC, connect wallet, and place your first perpetual trade safely in 2026.

April 1, 2026 โฑ 17 min read