curl --request POST \
--url https://api.hyperliquid.xyz/exchange \
--header 'Content-Type: application/json' \
--data '{
"action": {
"type": "updateIsolatedMargin",
"asset": 0,
"isBuy": true,
"ntli": "100.0"
},
"nonce": 1705234567890,
"signature": {
"r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321",
"v": 27
},
"vaultAddress": null
}'
{
"status": "ok",
"response": {
"type": "updateIsolatedMargin",
"data": {
"status": "success"
}
}
}
curl --request POST \
--url https://api.hyperliquid.xyz/exchange \
--header 'Content-Type: application/json' \
--data '{
"action": {
"type": "updateIsolatedMargin",
"asset": 0,
"isBuy": true,
"ntli": "100.0"
},
"nonce": 1705234567890,
"signature": {
"r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"s": "0xfedcba0987654321fedcba0987654321fedcba0987654321fedcba0987654321",
"v": 27
},
"vaultAddress": null
}'
{
"status": "ok",
"response": {
"type": "updateIsolatedMargin",
"data": {
"status": "success"
}
}
}
action
(object, required) — The update isolated margin action object containing:
type
(string) — Must be "updateIsolatedMargin"
or "topUpIsolatedOnlyMargin"
"updateIsolatedMargin"
:
asset
(number) — Asset index of the coinisBuy
(boolean) — true
(reserved for future hedge mode support)ntli
(number) — Amount to add (positive) or remove (negative) in USDC with 6 decimals (e.g., 1000000 = 1 USDC)"topUpIsolatedOnlyMargin"
:
asset
(number) — Asset index of the coinleverage
(string) — Target leverage as a float string (e.g., “5.0”)nonce
(number, required) — Current timestamp in milliseconds (must be recent)
signature
(object, required) — EIP-712 signature of the action
vaultAddress
(string, optional) — Address when trading on behalf of a vault or subaccountexpiresAfter
(number, optional) — Timestamp in milliseconds after which the request is rejected"updateIsolatedMargin"
to add or remove a specific USDC amount:
ntli
— Adds margin to the positionntli
— Removes margin from the position"topUpIsolatedOnlyMargin"
to set a target leverage:
status
— "ok"
if successfulresponse
— Contains update details:
type
— "default"
# Add 100 USDC to isolated position
curl -X POST https://api.hyperliquid.xyz/exchange \
-H "Content-Type: application/json" \
-d '{
"action": {
"type": "updateIsolatedMargin",
"asset": 0,
"isBuy": true,
"ntli": 100000000
},
"nonce": 1234567890123,
"signature": {...}
}'
# Set position to 5x leverage
curl -X POST https://api.hyperliquid.xyz/exchange \
-H "Content-Type: application/json" \
-d '{
"action": {
"type": "topUpIsolatedOnlyMargin",
"asset": 0,
"leverage": "5.0"
},
"nonce": 1234567890123,
"signature": {...}
}'
{
"status": "ok",
"response": {
"type": "default"
}
}
isBuy
parameter is currently always true
but is included for future hedge mode support where long and short positions can be held simultaneously.Isolated margin update result
The response is of type object
.