Hyperliquid Exchange API
See Python SDK for full featured examples on the fields of the order request.
For limit orders, TIF (time-in-force) sets the behavior of the order upon first hitting the book.
ALO (add liquidity only, i.e. "post only") will be canceled instead of immediately matching.
IOC (immediate or cancel) will have the unfilled part canceled instead of resting.
GTC (good til canceled) orders have no special behavior.
Client Order ID (cloid) is an optional 128 bit hex string, e.g. 0x1234567890abcdef1234567890abcdef
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#placeOrder" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "order", "orders": [ { "a": 0, "b": true, "p": "1800.00", "s": "0.1", "r": false, "t": { "limit": { "tif": "Gtc" } } } ], "grouping": "na" }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "order",
"data": {
"statuses": [
{
"resting": {
"oid": 77738308
}
}
]
}
}
}Cancel one or more open orders by asset and order ID (oid).
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#cancelOrders" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "cancel", "cancels": [ { "a": 0, "o": 77738308 } ] }, "nonce": 1716531070000, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "cancel",
"data": {
"statuses": [
"success"
]
}
}
}Cancel one or more open orders using their client order IDs (cloid).
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#cancelOrdersByCloid" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "cancelByCloid", "cancels": [ { "asset": 0, "cloid": "0x1234567890abcdef1234567890abcdef" } ] }, "nonce": 1716531070000, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "cancel",
"data": {
"statuses": [
"success"
]
}
}
}Schedule a cancel-all operation at a future time. Not including time will remove the
scheduled cancel operation. The time must be at least 5 seconds after the current time.
Once the time comes, all open orders will be canceled and a trigger count will be incremented.
The max number of triggers per day is 10. This trigger count is reset at 00:00 UTC.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#scheduleCancel" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "scheduleCancel", "time": 1716532000000 }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Modify a single open order identified by oid or cloid.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#modifyOrder" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "modify", "oid": 77738308, "order": { "a": 0, "b": true, "p": "1850.00", "s": "0.1", "r": false, "t": { "limit": { "tif": "Gtc" } } } }, "nonce": 1716531070000, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "order",
"data": {
"statuses": [
{
"resting": {
"oid": 77738308
}
}
]
}
}
}Batch-modify multiple open orders in a single request.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#modifyMultipleOrders" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "batchModify", "modifies": [ { "oid": 0, "order": { "a": 0, "b": true, "p": "string", "s": "string", "r": true, "t": {} } } ] } }'{
"status": "ok",
"response": {
"type": "order",
"data": {
"statuses": [
{
"resting": {
"oid": 77738308
}
}
]
}
}
}Submit a Time-Weighted Average Price order that splits execution over a given duration.
Key meanings in the twap object:
a= asset indexb= isBuys= total sizer= reduceOnlym= duration in minutest= randomize child order timing
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#placeTwapOrder" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "twapOrder", "twap": { "a": 0, "b": true, "s": "1.0", "r": false, "m": 30, "t": true } }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "twapOrder",
"data": {
"status": {
"running": {
"twapId": 77738308
}
}
}
}
}Cancel a running TWAP order by asset and TWAP ID.
Key meanings: a = asset index, t = twap_id.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#cancelTwapOrder" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "twapCancel", "a": 0, "t": 77738308 }, "nonce": 1716531070000, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "twapCancel",
"data": {
"status": "success"
}
}
}Update cross or isolated leverage on a coin.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#updateLeverage" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "updateLeverage", "asset": 0, "isCross": true, "leverage": 10 }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Add or remove margin from isolated position.
Note that to target a specific leverage instead of a USDC value of margin change, there is an
alternate action {"type": "topUpIsolatedOnlyMargin", "asset": <asset>, "leverage": <float string>}.
ntli is the net transfer amount with 6-decimal USDC precision.
Example: 1000000 = +1 USD, -1000000 = -1 USD.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#updateIsolatedMargin" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "updateIsolatedMargin", "asset": 0, "isBuy": true, "ntli": 5000000 }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Send usd to another address. This transfer does not touch the EVM bridge.
The signature format is human readable for wallet interfaces.
Note: expiresAfter is not supported for this action.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#coreUsdcTransfer" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "usdSend", "hyperliquidChain": "Mainnet", "signatureChainId": "0xa4b1", "destination": "0x0000000000000000000000000000000000000000", "amount": "10", "time": 1716531066415 }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Send spot assets to another address. This transfer does not touch the EVM bridge.
The signature format is human readable for wallet interfaces.
Note: expiresAfter is not supported for this action.
Example EIP-712 typed data for generating the signature:
{
"types": {
"HyperliquidTransaction:SpotSend": [
{ "name": "hyperliquidChain", "type": "string" },
{ "name": "destination", "type": "string" },
{ "name": "token", "type": "string" },
{ "name": "amount", "type": "string" },
{ "name": "time", "type": "uint64" }
]
},
"primaryType": "HyperliquidTransaction:SpotSend",
"domain": {
"name": "HyperliquidSignTransaction",
"version": "1",
"chainId": 42161,
"verifyingContract": "0x0000000000000000000000000000000000000000"
},
"message": {
"destination": "0x0000000000000000000000000000000000000000",
"token": "PURR:0xc1fb593aeffbeb02f85e0308e9956a90",
"amount": "0.1",
"time": 1716531066415,
"hyperliquidChain": "Mainnet"
}
}Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#coreSpotTransfer" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "spotSend", "hyperliquidChain": "Mainnet", "signatureChainId": "0xa4b1", "destination": "0x0000000000000000000000000000000000000000", "token": "PURR:0xc4bf3f870c0e9465323c0b6ed28096c2", "amount": "0.01", "time": 1716531066415 }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}This method is used to initiate the withdrawal flow. After making this request, the L1 validators will sign and send the withdrawal request to the bridge contract. There is a $1 fee for withdrawing at the time of this writing and withdrawals take approximately 5 minutes to finalize.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#initiateWithdrawal" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "withdraw3", "hyperliquidChain": "Mainnet", "signatureChainId": "0xa4b1", "amount": "100", "time": 1716531066415, "destination": "0x0000000000000000000000000000000000000000" }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}This method is used to transfer USDC from the user's spot wallet to perp wallet and vice versa.
nonce in the action object must match the outer nonce.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#transferSpotToPerp" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "usdClassTransfer", "hyperliquidChain": "Mainnet", "signatureChainId": "0xa4b1", "amount": "50", "toPerp": true, "nonce": 1716531066415 }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}This generalized method is used to transfer tokens between different perp DEXs, spot balance,
users, and/or sub-accounts. Use "" to specify the default USDC perp DEX and "spot" to
specify spot. Only the collateral token can be transferred to or from a perp DEX.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#sendAsset" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "sendAsset", "hyperliquidChain": "Mainnet", "signatureChainId": "string", "destination": "0x0000000000000000000000000000000000000000", "sourceDex": "string", "destinationDex": "string", "token": "string", "amount": "string", "fromSubAccount": "string", "nonce": 0 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Specialized action for Core to EVM transfer that includes an additional data payload.
When used, coreReceiveWithData will be called on the linked contract instead of a plain transfer.
IMPORTANT: It is the caller's responsibility to ensure that the token is properly linked and the linked contract supports the following interface:
interface ICoreReceiveWithData {
function coreReceiveWithData(
address from,
bytes32 destinationRecipient,
uint32 destinationChainId,
uint256 amount,
uint64 nonce,
bytes calldata data
) external;
}Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#sendToEvmWithData" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "sendToEvmWithData", "hyperliquidChain": "Mainnet", "signatureChainId": "string", "token": "string", "amount": "string", "sourceDex": "string", "destinationRecipient": "string", "addressEncoding": "hex", "destinationChainId": 0, "gasLimit": 0, "data": "string", "nonce": 0 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Transfer native token from the user's spot account into staking for delegating to validators.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#depositIntoStaking" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "cDeposit", "hyperliquidChain": "Mainnet", "signatureChainId": "0xa4b1", "wei": 1000000000000000000, "nonce": 1716531066415 }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Transfer native token from staking into the user's spot account. Note that transfers from staking to spot account go through a 7 day unstaking queue.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#withdrawFromStaking" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "cWithdraw", "hyperliquidChain": "Mainnet", "signatureChainId": "string", "wei": 0, "nonce": 0 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Delegate or undelegate native tokens to or from a validator. Note that delegations to a particular validator have a lockup duration of 1 day.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#delegateStake" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "tokenDelegate", "hyperliquidChain": "Mainnet", "signatureChainId": "0xa4b1", "validator": "0x0000000000000000000000000000000000000000", "isUndelegate": false, "wei": 1000000000000000000, "nonce": 1716531066415 }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Claim accumulated staking rewards.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#claimRewards" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "claimRewards" } }'{
"status": "ok",
"response": {
"type": "default"
}
}Add or remove funds from a vault.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#vaultTransfer" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "vaultTransfer", "vaultAddress": "0x0000000000000000000000000000000000000000", "isDeposit": true, "usd": 100 }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Approves an API Wallet (also sometimes referred to as an Agent Wallet).
Limits:
- 1 unnamed approved wallet per account.
- Up to 3 named wallets per account.
- 2 additional named agents per sub-account.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#approveApiWallet" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "approveAgent", "hyperliquidChain": "Mainnet", "signatureChainId": "string", "agentAddress": "0x0000000000000000000000000000000000000000", "nonce": 0 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Approve a maximum fee rate for a specific builder address.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#approveBuilderFee" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "approveBuilderFee", "hyperliquidChain": "Mainnet", "signatureChainId": "string", "maxFeeRate": "string", "builder": "0x0000000000000000000000000000000000000000", "nonce": 0 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Instead of trading to increase the address based rate limits, this action allows reserving additional actions for 0.0005 USDC per request. The cost is paid from the Perps balance.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#reserveRequestWeight" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "reserveRequestWeight", "weight": 0 } }'{
"status": "ok",
"response": {
"type": "default"
}
}This action does not do anything (no operation), but causes the nonce to be marked as used. This can be a more effective way to cancel in-flight orders than the cancel action.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#invalidatePendingNonce" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "noop" } }'{
"status": "ok",
"response": {
"type": "default"
}
}Set the DEX abstraction mode for a user or sub-account.
Replaces the deprecated userDexAbstraction action.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#setUserAbstraction" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "userSetAbstraction", "hyperliquidChain": "Mainnet", "signatureChainId": "string", "user": "0x0000000000000000000000000000000000000000", "abstraction": "disabled", "nonce": 0 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Agent-scoped version of setUserAbstraction.
Replaces the deprecated agentEnableDexAbstraction action.
Abstraction values: "i" = disabled, "u" = unifiedAccount, "p" = portfolioMargin.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#setAgentAbstraction" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "agentSetAbstraction", "abstraction": "i" } }'{
"status": "ok",
"response": {
"type": "default"
}
}Enable HIP-3 DEX abstraction
DeprecatedDeprecated — prefer userSetAbstraction.
If set, actions on HIP-3 perps will automatically transfer collateral from the validator-operated USDC perps balance for HIP-3 DEXs where USDC is the collateral token, and from spot otherwise. When HIP-3 DEX abstraction is active, collateral is returned to the same source (validator-operated USDC perps or spot balance) when released from positions or open orders.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#enableUserDexAbstraction" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "userDexAbstraction", "hyperliquidChain": "Mainnet", "signatureChainId": "string", "user": "0x0000000000000000000000000000000000000000", "enabled": true, "nonce": 0 } }'{
"status": "ok",
"response": {
"type": "default"
}
}Enable HIP-3 DEX abstraction (agent)
DeprecatedDeprecated — prefer agentSetAbstraction.
Same effect as userDexAbstraction, but only works if setting the value from null to true.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#enableAgentDexAbstraction" \ -H "Content-Type: application/json" \ -d '{ "nonce": 1716531066415, "signature": { "r": "string", "s": "string", "v": 0 }, "action": { "type": "agentEnableDexAbstraction" } }'{
"status": "ok",
"response": {
"type": "default"
}
}Submit a validator vote for the risk-free rate of the aligned quote asset.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/exchange#validatorVoteRiskFreeRate" \ -H "Content-Type: application/json" \ -d '{ "action": { "type": "validatorL1Stream", "riskFreeRate": "0.04" }, "nonce": 1716531066415, "signature": { "r": "0xabc...", "s": "0xdef...", "v": 27 } }'{
"status": "ok",
"response": {
"type": "default"
}
}