API rate limits and API keys: how they work and how to handle them
How API rate limits are counted, what HTTP 429 and Retry-After mean, how to back off and poll less, and how to store, scope, restrict and rotate API keys.
In short
A rate limit caps how many requests a client may send in a period of time, and an API key tells the server who is sending them. Together they decide what a client may do, how fast, and on whose account. A client that reads the limit headers, backs off on 429 Too Many Requests and keeps its key on the server will rarely notice either.
This guide explains how limits are counted, what the standard responses and headers mean, how to retry and poll less, and how to store, restrict and rotate API keys. The examples use our own API where a concrete case helps.
How rate limits are counted
APIs differ in three choices:
- What is counted. Most count requests. Some give each request a weight, so heavy queries use up more of the budget. Hyperliquid's API, for example, gives all requests of one IP address a shared weight budget per minute, with light requests weighing less than heavy ones.1
- Who is counted. Limits can apply per IP address, per key or per account. Per-account limits add up every key of the account, so splitting work across several keys does not raise the total.
- Over which window. A per-minute limit protects the server from bursts; a per-day limit caps total use. Many APIs apply both at once.
On the Blockmetric API, each plan has a per-minute and a per-UTC-day limit for the account, summed over all its keys.2 Without a key, a free public tier answers requests that send the header X-Blockmetric-Access: public, with its own small limits per IP address and a short history window.2 The limits of each plan are listed on API pricing.
HTTP 429 and Retry-After
When a client exceeds a limit, the standard answer is status 429 Too Many Requests.3 The response may carry a Retry-After header that says how long to wait, either in seconds or as a date.4 A well-behaved client waits at least that long before trying again.
429 is the only client error that is normally worth retrying. Other 4xx codes mean the request itself is wrong: a bad parameter, a missing key, a plan that does not include the endpoint. Sending the same request again only fails again and uses up budget.
Reading the limit headers
Many APIs return the current state of the budget with every answer, so a client can slow down before it hits the limit. Our API sends:2
| Header | Meaning |
|---|---|
X-RateLimit-Limit | Requests allowed per minute for the account |
X-RateLimit-Remaining | Requests left in the current minute |
X-RateLimit-Reset | Unix seconds when the current minute ends |
X-RateLimit-Limit-Day, -Remaining-Day, -Reset-Day | The same for the UTC day |
RateLimit-Policy, RateLimit | Both quotas in the format of the IETF draft for rate-limit headers |
A client that watches X-RateLimit-Remaining can spread its requests across the minute instead of sending them in one burst and waiting.
Backing off without making it worse
When many clients retry at the same moment, they hit the server together again. The usual fix is exponential backoff with jitter:
- On
429(or a temporary503), wait forRetry-Afterif it is present. - Otherwise wait a short base time, and double it on each further failure, up to a cap.
- Add a small random amount to each wait, so clients spread out.
- Give up after a few tries and report the error.
Our authentication page and the RPC best practices show this loop in several languages.
Polling less instead of retrying more
The cheapest request is the one that is never sent:
- Conditional requests. Send the last
ETaginIf-None-Match; an unchanged answer comes back as304 Not Modifiedwith no body.4 - Forward cursors. Ask a feed only for rows after the last id you saw, not for the whole window again.
- Match the data's own rhythm. A snapshot that is rebuilt every few minutes does not need polling every second.
- Push instead of pull. A live stream or webhooks deliver changes without polling. On our API, one open stream counts as one request against the per-minute limit.5 WebSocket vs REST for market data compares the options.
Where an API key belongs
An API key is a password for a program. Anyone who has it can spend the account's quota and read what the plan includes. A few rules follow:
- Keep it on the server. Read it from an environment variable or a secret store, never from source code. A key in browser JavaScript or a mobile app can be extracted by anyone who loads it.
- Send it in a header. Our API accepts
Authorization: Bearer <key>orx-api-key; a key in the query string is refused, because URLs end up in logs, browser history and proxies.2 - Never commit it. Keep secrets out of version control, and treat any key that was ever pushed to a repository as leaked.
- Never paste it into a prompt or chat. An AI agent should read the key from its environment, not from its instructions.
Restricting and rotating keys
Good key hygiene limits the damage of a leak before it happens. Our API keys support:2
- One key per app or environment. An account can hold several active keys, so a leak in one system can be revoked without touching the others.
- Expiry dates. A key can be created with an end date, or without one.
- IP allowlists. A key can be limited to addresses or ranges you list.
- Allowed origins. For browser widgets, a key can be limited to listed websites. This prevents accidental embedding; it does not make a key safe to publish.
- New-network e-mails. An optional e-mail when a key is used from a network it has not been used from before.
- Scopes. Accounts with access to our node gateway can limit a key to the data API or to the gateway.
- Revocation. A revoked key stops working immediately.
Rotation then becomes routine: create a new key, deploy it, confirm traffic has moved, revoke the old one. Repeated requests with invalid keys from one network are themselves rate limited, which slows down anyone guessing keys.
Limits of this guide
- Every API is different. Header names, weights, windows and retry rules vary. The provider's documentation is the reference for each one.
- Limits change. Plan limits on our API are listed on API pricing and the authentication page, which always show the current values.
Common questions
Why do I get 429 when I have requests left today? The per-minute limit is separate from the daily one. A burst can exhaust the minute while the day still has room.
Do more keys give me more requests? Not on our API. Limits are per account and summed over all keys.
Is it safe to put a key in a front-end app if I set allowed origins? No. Allowed origins block accidental embedding on other sites, but the key is still visible to anyone who opens the page. Keep keys on a server and let the server call the API.
What should I do if a key leaks? Revoke it on the account page, create a new one and deploy it. Revocation takes effect immediately.
Next steps
Live data
See today’s numbers
The live pages update continuously.
Free plan: every coin, up to 30 days of history. Compare plans
- API and data: all guides14 guides and the newest posts on the topic, with the live pages that answer it.
- Crypto market data APIThe same data as JSON: REST, live stream, webhooks
- API referenceEvery endpoint with parameters and examples
Sources
- Hyperliquid Docs, "Rate limits and user limits" (accessed 2026-11-11)Back to text
- Blockmetric API reference, "Authentication and rate limits" (accessed 2026-11-11)Back to text
- IETF, RFC 6585 "Additional HTTP Status Codes", section 4 (429 Too Many Requests) (accessed 2026-11-11)Back to text
- IETF, RFC 9110 "HTTP Semantics" (Retry-After, ETag, If-None-Match, 304) (accessed 2026-11-11)Back to text
- Blockmetric API reference, "Live event stream" (accessed 2026-11-11)Back to text
How we collect and check the data: Data & methodology.
Share this guide as a link or as an image card with its title.