HyperliquidHyperliquid REST APIRisk management

Update Leverage

Update leverage settings for a trading pair.

Rate Limit: 1 weight

Authentication: Required

POST
/v1/exchange/updateLeverage

Authorization

HyperliquidSignature
Authorization<token>

Hyperliquid uses a custom signing scheme for authentication.

Required for: All /exchange endpoints

Format: Signature generated using private key + nonce + action data

Headers:

  • Authorization: Signature
  • Content-Type: application/json

Important Notes:

  • Use official SDKs to avoid signing errors
  • Nonce must be current timestamp in milliseconds
  • Address fields must be lowercase
  • Order of fields in msgpack serialization matters

Common Pitfalls:

  • Not understanding the two signing schemes
  • Trailing zeros on numbers
  • Case sensitivity on addresses
  • Incorrect field ordering

In: header

Request Body

application/json

action*objectrequired
type*enum<string>required
Available options: updateLeverage
asset*integerrequired

Asset index

isCross*booleanrequired

Cross margin flag

leverage*integerrequired

New leverage value (1-100)

nonce*integerrequired
signature*objectrequired

Response Body

application/json

application/json

application/json

curl -X POST "https://api.hypereth.io/v1/exchange/updateLeverage" \  -H "Content-Type: application/json" \  -d '{    "action": {      "type": "updateLeverage",      "asset": 0,      "isCross": true,      "leverage": 0    },    "nonce": 0,    "signature": {}  }'
{
  "status": "ok",
  "response": {
    "type": "updateLeverage",
    "data": {
      "asset": 0,
      "leverage": 0
    }
  }
}
{
  "error": "Insufficient margin for order placement",
  "code": 1001,
  "details": {}
}
{
  "error": "Insufficient margin for order placement",
  "code": 1001,
  "details": {}
}