API Fundamentals

Rate Limiting Explained

Rate limits cap how many requests you can make in a window to keep the API fair and stable.

What you'll learn

  • Explain why APIs impose rate limits
  • Read rate-limit headers on a response
  • Handle a 429 response correctly
  • Implement backoff with jitter
  • Design integrations that stay under limits

6 min

Why limits exist

An API is a shared resource serving many callers at once. Without any controls, a single runaway client could overwhelm the service and degrade it for everyone else connected to it. Rate limiting caps how many requests a given caller may make within a window — say, a number of requests per minute — to keep capacity fair across all consumers and the platform itself stable under load.

Limits also quietly protect you. They surface a runaway loop early, before it racks up cost or noise, and they nudge you toward efficient designs that batch and cache rather than hammering the same endpoint in a tight loop. It pays to treat the documented limit as a design constraint to build within, not an obstacle to fight against or sneak around.

Reading the headers

Most APIs advertise your current standing through a set of response headers, and reading them is the difference between reacting and being surprised. Common ones report the ceiling for the window, how many calls remain in it, and when the window will reset. The exact names vary between providers, but the pattern is consistent and easy to recognise:

RateLimit-Limit: 600
RateLimit-Remaining: 12
RateLimit-Reset: 30

Reading these lets your client slow itself down before it is ever blocked. If the remaining count is getting low, you can pace subsequent requests to glide under the limit rather than charging ahead into a rejection and then scrambling to recover from it afterwards. Proactive pacing beats reactive backoff every time.

When you hit the limit

Exceed the allowance and the API responds with 429 Too Many Requests. The response usually includes a Retry-After header telling you how many seconds to wait before trying again. Honour it precisely — retrying immediately just earns another 429, wastes a request from your next window, and gets you no closer to success.

It helps to remember that a 429 is not an error in your data or your credentials; it is simply a polite request to slow down for a moment. The correct response is to pause for the indicated duration and then resume, ideally having already throttled yourself so you rarely reach this point in the first place. Treating it as a signal rather than a failure keeps your integration calm under pressure.

Backing off well

For retries, use exponential backoff with jitter. Wait a short while after the first failure, then progressively longer after each subsequent one, and add a small random offset to each delay so that many clients do not all retry in perfect lockstep and create a thundering herd that knocks the service over again the instant it recovers.

Always prefer the server's Retry-After value over your own computed delay whenever it is provided, since the server knows best. Cap both the number of attempts and the maximum delay, so a genuinely struggling integration fails cleanly and visibly rather than retrying forever in silence. And restrict automatic retries to safe or idempotent requests so a retried write never quietly duplicates.

Designing under limits

The best rate-limit strategy, by a wide margin, is simply to need fewer requests in the first place. Cache the responses you can safely reuse, request multiple records per call through pagination instead of fetching them one at a time, and batch operations together wherever the API allows it. A well-shaped integration designed along these lines rarely sees a 429 at all, even when it is running at considerable scale, because it asks for far less to begin with.

To cut your request count further still, read caching and ETags, which shows how conditional requests let you skip whole downloads entirely when nothing has changed — one of the most effective ways there is to stay comfortably within any limit you are given.

Key takeaways

  • Rate limits keep a shared API fair and stable for everyone
  • Limit headers tell you how many calls remain and when they reset
  • A 429 means slow down; honour the Retry-After header
  • Use exponential backoff with jitter, capped at a maximum
  • Caching and batching are the best ways to stay under limits

FAQ

What should I do when I get a 429?

Stop, wait for the duration in the Retry-After header, then resume. Ideally throttle your client so you rarely reach the limit in the first place.

Why add jitter to backoff?

Without randomness, many clients retry at the same instant after an outage, spiking load. Jitter spreads retries out and avoids a thundering herd.

How can I avoid hitting limits at all?

Make fewer calls — cache reusable responses, page for multiple records per request, and batch operations where the API supports it.

Integrate with Merion

Ready to build?

Read the API reference, grab the OpenAPI spec, and ship a resilient integration.