Hyperliquid API Guide: REST Endpoints, WebSocket, Python SDK, Rate Limits, 422/429 Errors and HyperEVM RPC (2026)
Hyperliquid API explained: /info and /exchange endpoints, WebSocket subscriptions, Python SDK examples, rate limits, fixing 422 and 429 errors, HyperEVM RPC (chain 999) and nodes (2026).
The Hyperliquid API is a free, keyless REST and WebSocket interface at api.hyperliquid.xyz: POST to /info for market and account data, POST signed actions to /exchange to trade, and subscribe to wss://api.hyperliquid.xyz/ws for real-time books, trades and fills. An official Python SDK handles signing, HyperEVM is reachable at https://rpc.hyperliquid.xyz/evm (chain ID 999), and rate limits of 1,200 weight per minute per IP apply. This guide covers every endpoint group, working code snippets, rate-limit math, fixing 422 and 429 errors, RPC providers such as QuickNode, historical data sources and the basics of running a node.
Key takeaways
- Two REST endpoints, both POST with JSON bodies:
/info(public data, no signature) and/exchange(orders, cancels, transfers, signed with EIP-712). - WebSocket at
wss://api.hyperliquid.xyz/wsstreams order books, trades, candles, user fills and order updates. - No API key is needed; trading is authorized by a wallet signature or an agent (API) wallet you create in the app.
- Rate limits: 1,200 weight/minute per IP on REST; per-address limits on
/exchangescale with volume traded; WebSocket has connection and subscription caps. - 422 = bad payload or signature; 429 = rate limited. Both are fixable client-side.
- HyperEVM RPC:
https://rpc.hyperliquid.xyz/evm, chain ID 999 (testnet 998), gas in HYPE; QuickNode and others provide premium RPC.
Hyperliquid API overview and docs
Hyperliquid's docs live at hyperliquid.gitbook.io/hyperliquid-docs, with the API section under "For developers." The official code, including the Python SDK, Rust SDK and node software instructions, is on the hyperliquid-dex GitHub organization. Because every action on the chain is a signed transaction, the API is not an abstraction over a private matching engine; it is the same interface the Hyperliquid app DEX front end uses. Anything you can do in the app you can do programmatically, and everything you read is on-chain state.
| Environment | REST base | WebSocket | HyperEVM RPC | Chain ID |
|---|---|---|---|---|
| Mainnet | https://api.hyperliquid.xyz |
wss://api.hyperliquid.xyz/ws |
https://rpc.hyperliquid.xyz/evm |
999 |
| Testnet | https://api.hyperliquid-testnet.xyz |
wss://api.hyperliquid-testnet.xyz/ws |
https://rpc.hyperliquid-testnet.xyz/evm |
998 |
Get free testnet USDC from the faucet; see the testnet and faucet guide.
REST endpoints: /info and /exchange
The /info endpoint
All reads go to /info as a POST with a JSON body whose type selects the query. No authentication is required. The most used request types:
type |
Returns | Weight |
|---|---|---|
allMids |
Mid price for every perp and spot market | 2 |
meta |
Perp universe: names, asset indices, max leverage, size decimals | 20 |
spotMeta |
Spot tokens and pairs | 20 |
metaAndAssetCtxs |
Meta plus funding, open interest, oracle and mark price per asset | 20 |
l2Book |
Order book snapshot for one coin (coin, optional nSigFigs) |
2 |
recentTrades |
Recent public trades for a coin | 20 |
candleSnapshot |
OHLCV candles (coin, interval, startTime, endTime) |
20 |
fundingHistory |
Historical hourly funding for a coin | 20 |
predictedFundings |
Next-hour funding predictions vs other venues | 20 |
clearinghouseState |
A user's perp positions, margin and account value | 2 |
spotClearinghouseState |
A user's spot balances | 2 |
openOrders / frontendOpenOrders |
A user's resting orders | 20 |
userFills / userFillsByTime |
A user's trade history | 20 |
userFunding |
Funding payments for a user | 20 |
orderStatus |
Status of one order by oid or cloid |
2 |
vaultDetails |
Vault performance and depositors | 20 |
delegations / delegatorSummary |
Staking data | 20 |
Example: fetch every mid price with curl.
curl -s -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "allMids"}'
Response (truncated):
{"BTC": "112345.5", "ETH": "4123.45", "SOL": "198.32", "HYPE": "41.87", "@107": "0.1234"}
Perp coins are keyed by symbol; spot pairs are keyed by @index (map them with spotMeta). HIP-3 markets use a deployer:SYMBOL style name such as xyz:XYZ100, so query meta with the deployer's dex name to list them.
Example: a BTC order book with five significant figures.
curl -s -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "l2Book", "coin": "BTC", "nSigFigs": 5}'
Example: your perp account state.
curl -s -X POST https://api.hyperliquid.xyz/info \
-H "Content-Type: application/json" \
-d '{"type": "clearinghouseState", "user": "0xYourAddress"}'
The /exchange endpoint
Every state change is a POST to /exchange with three parts: an action object, a nonce (millisecond timestamp, strictly increasing per address) and a signature. Action types include order, cancel, cancelByCloid, modify, batchModify, updateLeverage, updateIsolatedMargin, usdSend, spotSend, withdraw3, vaultTransfer, approveAgent, approveBuilderFee, twapOrder and scheduleCancel. Orders reference assets by integer index from meta, and prices and sizes are strings that must respect each asset's tick and lot rules (up to 5 significant figures for price, szDecimals for size).
Signing is the part that trips people up, which is why the SDK exists.
Hyperliquid Python SDK
Install the official client:
pip install hyperliquid-python-sdk
Read data and place a limit order:
from hyperliquid.info import Info
from hyperliquid.exchange import Exchange
from hyperliquid.utils import constants
import eth_account
# --- read-only ---
info = Info(constants.MAINNET_API_URL, skip_ws=True)
mids = info.all_mids()
print("ETH mid:", mids["ETH"])
state = info.user_state("0xYourAddress")
print("Account value:", state["marginSummary"]["accountValue"])
# --- trading with an agent (API) wallet ---
agent = eth_account.Account.from_key("0xAGENT_PRIVATE_KEY")
exchange = Exchange(
agent,
constants.MAINNET_API_URL,
account_address="0xYourMainAddress", # the account the agent trades for
)
# limit buy 0.01 ETH at $4000, good-till-cancel, post-only
result = exchange.order(
"ETH", True, 0.01, 4000.0,
{"limit": {"tif": "Alo"}},
)
print(result)
# cancel it
oid = result["response"]["data"]["statuses"][0]["resting"]["oid"]
print(exchange.cancel("ETH", oid))
Notes:
- Create the agent wallet in the app under More → API, or with
exchange.approve_agent(). The agent can trade but cannot withdraw, which is the safe pattern for bots. tifvalues:Gtc(good till cancel),Ioc(immediate or cancel),Alo(add liquidity only, i.e. post-only).- Use
exchange.market_open()andexchange.market_close()for slippage-capped market orders, andexchange.update_leverage(leverage, coin, is_cross)before opening. - For HIP-3 and spot assets, the SDK resolves names to indices for you.
A Rust SDK and community TypeScript/Go clients also exist on the hyperliquid-dex GitHub.
Hyperliquid WebSocket API
Connect to wss://api.hyperliquid.xyz/ws and send JSON subscription messages. Key subscription types:
| Subscription | Payload | Streams |
|---|---|---|
allMids |
{"type":"allMids"} |
All mid prices on change |
l2Book |
{"type":"l2Book","coin":"BTC"} |
Full book snapshots on every update |
trades |
{"type":"trades","coin":"BTC"} |
Public trades |
candle |
{"type":"candle","coin":"ETH","interval":"1m"} |
Live candles |
bbo |
{"type":"bbo","coin":"SOL"} |
Best bid/offer only |
userFills |
{"type":"userFills","user":"0x..."} |
Your fills |
orderUpdates |
{"type":"orderUpdates","user":"0x..."} |
Order state changes |
userEvents |
{"type":"userEvents","user":"0x..."} |
Fills, funding, liquidations |
activeAssetCtx |
{"type":"activeAssetCtx","coin":"BTC"} |
Funding, OI, mark/oracle |
Subscribe to the BTC book and trades:
{"method": "subscribe", "subscription": {"type": "l2Book", "coin": "BTC"}}
{"method": "subscribe", "subscription": {"type": "trades", "coin": "BTC"}}
Unsubscribe with "method": "unsubscribe", and send {"method": "ping"} every 50 seconds or the server will close idle connections. You can also post signed actions over the WebSocket using {"method": "post", "id": 1, "request": {"type": "action", "payload": {...}}}, which shaves a round trip for latency-sensitive bots. Limits: a maximum number of concurrent connections per IP and subscriptions per connection (both in the low hundreds), so multiplex rather than opening a socket per market.
With the Python SDK:
from hyperliquid.info import Info
from hyperliquid.utils import constants
info = Info(constants.MAINNET_API_URL)
info.subscribe({"type": "l2Book", "coin": "ETH"}, lambda msg: print(msg["data"]["levels"][0][:3]))
Hyperliquid rate limits
Rate limits protect the chain, and they are generous if you design around them.
| Limit | Value (as of September 2026) | Scope |
|---|---|---|
| REST aggregate | 1,200 weight per minute | Per IP |
/exchange action weight |
1 + floor(batch length / 40) | Per request |
Light /info queries (allMids, l2Book, clearinghouseState, orderStatus) |
Weight 2 | Per request |
Standard /info queries |
Weight 20 | Per request |
Heavy /info queries (userRole, some explorer calls) |
Weight 60 | Per request |
Address-based /exchange limit |
1 request per $1 of cumulative volume, 10,000-request initial buffer | Per address |
| Open orders per address | 1,000 (higher with volume) | Per address |
| WebSocket connections / subscriptions | Capped per IP and per connection | Per IP |
The address-based rule matters most for bots: an address that has traded $1M cumulatively has earned roughly 1,010,000 /exchange requests over its lifetime; if you spam cancels without trading, you will exhaust the 10,000 buffer and receive 429s until you generate volume. Batch orders (up to 40 per weight unit), use modify instead of cancel-and-replace, and lean on WebSocket for data.
Full details: Hyperliquid API docs, rate limits.
Fixing Hyperliquid 422 and 429 errors
| Error | Meaning | Typical cause | Fix |
|---|---|---|---|
| 422 Unprocessable Entity | Payload rejected | Wrong field names/types, invalid type, price with >5 sig figs, size with too many decimals, unknown asset index, missing nonce |
Validate against the docs; round price/size per meta (szDecimals); use the SDK's helpers |
| 422 on /exchange | Signature or nonce invalid | Signed the wrong chain/domain, wrong isMainnet flag, nonce not increasing, agent not approved for that account |
Re-check EIP-712 domain, ensure nonce is fresh ms timestamp, confirm approveAgent was done on the same network |
422 with "Order must have minimum value of $10" |
Below min notional | Size × price < $10 | Increase size |
422 with "Insufficient margin" |
Not enough collateral | Leverage too low for size or funds in spot balance | Transfer USDC to perps, adjust leverage |
| 429 Too Many Requests | Rate limited | Exceeded 1,200 weight/min per IP or address buffer | Exponential backoff, batch, WebSocket, trade to earn address budget |
| 429 on WebSocket | Too many connections/subs | Opening a socket per market | Multiplex subscriptions on fewer connections |
| 400 Bad Request | Malformed JSON | Trailing commas, wrong content type | Send Content-Type: application/json |
| 500 / timeouts | Server side | Chain upgrade or extreme load | Retry with jitter; check status channels |
A reliable debugging routine for "hyperliquid api 422": log the exact request body, compare it field by field with the SDK's output for the same action, and test on testnet first. Nine times out of ten the culprit is a price string like "4000.123456" (too many significant figures) or a stale nonce from a clock drift.
EIP-712 signing and EIP-7702
Hyperliquid authenticates /exchange actions with EIP-712 typed-data signatures. Two flavors exist:
- L1 actions (orders, cancels, leverage) are signed over a hash of the msgpack-encoded action, the nonce and an optional vault address, using the "Exchange" domain with chain ID 1337. The SDK handles this.
- User-signed actions (USDC transfers, withdrawals, agent approvals) are signed as human-readable EIP-712 messages with the Arbitrum chain ID so wallets display them clearly.
EIP-7702, the Ethereum account-abstraction upgrade that lets an EOA temporarily act as a smart-contract wallet, is relevant on HyperEVM: wallets can batch approvals and calls in one signature. As of September 2026 HyperCore itself still expects standard EOA or agent signatures; 7702-delegated accounts interact with HyperCore via the CoreWriter system contract from HyperEVM. If you see "hyperliquid 7702" in wallet prompts, it refers to delegating your EOA on HyperEVM, not to HyperCore trading.
👉 Open the Hyperliquid app and save 4% on fees
HyperEVM RPC: chain ID 999
HyperEVM is a standard EVM chain, so any Ethereum tooling works.
| Setting | Mainnet | Testnet |
|---|---|---|
| RPC URL | https://rpc.hyperliquid.xyz/evm |
https://rpc.hyperliquid-testnet.xyz/evm |
| Chain ID | 999 | 998 |
| Currency | HYPE | HYPE (test) |
| Explorer | HyperScan / Hypurrscan / Purrsec | Testnet explorers |
Add it to MetaMask or Rabby with those values. The public RPC is rate-limited and suits wallets and light scripts; for indexers, bots and dApps use a provider.
QuickNode Hyperliquid RPC and other providers
QuickNode offers dedicated HyperEVM endpoints (HTTP and WebSocket) with archive access, higher rate limits and add-ons, and it has also wrapped HyperCore /info calls as a QuickNode Hyperliquid API for teams who want one billing relationship. Alchemy-style providers, dRPC, Chainstack, Ankr and several community nodes also serve chain 999. When choosing, check for archive state (needed for historical balance queries), eth_getLogs range limits, and whether the provider exposes the HyperCore precompiles that let contracts read exchange state.
HyperEVM specifics worth knowing: blocks alternate between small fast blocks (about 1 second, 2M gas) and large slow blocks (about 1 minute, 30M gas); contracts read HyperCore data through precompiles at reserved addresses and write to it through CoreWriter; and HYPE is bridged between HyperCore and HyperEVM through a system address. See the HyperEVM guide.
Hyperliquid historical data
For Hyperliquid data beyond live feeds:
candleSnapshotreturns up to 5,000 candles per call at intervals from 1m to 1M; page withstartTime.userFillsByTimeandfundingHistorypage through account and funding history.- Public S3 archive: Hyperliquid publishes raw L2 book snapshots, trades and node data to a public bucket (
hyperliquid-archive), useful for backtesting order-flow strategies; expect terabytes. - Third-party datasets: Coinglass (liquidations, OI, funding), Hyperdash and Hypurrscan (wallet and vault history), DefiLlama (volume and fees), Dune (community dashboards), Amberdata and Kaiko (institutional feeds).
- Your own node: the only way to get complete, verifiable history of all state transitions.
Funding and open-interest interpretation is covered in the funding rates guide, and whale tracking sources in the whale tracker guide.
Running a Hyperliquid node
Hyperliquid Labs publishes the node binaries and setup guide in the hyperliquid-dex/node repository. The essentials as of September 2026:
- Hardware: a modern multi-core server, 32 GB+ RAM, fast NVMe storage (state grows quickly at billions of dollars of daily volume), and a low-latency connection; Tokyo-region hosting minimizes latency to the validator set.
- Modes: a non-validating node replays blocks and serves local
/info-style data and raw state to your applications; a validator requires substantial HYPE stake and being admitted to the active set. - Outputs: the node writes block data, trades, fills and order-book updates to local files that you can stream into a database, which is how the serious market-data firms build their Hyperliquid datasets.
- HyperEVM: the node also exposes the EVM RPC locally, giving you an unthrottled
rpc hyperliquidendpoint.
Node software is distributed as binaries rather than full source as of this writing, a point critics raise; see Is Hyperliquid safe?.
Builder codes and bot platforms
If you are building a front end or bot for other people, builder codes let you attach a fee (approved once per user via approveBuilderFee) to orders you route, up to the user's cap. This is how Lootbase, Dexari, 3commas and Freqtrade integrations monetize. Our trading bots and builder codes guide covers the approval flow, and remember fees are set on top of the base schedule in Hyperliquid fees.
Practical tips for API traders
- Develop on testnet (chain 998, testnet API) with faucet USDC before touching mainnet.
- Use an agent wallet so your bot can never withdraw funds.
- Cache
metaonce per session; asset indices change when markets are added. - Round correctly: price to 5 significant figures (and at most 6 decimals for perps), size to
szDecimals. - Keep clocks synced; nonces are timestamps.
- Prefer
Aloorders for maker fees andIocwith a slippage cap for fills. - Reconcile via
userFillsafter reconnects; WebSocket messages can be missed. - Respect risk: an API bot can lose money faster than a human. Read the leverage and liquidation guide and start with small size. Nothing here is financial advice.
Bottom line
The Hyperliquid API gives you the full exchange, keyless and free: POST /info for any market or account data, POST signed actions to /exchange to trade, and stream everything over wss://api.hyperliquid.xyz/ws. The official Python SDK removes the signing pain, rate limits of 1,200 weight per minute and a volume-linked address budget are easy to live within if you batch and subscribe rather than poll, and 422/429 errors almost always trace back to payload formatting or request pacing. HyperEVM adds a standard RPC at chain ID 999 with QuickNode and others for scale, and a node gives you complete historical data. Build on testnet, trade through an agent wallet, and you have the same infrastructure the biggest market makers on Hyperliquid use.
Frequently Asked Questions
What is the Hyperliquid API base URL?
Mainnet REST requests go to https://api.hyperliquid.xyz with two POST endpoints: /info for market and account data and /exchange for signed actions such as orders and cancels. The WebSocket endpoint is wss://api.hyperliquid.xyz/ws. Testnet uses https://api.hyperliquid-testnet.xyz and wss://api.hyperliquid-testnet.xyz/ws with the same request formats.
Why am I getting a 422 error from the Hyperliquid API?
HTTP 422 means the server understood the request but could not process it: usually a malformed JSON body, a wrong field name or type, an invalid asset index, a price or size that violates tick or lot rules, or a bad signature or nonce on an /exchange action. Validate the payload against the docs and, for signed actions, use the official SDK to build it.
What does a 429 error on Hyperliquid mean?
429 is a rate-limit response. REST calls are capped at 1,200 weight per minute per IP, and /exchange actions are also limited per address (roughly one request per $1 of cumulative volume traded, with a 10,000-request starting buffer). Back off exponentially, batch orders, use WebSocket subscriptions instead of polling, and spread bots across addresses that actually trade.
Is there an official Hyperliquid Python SDK?
Yes. hyperliquid-python-sdk on the hyperliquid-dex GitHub organization is the official client. Install it with pip install hyperliquid-python-sdk. It wraps the Info and Exchange endpoints, handles EIP-712 signing and nonces, and includes WebSocket helpers and examples for orders, cancels, transfers and vault operations.
What is the HyperEVM RPC URL and chain ID?
The public HyperEVM RPC is https://rpc.hyperliquid.xyz/evm with chain ID 999 (testnet: https://rpc.hyperliquid-testnet.xyz/evm, chain ID 998). Gas is paid in HYPE. QuickNode, Alchemy-style providers and several community nodes offer higher-throughput archive and WebSocket RPC endpoints for HyperEVM.
Where can I get Hyperliquid historical data?
The /info endpoint returns candles (candleSnapshot), recent trades, funding history and user fills for recent windows. For deep history, Hyperliquid publishes raw L2 book and trade data to a public S3 bucket, and third parties such as Coinglass, Hyperdash, DefiLlama, Dune and Amberdata offer processed datasets. Running your own node gives complete state history.
Ready to trade on the Hyperliquid app?
Open the official Hyperliquid DEX with our referral link and get a lifetime 4% discount on trading fees. No KYC, no gas fees, self-custody.
Open Hyperliquid App · Save 4%Disclaimer: This article is for educational purposes only and is not financial, investment or legal advice. Perpetual futures trading with leverage carries a high risk of loss. Read our full disclaimer.