The Hyperliquid API rate limit applies per IP: REST requests count against a weight budget, and WebSocket use has its own limits. All processes and containers behind the same public IP share those limits.
Hyperliquid API rate limits, from the documentation
Use Hyperliquid’s rate limits and user limits for current budgets. Include traffic from other applications sharing the address.
REST: 1,200 weight per minute
REST requests share an aggregated weight limit of 1,200 per minute. Each request costs a weight that depends on what it is:
| Request | Weight |
|---|---|
/info: l2Book, allMids, clearinghouseState, orderStatus, spotClearinghouseState, exchangeStatus |
2 |
/info: userRole |
60 |
All other documented /info requests |
20 |
/exchange actions |
1 + floor(batch_length / 40) |
explorer requests |
40 |
Some /info requests also add weight for every 20 items they return: recentTrades, historicalOrders, userFills, userFillsByTime, fundingHistory, userFunding, nonUserFundingUpdates, twapHistory, userTwapSliceFills, userTwapSliceFillsByTime, delegatorHistory, delegatorRewards and validatorStats. candleSnapshot adds weight per 60 items. The page does not say how much each block of items adds, so treat those endpoints as more expensive than their base weight of 20, and the larger the response, the more expensive.
For actions, batch_length is the length of the array in the action, such as the number of orders in one batched order request. An unbatched action weighs 1, and a batch of 79 orders weighs 2. A batched request with n orders or cancels counts as one request for the IP limit.
WebSocket limits
- 10 WebSocket connections
- 30 new WebSocket connections per minute
- 1,000 WebSocket subscriptions
- 10 unique users across user specific WebSocket subscriptions
- 2,000 messages sent to Hyperliquid per minute across all WebSocket connections
- 100 simultaneous in flight post messages across all WebSocket connections
Address based limits
Besides the per IP Hyperliquid API rate limit, there is a separate limit per account address. It applies to actions such as orders and cancels, not to /info requests, so it is not what causes a 429 on reads. The rules for it are on the same page.
Work out what a polling loop costs
Most 429s come from polling loops that were never added up. The weights above are enough to do the sum before you write the loop. Save this as weights.ts:
// Request weights from Hyperliquid's "Rate limits and user limits" page (read 27 Nov 2026).
export const REST_WEIGHT_PER_MINUTE = 1200;
const INFO_WEIGHT_2 = new Set([
'l2Book',
'allMids',
'clearinghouseState',
'orderStatus',
'spotClearinghouseState',
'exchangeStatus',
]);
// These add weight per 20 returned items (candleSnapshot per 60). The page does not say how much.
const INFO_PER_ITEM = new Set([
'recentTrades',
'historicalOrders',
'userFills',
'userFillsByTime',
'fundingHistory',
'userFunding',
'nonUserFundingUpdates',
'twapHistory',
'userTwapSliceFills',
'userTwapSliceFillsByTime',
'delegatorHistory',
'delegatorRewards',
'validatorStats',
'candleSnapshot',
]);
/** Base weight of one /info request. Item based extras are not included. */
export function infoWeight(type: string): number {
if (INFO_WEIGHT_2.has(type)) return 2;
if (type === 'userRole') return 60;
return 20;
}
export function hasItemWeight(type: string): boolean {
return INFO_PER_ITEM.has(type);
}
/** Weight of one /exchange action: 1 + floor(batch_length / 40). */
export function actionWeight(batchLength = 1): number {
return 1 + Math.floor(batchLength / 40);
}
/** Weight per minute for one request type sent every intervalMs. */
export function weightPerMinute(type: string, intervalMs: number): number {
return infoWeight(type) * (60_000 / intervalMs);
}
Now price a typical loop: for each account, read clearinghouseState, openOrders and userFills every 5 seconds. Save this as budget.ts:
import { infoWeight, hasItemWeight, weightPerMinute, REST_WEIGHT_PER_MINUTE, actionWeight } from './weights.ts';
// One polling loop per account address, every 5 seconds.
const pollMs = 5_000;
const perAccount = [
{ type: 'clearinghouseState', every: pollMs },
{ type: 'openOrders', every: pollMs },
{ type: 'userFills', every: pollMs },
];
let perAccountWeight = 0;
for (const { type, every } of perAccount) {
const w = weightPerMinute(type, every);
perAccountWeight += w;
const note = hasItemWeight(type) ? ' + extra weight per 20 fills returned' : '';
console.log(`${type.padEnd(19)} weight ${String(infoWeight(type)).padStart(2)} x ${60_000 / every}/min = ${w}${note}`);
}
console.log(`Per account: at least ${perAccountWeight} of ${REST_WEIGHT_PER_MINUTE} per minute`);
console.log(`Accounts that fit before item extras: ${Math.floor(REST_WEIGHT_PER_MINUTE / perAccountWeight)}`);
console.log(`One weight 20 request every 5 s: ${weightPerMinute('openOrders', 5_000)} per minute`);
console.log(`Order batch of 1: ${actionWeight(1)}, of 39: ${actionWeight(39)}, of 40: ${actionWeight(40)}, of 79: ${actionWeight(79)}`);
Run it with node budget.ts. These numbers are computed from the documented weights, not measured:
clearinghouseState weight 2 x 12/min = 24
openOrders weight 20 x 12/min = 240
userFills weight 20 x 12/min = 240 + extra weight per 20 fills returned
Per account: at least 504 of 1200 per minute
Accounts that fit before item extras: 2
One weight 20 request every 5 s: 240 per minute
Order batch of 1: 1, of 39: 1, of 40: 2, of 79: 2
One account polled every 5 seconds already uses at least 504 of the 1,200 weight a minute, and two accounts use at least 1,008, before counting the extra weight for fills or any other script on the same IP. A third account does not fit. The weight 2 call is cheap; the weight 20 calls are what fill the budget. That points to two fixes: count weight in code, and move the frequent reads off REST.
Enforce the Hyperliquid API rate limit in code
The SDK does not throttle requests. RestClient sends each request as soon as you call it, and the SDK docs’ troubleshooting guide notes that HTTP requests are not retried automatically. So a budget has to live in your code. This limiter keeps a sliding window of the weight spent and waits when the next request would go over. Save it as weight-limiter.ts:
/**
* Client side budget for Hyperliquid REST weight, over a sliding window.
* The SDK does not throttle requests itself, so this sits in front of it.
*/
export class WeightLimiter {
private readonly spent: { at: number; weight: number }[] = [];
private readonly maxWeight: number;
private readonly windowMs: number;
constructor(maxWeight: number, windowMs = 60_000) {
this.maxWeight = maxWeight;
this.windowMs = windowMs;
}
used(now = Date.now()): number {
while (this.spent.length && now - this.spent[0]!.at >= this.windowMs) {
this.spent.shift();
}
return this.spent.reduce((sum, s) => sum + s.weight, 0);
}
async run<T>(weight: number, request: () => Promise<T>): Promise<T> {
if (weight > this.maxWeight) {
throw new RangeError(`Weight ${weight} is larger than the whole budget of ${this.maxWeight}.`);
}
while (this.used() + weight > this.maxWeight) {
// Wait until the oldest entry leaves the window.
const waitMs = this.spent[0]!.at + this.windowMs - Date.now();
await new Promise((resolve) => setTimeout(resolve, Math.max(waitMs, 1)));
}
this.spent.push({ at: Date.now(), weight });
return request();
}
}
To see it wait without spending a minute, this demo gives it 60 weight per 10 second window and makes five weight 20 meta calls. Save it as limiter-demo.ts:
import { RestClient } from '@siebly/hyperliquid-api';
import { WeightLimiter } from './weight-limiter.ts';
import { infoWeight } from './weights.ts';
const client = new RestClient();
// Demo values: 60 weight per 10 s window, so the wait is visible quickly.
// In production use something below 1200 per 60_000 ms, shared by every process on the IP.
const limiter = new WeightLimiter(60, 10_000);
const start = Date.now();
for (let i = 1; i <= 5; i++) {
const meta = await limiter.run(infoWeight('meta'), () => client.getPerpMetadata());
const seconds = ((Date.now() - start) / 1000).toFixed(1);
console.log(`call ${i} at ${seconds} s: ${meta.universe.length} perps, window used ${limiter.used()}`);
}
call 1 at 1.4 s: 235 perps, window used 20
call 2 at 2.0 s: 235 perps, window used 40
call 3 at 2.5 s: 235 perps, window used 60
call 4 at 10.5 s: 235 perps, window used 60
call 5 at 12.0 s: 235 perps, window used 40
The first three calls go straight through and use the whole window. Call 4 waits until the first call’s weight leaves the window, then goes out. In production, set the budget to less than 1,200 per 60,000 ms, leaving room for anything else on the same IP, and share one limiter across the process. If several processes share an IP, give each a fixed share of the budget.
For item based endpoints such as userFills, the limiter only knows the base weight. Leave a margin for those, or keep them off REST altogether, as described below.
What a 429 looks like in the SDK
When Hyperliquid answers with an HTTP error, RestClient throws a HyperliquidApiError. From the SDK source, the error carries the HTTP status, the response body as response, and the HTTP client’s error code. Its message is the response body when the body is a string, and otherwise the HTTP client’s own message. There is no retry and no backoff inside the SDK.
For an HTTP 429, branch on the SDK error’s HTTP status. The following example uses a simulated empty response body.
[429 empty body] instanceof HyperliquidApiError: true
[429 empty body] name: HyperliquidApiError; message: "Request failed with status code 429"; status: 429; code: ERR_BAD_REQUEST; response: ""
requests made for one call: 1
[429 text body] instanceof HyperliquidApiError: true
[429 text body] name: HyperliquidApiError; message: "stub body: too many requests"; status: 429; code: ERR_BAD_REQUEST; response: "stub body: too many requests"
The message changes with the body, so do not match on message text. Check error instanceof HyperliquidApiError && error.status === 429. Save this retry helper as retry-429.ts:
import { HyperliquidApiError } from '@siebly/hyperliquid-api';
/**
* Retry a request when Hyperliquid answers HTTP 429.
* The SDK throws HyperliquidApiError with status 429 and does not retry by itself.
*/
export async function withRetryOn429<T>(
request: () => Promise<T>,
{ attempts = 4, firstDelayMs = 1_000, maxDelayMs = 30_000 } = {},
): Promise<T> {
for (let attempt = 1; ; attempt++) {
try {
return await request();
} catch (error) {
const limited = error instanceof HyperliquidApiError && error.status === 429;
if (!limited || attempt >= attempts) throw error;
const delay = Math.min(maxDelayMs, firstDelayMs * 2 ** (attempt - 1));
const jitter = Math.random() * delay * 0.2;
console.warn(`HTTP 429 on attempt ${attempt}, retrying in ${Math.round(delay + jitter)} ms`);
await new Promise((resolve) => setTimeout(resolve, delay + jitter));
}
}
}
Output against a local test server that answers 429 twice and then succeeds:
HTTP 429 on attempt 1, retrying in 236 ms
HTTP 429 on attempt 2, retrying in 470 ms
after retries: {"BTC":"60000.0"} total requests: 3
The example uses a 200 ms first delay; the default is 1,000 ms. Use the retry for /info reads. A retry is a sign that the budget is wrong, so log it and fix the loop rather than relying on it. For signed actions, be more careful: before you resend an order, find out whether the first attempt was processed. A client order id makes that check possible, as covered in Hyperliquid cloid and scheduleCancel in Node.js.
Stop polling: move frequent reads to WebSocket subscriptions
The REST weight limit applies to REST requests. A WebSocket subscription costs one subscribe message and then pushes updates to you, so the reads in the polling loop above can move off REST entirely. The limits that apply instead are the WebSocket ones: connections, subscriptions, unique users and messages sent.
This script subscribes to the same three feeds for each account, enforces the 10 unique users cap before subscribing, and counts the messages it sends using the SDK’s trace logger. Addresses come from an environment variable. Save it as ws-account.ts:
import { DefaultLogger, WebsocketClient, type WebsocketSubscription } from '@siebly/hyperliquid-api';
const MAX_UNIQUE_USERS = 10; // Hyperliquid's documented cap across user specific subscriptions
const users = (process.env.HYPERLIQUID_ACCOUNT_ADDRESSES ?? '')
.split(',')
.map((u) => u.trim().toLowerCase())
.filter((u) => /^0x[0-9a-f]{40}$/.test(u));
if (!users.length) throw new Error('Set HYPERLIQUID_ACCOUNT_ADDRESSES to one or more 0x addresses.');
if (new Set(users).size > MAX_UNIQUE_USERS) {
throw new Error(`Hyperliquid allows ${MAX_UNIQUE_USERS} unique users across user specific subscriptions.`);
}
// Count what we send, because sent messages have their own limit (2000 per minute per IP).
let sent = 0;
const logger = {
...DefaultLogger,
info: () => {},
trace: (message: unknown) => {
if (String(message).startsWith('Sending upstream ws message')) sent++;
},
};
const ws = new WebsocketClient({ connectionTimeout: 5_000 }, logger);
const received: Record<string, number> = {};
ws.on('exception', ({ wsKey, event, data }) => console.error('exception', wsKey, event ?? data));
ws.on('message', (event) => {
received[event.channel] = (received[event.channel] ?? 0) + 1;
});
const topics: WebsocketSubscription[] = users.flatMap((user) => [
{ type: 'clearinghouseState', user },
{ type: 'openOrders', user },
{ type: 'userFills', user },
]);
await ws.subscribe(topics);
const runMs = Number(process.env.RUN_MS ?? 60_000);
setTimeout(() => {
console.log(`${users.length} accounts, ${topics.length} subscriptions, ${runMs / 1000} s`);
console.log('messages received:', received);
console.log('messages sent (subscribes and pings):', sent);
console.log('REST weight used: 0');
ws.closeAll();
}, runMs);
Replacing the five-second REST poll above with account subscriptions saves at least 1,008 weight per minute. Count subscriptions and heartbeats against the WebSocket message limit.
Two details matter when you do this for real:
- The user cap counts addresses, not subscriptions. Three feeds for the same account count as one user. Ten accounts is the documented maximum across all user specific subscriptions from your IP, whatever the feeds.
- Snapshots repeat after reconnects.
userFillsresends its snapshot every time the SDK reconnects, so deduplicate. For the full pattern, see Hyperliquid userFills in Node.js: snapshots, reconnects and missing fills.
Polling l2Book costs two weight units per call per coin. Subscribe for continuous updates. Hyperliquid l2Book in JavaScript: slow snapshots, fast mode and l2 diffs compares the book feeds. For heartbeats and reconnects, see Hyperliquid WebSocket API in TypeScript or the SDK’s WebSocket guide.
One off reads over the WebSocket API, and the 100 in flight limit
Some reads are not streams: a single account summary at startup, or an order status check. The SDK’s WebsocketAPIClient has the same methods as RestClient but sends each request over a WebSocket as a Hyperliquid post message, and resolves the promise when the matching reply arrives.
Hyperliquid allows 100 post messages in flight at once across all your connections, and each post also counts towards the 2,000 messages sent per minute. The SDK does not cap how many requests you have in flight; each call is sent as soon as the connection is open. If you fan out over many accounts, limit concurrency yourself. Save this as ws-api.ts:
import { WebsocketAPIClient } from '@siebly/hyperliquid-api';
/** Keeps at most `max` WebSocket API requests in flight (Hyperliquid allows 100 per IP). */
function inflightLimiter(max: number) {
let active = 0;
const queue: (() => void)[] = [];
return async function limit<T>(request: () => Promise<T>): Promise<T> {
if (active >= max) await new Promise<void>((resolve) => queue.push(resolve));
active++;
try {
return await request();
} finally {
active--;
queue.shift()?.();
}
};
}
const users = (process.env.HYPERLIQUID_ACCOUNT_ADDRESSES ?? '').split(',').filter(Boolean);
if (!users.length) throw new Error('Set HYPERLIQUID_ACCOUNT_ADDRESSES to one or more 0x addresses.');
const client = new WebsocketAPIClient({ connectionTimeout: 5_000 });
const limit = inflightLimiter(20);
const start = Date.now();
const [mids, ...summaries] = await Promise.all([
limit(() => client.getAllMids()),
...users.map((user) => limit(() => client.getPerpAccountSummary({ user }))),
]);
console.log(`BTC mid ${mids.BTC}, ${users.length} account summaries in ${Date.now() - start} ms`);
for (const [i, summary] of summaries.entries()) {
console.log(`account ${i + 1}: ${summary.assetPositions.length} asset positions`);
}
client.close();
Output with five public addresses:
BTC mid 61528.5, 5 account summaries in 1875 ms
account 1: 1 asset positions
account 2: 0 asset positions
account 3: 1 asset positions
account 4: 1 asset positions
account 5: 1 asset positions
The 1,875 ms includes opening the connection. A limit of 20 leaves plenty of room under 100 for anything else using post messages on the same IP. Hyperliquid’s post requests page does not say whether WebSocket posts also count against the REST weight limit, so do not assume that moving a read to WebsocketAPIClient makes it free. For anything you read repeatedly, a subscription is the option that clearly leaves REST weight alone.
Reconnect loops and the 30 new connections per minute limit
Every reconnect opens a new connection, and Hyperliquid allows 30 new WebSocket connections per minute per IP. Normally the SDK’s reconnect backoff keeps this low: the delay starts at 500 ms and doubles up to 10,000 ms. But the backoff resets whenever a connection opens successfully, and there is one common mistake where every connection opens fine and then gets dropped.
An invalid coin subscription can cause repeated reconnects. The WebSocket post describes the behavior. Validate coin names and limit reconnect attempts across processes sharing the same IP.
import { WebsocketClient } from '@siebly/hyperliquid-api';
// Hyperliquid allows 30 new WebSocket connections per minute per IP.
// Stop well before that if something keeps dropping the connection.
const MAX_RECONNECTS_PER_MINUTE = Number(process.env.MAX_RECONNECTS_PER_MINUTE ?? 10);
const quiet = { trace: () => {}, info: () => {}, error: () => {} };
const ws = new WebsocketClient({ connectionTimeout: 5_000 }, quiet);
const reconnects: number[] = [];
const start = Date.now();
ws.on('reconnecting', ({ wsKey }) => {
const now = Date.now();
reconnects.push(now);
while (now - reconnects[0]! > 60_000) reconnects.shift();
console.log(`${((now - start) / 1000).toFixed(1)} s: reconnecting ${wsKey} (${reconnects.length} in the last minute)`);
if (reconnects.length >= MAX_RECONNECTS_PER_MINUTE) {
console.error(`Stopping: ${reconnects.length} reconnects in a minute. Check subscriptions and network.`);
ws.closeAll();
}
});
ws.on('close', ({ wsKey }) => console.log(`${((Date.now() - start) / 1000).toFixed(1)} s: closed ${wsKey}`));
// 'BTC-PERP' is not a Hyperliquid coin. The server drops the connection when it sees it.
await ws.subscribe([
{ type: 'trades', coin: 'BTC' },
{ type: 'trades', coin: 'BTC-PERP' },
]);
At 25 reconnects per minute, a second worker retrying on the same IP can exceed the documented limit of 30. Check the coin with nameToCoin() before subscribing.
Treat the documented limits as a budget
Enforce the documented Hyperliquid API rate limit locally, even when a request above it happens to succeed.
Further reading
- Hyperliquid’s rate limits and user limits
- The SDK’s troubleshooting guide and WebSocket guide
- Hyperliquid JavaScript and TypeScript SDK on siebly.io, and the source on GitHub
- Hyperliquid WebSocket API in TypeScript
