hl-api-samples
Original:🇺🇸 English
Translated
Generates bash/curl commands for fetching sample data from Hyperliquid API. Use when user wants curl examples, bash commands to test the API, or sample data fetch commands for mainnet.
13installs
Added on
NPX Install
npx skill4agent add cezar-r/hyperliquid-skills hl-api-samplesTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Hyperliquid API Sample Data Fetcher
Generate ready-to-run bash/curl commands for fetching data from the Hyperliquid mainnet API.
Base URL
https://api.hyperliquid.xyz/infoAll requests are POST with .
Content-Type: application/jsonPublic Data Commands
Get Exchange Metadata (assets, leverage, decimals)
bash
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "meta"}' | jqGet All Mid Prices
bash
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "allMids"}' | jqGet Meta + Asset Contexts (combined metadata)
bash
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "metaAndAssetCtxs"}' | jqGet Order Book (L2)
bash
# BTC order book
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "l2Book", "coin": "BTC"}' | jq
# ETH order book
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "l2Book", "coin": "ETH"}' | jq
# SOL order book
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "l2Book", "coin": "SOL"}' | jqGet Recent Trades
bash
# BTC recent trades
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "recentTrades", "coin": "BTC"}' | jq
# ETH recent trades
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "recentTrades", "coin": "ETH"}' | jqGet Candle Data (OHLCV)
bash
# BTC 1-hour candles (last 24 hours)
# Replace START_TIME and END_TIME with millisecond timestamps
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "candleSnapshot", "req": {"coin": "BTC", "interval": "1h", "startTime": 1704067200000, "endTime": 1704153600000}}' | jq
# ETH 15-minute candles
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "candleSnapshot", "req": {"coin": "ETH", "interval": "15m", "startTime": 1704067200000, "endTime": 1704153600000}}' | jqCandle Intervals: , , , , ,
1m5m15m1h4h1dUser-Specific Commands
Replace with your actual wallet address.
0xYOUR_ADDRESSGet Account State (positions, margin, balance)
bash
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "clearinghouseState", "user": "0xYOUR_ADDRESS"}' | jqGet Open Orders
bash
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "openOrders", "user": "0xYOUR_ADDRESS"}' | jqGet Frontend Open Orders (includes TP/SL info)
bash
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "frontendOpenOrders", "user": "0xYOUR_ADDRESS"}' | jqGet Trade Fills (history)
bash
# Get fills from a start time (milliseconds)
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "userFills", "user": "0xYOUR_ADDRESS", "startTime": 1704067200000}' | jqGet Funding Payments
bash
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "userFunding", "user": "0xYOUR_ADDRESS", "startTime": 1704067200000}' | jqGet Spot Balances
bash
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "spotClearinghouseState", "user": "0xYOUR_ADDRESS"}' | jqHIP-3 Builder-Deployed Markets
For HIP-3 markets, add the parameter:
dexGet HIP-3 Market Metadata
bash
# xyz dex metadata
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "meta", "dex": "xyz"}' | jqGet HIP-3 Positions
bash
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "clearinghouseState", "user": "0xYOUR_ADDRESS", "dex": "xyz"}' | jqAvailable HIP-3 dexes: , , , ,
xyzflxvntlhynakmSpot Market Commands
For spot markets, use format for candles:
@{index}Get Spot Market Metadata
bash
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "spotMeta"}' | jqGet Spot Candles (use @index format)
bash
# HYPE/USDC candles (index 107)
curl -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "candleSnapshot", "req": {"coin": "@107", "interval": "1h", "startTime": 1704067200000, "endTime": 1704153600000}}' | jqTips
- Formatting: Pipe output to for pretty-printed JSON
jq - Timestamps: All times are in milliseconds (e.g., in JS,
Date.now()in bash)date +%s000 - Get current timestamp:
date +%s000 - Get timestamp from 24h ago:
echo $(($(date +%s) - 86400))000 - Asset names: Use symbols like ,
BTC,ETH,SOL(seeHYPEendpoint for full list)meta