The Hyperliquid API has a public info endpoint for market and account data, an exchange endpoint for signed orders, and a WebSocket for live streams. Reading needs no key; trading needs a signature from your wallet or an API wallet you approve. Every example below was run on November 17, 2026, and shows its real output.
Hyperliquid runs its order book on its own chain and publishes a public API for it. You can read every market without an account, and trade from code once you sign with a wallet. This guide covers the parts most people need: reading prices, books, candles and funding, streaming trades, placing an order with an API wallet, and staying under the rate limits.
Every sample uses Python. They were run on November 17, 2026, 19:58 UTC with Python 3.12, hyperliquid-python-sdk 0.24.0, requests 2.34.2, websockets 17.4, and the output under each one is what it printed then. Prices will differ when you run them.
| Endpoint | URL | Use |
|---|---|---|
| Info (REST) | POST https://api.hyperliquid.xyz/info | Market and account data. No key, no signature. |
| Exchange (REST) | POST https://api.hyperliquid.xyz/exchange | Orders, cancels, transfers. Every request is signed. |
| WebSocket | wss://api.hyperliquid.xyz/ws | Live trades, books, candles and your own fills. |
| Testnet | https://api.hyperliquid-testnet.xyz | The same API against test funds. |
From Hyperliquid’s API docs. Every info request is a POST with a JSON body whose type names what you want.
The mid price of every market comes back from one allMids request:
import requests
INFO = "https://api.hyperliquid.xyz/info"
mids = requests.post(INFO, json={"type": "allMids"}, timeout=10).json()
for coin in ["BTC", "ETH", "SOL"]:
print(coin, mids[coin])BTC 63759.5
ETH 1792.15
SOL 72.8515l2Book returns the order book, at most 20 levels a side. Each level carries a price, a size and an order count:
import requests
INFO = "https://api.hyperliquid.xyz/info"
book = requests.post(INFO, json={"type": "l2Book", "coin": "ETH"}, timeout=10).json()
bids, asks = book["levels"]
print("best bid", bids[0]["px"], "size", bids[0]["sz"])
print("best ask", asks[0]["px"], "size", asks[0]["sz"])
print("levels per side", len(bids), len(asks))best bid 1792.0 size 162.2541
best ask 1792.1 size 1.4758
levels per side 20 20candleSnapshot returns candles for a time range in milliseconds. The last row is the hour still in progress. Per the info endpoint docs, only the most recent 5,000 candles of an interval are available, and a ranged request returns at most 500 rows, so page through a long range by using the last timestamp as the next start. For longer ranges, Hyperliquid OHLCV data shows three other ways to get candles.
import time
import requests
INFO = "https://api.hyperliquid.xyz/info"
end = int(time.time() * 1000)
start = end - 3 * 60 * 60 * 1000 # the last three hours
body = {
"type": "candleSnapshot",
"req": {"coin": "BTC", "interval": "1h", "startTime": start, "endTime": end},
}
for c in requests.post(INFO, json=body, timeout=10).json():
print(c["t"], c["o"], c["h"], c["l"], c["c"], c["v"])1794931200000 64100.0 64463.0 63440.0 63728.0 6565.31994
1794934800000 63727.0 64121.0 63511.0 63805.0 2699.39595
1794938400000 63805.0 64077.0 63637.0 63742.0 2120.53112
1794942000000 63743.0 63880.0 63635.0 63759.0 966.44602metaAndAssetCtxs returns every market’s settings (size decimals, max leverage, margin table) beside its live context: mark price, the current hourly funding rate, open interest and volume. The max leverage it reports is the first margin tier; the full table for every market is on Hyperliquid max leverage.
import requests
INFO = "https://api.hyperliquid.xyz/info"
meta, ctxs = requests.post(INFO, json={"type": "metaAndAssetCtxs"}, timeout=10).json()
for asset, ctx in zip(meta["universe"], ctxs):
if asset["name"] in ("BTC", "ETH"):
print(
asset["name"],
"max leverage", asset["maxLeverage"],
"mark", ctx["markPx"],
"funding", ctx["funding"],
"open interest", ctx["openInterest"],
)BTC max leverage 40 mark 63763.0 funding 0.0000100266 open interest 37574.2842
ETH max leverage 25 mark 1792.1 funding -0.0000092399 open interest 614280.1663999998Funding here is the rate for the current hour. To compare it across markets, or see how it has moved, the Hyperliquid funding rates page ranks every market, and Hyperliquid historical data shows how far back each series goes.
Connect to wss://api.hyperliquid.xyz/ws and send a subscribe message. The first reply confirms the subscription; trade messages follow on the trades channel, each with a side, price, size and time in milliseconds.
import asyncio
import json
import websockets
async def main():
async with websockets.connect("wss://api.hyperliquid.xyz/ws") as ws:
await ws.send(json.dumps({
"method": "subscribe",
"subscription": {"type": "trades", "coin": "BTC"},
}))
while True:
msg = json.loads(await ws.recv())
if msg["channel"] == "trades":
for trade in msg["data"][:3]:
print(trade["side"], trade["px"], trade["sz"], trade["time"])
break
asyncio.run(main())A 63759.0 0.00016 1794945476898
A 63759.0 0.00003 1794945476898
B 63760.0 0.02048 1794945478930The same connection takes subscriptions for books, candles, mid prices and your own orders and fills. Hyperliquid’s WebSocket docs say servers may disconnect without notice, so a bot should reconnect on its own; data missed in between arrives in the snapshot sent when you subscribe again.
Hyperliquid lists hyperliquid-python-sdk on its API page (pip install hyperliquid-python-sdk). It wraps the same requests: Info for data, Exchange for signed actions. The universe in meta also lists delisted markets, flagged isDelisted, so filter them out:
from hyperliquid.info import Info
from hyperliquid.utils import constants
info = Info(constants.MAINNET_API_URL, skip_ws=True)
print("BTC mid", info.all_mids()["BTC"])
live = [a for a in info.meta()["universe"] if not a.get("isDelisted")]
print("live perp markets", len(live))BTC mid 63759.5
live perp markets 179Hyperliquid has no API key in the usual exchange sense. Every action sent to the exchange endpoint is signed by a wallet. You could sign with your main wallet, but a bot normally signs with an API wallet (also called an agent wallet). Per the nonces and API wallets docs, a master account approves an API wallet to sign on behalf of itself or any of its sub-accounts. The API wallet only signs: to read balances, positions and fills you still query the master account’s address.
approve_agent, signed by your main wallet. Keep the API wallet’s key on the server and the main key off it.A limit order through the SDK, with the API wallet signing for your main account:
import os
from eth_account import Account
from hyperliquid.exchange import Exchange
from hyperliquid.utils import constants
# Sign with an API wallet your main wallet approved; trade for the main account.
api_wallet = Account.from_key(os.environ["HL_API_WALLET_KEY"])
exchange = Exchange(
api_wallet,
constants.TESTNET_API_URL, # switch to MAINNET_API_URL when you are ready
account_address=os.environ["HL_ACCOUNT_ADDRESS"],
)
# Buy 0.01 ETH with a post-only limit order ("Alo" = add liquidity only).
result = exchange.order("ETH", True, 0.01, 1500.0, {"limit": {"tif": "Alo"}})
print(result)An app that sends orders for its users can also attach a builder code to each one and charge a fee on the fill. The user approves a maximum first. How it works, and the caps: Hyperliquid builder codes.
| What | Limit |
|---|---|
| REST requests per IP | A shared weight budget of 1,200 per minute |
| Light info requests | Weight 2: l2Book, allMids, clearinghouseState, orderStatus, spotClearinghouseState, exchangeStatus |
| Other info requests | Weight 20 (userRole is 60); candleSnapshot and the history requests add weight for long responses |
| Exchange actions | Weight 1 + floor(batch length / 40) |
| WebSocket | 10 connections, 30 new connections a minute, 1,000 subscriptions, 2,000 messages a minute |
| Per address | 1 request per 1 USDC traded since the address was created, after an initial buffer of 10,000 |
From Hyperliquid’s rate limits docs, read November 17, 2026. A rate-limited address may send one request every 10 seconds. The WebSocket has limits of its own, so data you need often is usually better streamed than polled.
Calling the API is the easy part. Testing a strategy on it also takes clean history, plus fees, slippage and funding charged the way the venue charges them. Keel does that work on Hyperliquid data:
Open your assistant with this request already written. It reads this page, helps with your script, and shows you how to test the idea in Keel.
Keel is a strategy builder for Hyperliquid. Describe an idea, backtest it with fees, slippage and funding, and run it live on Hyperliquid’s crypto perps. Stock and index perps are coming soon.
Start free. Connect a Hyperliquid wallet when you’re ready to trade.
Yes, and it is public. The info endpoint (POST https://api.hyperliquid.xyz/info) serves prices, order books, candles, funding and account state without a key. The exchange endpoint takes signed orders, and a WebSocket at wss://api.hyperliquid.xyz/ws streams the same data live.
Yes. Hyperliquid lists hyperliquid-python-sdk on GitHub (pip install hyperliquid-python-sdk). Its Info class reads data and its Exchange class signs orders. Hyperliquid's docs also list community SDKs for Rust and TypeScript.
REST requests from one IP share a weight budget of 1,200 per minute. Light info requests such as l2Book and allMids weigh 2, most others 20. A WebSocket allows 10 connections and 1,000 subscriptions per IP. Each address also gets 1 request per 1 USDC it has traded, after an initial buffer of 10,000.
Not to read data. To trade, there is no key in the usual exchange sense: you sign each request with a wallet. Most bots sign with an API wallet (also called an agent wallet) that your main wallet approves, so the main wallet's key never sits on a server.
A separate key that your main account approves to sign actions on its behalf, or on behalf of a sub-account. It only signs: to read your balances and positions you still query your main account's address. Hyperliquid's docs advise using a fresh API wallet address rather than reusing an old one.
In Hyperliquid's own docs, under For developers, API. The pages this guide quotes are linked beside each section: the info endpoint, the WebSocket, rate limits, and nonces and API wallets.
Candles for every Hyperliquid market, in the web app, the Python SDK or the CLI.
Every market's leverage cap and margin tiers, read from the venue's own data.
How an app earns a fee on the orders it sends, and what a trader approves.