Official docs: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api
| Network | URL |
|---|---|
| Mainnet | https://api.hyperliquid.xyz |
| Testnet | https://api.hyperliquid-testnet.xyz |
All info requests are POST /info with a JSON body.
{ "type": "clearinghouseState", "user": "0x..." }{ "type": "openOrders", "user": "0x..." }{ "type": "userFills", "user": "0x..." }{ "type": "allMids" }{ "type": "meta" }All trading requests are POST /exchange and require ECDSA signature.
{
"action": {
"type": "order",
"orders": [{
"a": 0, // asset index (from meta)
"b": true, // is_buy
"p": "45000", // limit price (string)
"s": "0.1", // size (string)
"r": false, // reduce_only
"t": { "limit": { "tif": "Gtc" } } // or "Ioc" for market
}],
"grouping": "na"
},
"nonce": 1234567890,
"signature": "0x..."
}{
"action": {
"type": "cancel",
"cancels": [{ "a": 0, "o": 12345 }] // asset index, order id
},
"nonce": 1234567890,
"signature": "0x..."
}| TIF | Meaning |
|---|---|
Gtc |
Good Till Cancelled (standard limit) |
Ioc |
Immediate or Cancel (market simulation) |
Alo |
Add Liquidity Only (post-only) |
- Sizes are in base currency (BTC, ETH, etc.), not USD
- Prices are in USD
- Asset indices come from
/info→meta→universe[].name - All values are strings in the API; parse to float after receiving
- The official
hyperliquidnpm package handles signing automatically