Accent colour
 
Shortcuts: press ?
 

API Rate Limiting Explained — Why Services Say Slow Down

Muhammad Tahir November 23, 2026

Introduction

It was a Friday evening, and Maya had finally got her side project working. The app pulled a user's recent posts from a social network, tidied them up, and showed a simple weekly summary. She ran it once and it worked. She ran it again for a second test account and it worked. Then she added a loop — just to check ten accounts in a row, nothing ambitious — and on the fourth account the whole thing fell over. The response was not a helpful error message. It was three numbers and a word: 429 Too Many Requests.

Maya had not broken anything. She had not typed a wrong password or sent a malformed request. She had simply asked too fast. The service had a limit on how many requests she could make in a given time, and she had hit it. An hour later, without changing a line of code, the same requests worked again.

Every developer meets this wall sooner or later, usually at the worst possible moment: during a demo, during a launch, or at 2 a.m. when a background job that ran fine for months suddenly starts failing. Rate limiting sounds dull until it costs you a weekend. It is one of the most practical things to understand about building software that talks to other software, because almost every public API has limits, and the limits shape how you design everything that calls them.

This article explains what rate limiting is, why services bother with it, how the common methods actually work, and how to build clients that stay on the right side of the line. It uses real limits from real services, so you can see what the numbers look like in practice rather than in theory.

What Rate Limiting Actually Is

An API is a doorway into someone else's system. A weather app asks a weather service for the forecast. A shop asks a payment service to charge a card. A phone app asks a social network for a list of posts. Each of those asks is a request, and each request costs the service something: a little processing time, a little database work, a little bandwidth. One request is nothing. A million requests a minute is a different story.

Rate limiting is the service's way of saying how many requests you may make in a given period. It might be 100 requests a minute, 5,000 an hour, or 10,000 a day. The exact number depends on the service, on your plan, and sometimes on which endpoint you are calling — the part of the API that handles logins might have a stricter limit than the part that serves public data, because logins are a favourite target for attackers.

When you go over the limit, the service stops answering your requests properly and returns an error instead, most commonly HTTP status code 429. That code means "too many requests". Some services also send a header called Retry-After, which tells you how many seconds to wait before trying again. Others send headers that tell you where you stand: how many requests you have left in the current window, and when the window resets. Reading those headers is one of the simplest habits a developer can build, and it saves an enormous amount of guesswork.

It helps to think of rate limiting as a speed limit, not a wall. A speed limit does not mean you cannot drive. It means you cannot drive as fast as you like, whenever you like, because the road is shared. The service is protecting itself, its other users, and — whether it feels like it at the time or not — you as well. A runaway loop in your code that fires ten thousand requests in a minute would be expensive, and possibly charged to your account, if nothing stopped it.

Why Services Bother

The first reason is the obvious one: keeping the service up. A server can only do so much work at once. If one user, or one buggy program, fires off requests without pause, it can soak up the capacity that hundreds of other users need. The result is slow responses for everyone, timeouts, and eventually an outage. Rate limits spread the load out, so no single caller can crowd everyone else off the road.

The second reason is cost. Every request costs the provider money — servers, databases, bandwidth, staff. Free tiers exist because the provider can afford a certain amount of free use, and rate limits are how they draw the line. A free account might get 100 requests a day, a paid account 100,000. That is not stinginess. It is the business model, written as a number. If you need more, you pay more, and the limit moves with the plan.

The third reason is security. Many attacks start as a flood of requests. Someone trying to guess passwords will try thousands of combinations. Someone scraping a site will pull page after page as fast as their script can go. Someone trying to knock a service offline will send traffic until it falls over. A rate limit does not stop a determined attacker on its own, but it makes each of these things slower, more expensive, and easier to spot. Login endpoints are often limited to a handful of attempts per minute for exactly this reason.

The fourth reason is fairness. A shared service with no limits is a service where the loudest user wins. A small app can be starved by a single careless integration that polls every second for data that changes once an hour. Limits give everyone a predictable share, and you can design around a known limit.

There is a fifth reason that rarely gets mentioned: limits protect the caller too. A bug that sends the same request in an endless loop happens to every developer at least once. Without a limit, that loop can run up a bill or fill a database with duplicates. A rate limit turns a disaster into an error message.

How Limits Are Counted

Not all rate limits work the same way, and the differences matter when you are trying to stay under one. There are four common methods, and most real services use one of them, or a mix.

The simplest is the fixed window. Imagine a clock that ticks once a minute. In each minute, you may make 100 requests. At the start of the next minute, the count resets to zero and you get another 100. It is easy to understand and easy to build, which is why so many services start here. Its weakness is the boundary: you could make 100 requests in the last second of one minute and 100 more in the first second of the next, which is 200 requests in two seconds. For most services that burst is harmless. For a service under real strain, it is a hole in the fence.

The sliding window fixes that hole. Instead of counting requests in a fixed block, it looks back over the last minute from right now. If you made 100 requests in the last sixty seconds, you wait, even if the clock has ticked over. It is fairer, but harder to build.

The token bucket is the most flexible of the four, and the one you will hear about most often in serious API design. Picture a bucket holding 100 tokens, each request costing one, with tokens dripping back in at a steady rate. If the bucket is empty, you wait. If you have been quiet for a while, the bucket fills up, and you can spend the tokens in a short burst. That combination — a steady long-term rate with room for short bursts — matches how real programs behave.

The leaky bucket is the token bucket's stricter cousin. Requests pour in and leak out to the service at a fixed rate. If requests arrive faster than the leak, the bucket fills, and extra requests are turned away. The result is a smooth, even flow, with no bursts at all — good for protecting a fragile backend, but unforgiving to a caller who wants to fire off a quick batch.

Most developers do not need to memorise these four by name. What helps is knowing which shape a service uses, because it changes how you should behave. A fixed window rewards spreading requests evenly. A token bucket rewards patience between bursts. And when a service does not document its method — many do not — the safe approach is the same either way: slow down, spread requests out, and respect the headers the service sends back.

What Happens When You Hit the Limit

The first time you hit a rate limit, it feels like the service is broken. It is not. It is doing exactly what it was designed to do, and the response it sends back usually contains everything you need to recover, if you read it.

The status code is almost always 429. Some older services use 403 or 503 for the same purpose, which is confusing, but 429 is the standard now, and it has been since it was formally defined in 2012. Alongside it, a well-behaved service sends a Retry-After header with a number of seconds. Wait that long, then try again. That is the whole protocol, and it is worth building into your code from the start rather than bolting on after the first failure.

What you should not do is retry immediately, in a tight loop, hoping the limit has lifted. That is how a small problem becomes a big one: each retry is another request, and if enough clients do it at once, the retries themselves become a flood. The standard fix is called exponential backoff:

  • Wait a second, then two, then four, then eight, doubling the delay each time.
  • Add a little random jitter, so a thousand clients do not all retry at the same instant.
  • Stop after a handful of attempts, rather than hammering a struggling service forever.

There is also a human side to hitting a limit. If your app shows users an error because a background job hit a rate limit, the user does not care about token buckets. Good client design hides the retry where possible: queue the work, retry quietly, and only surface an error if the retries genuinely fail.

Real Limits from Real Services

Abstract numbers are hard to picture, so here is what the limits look like on services developers actually use. The details change over time, and providers update their pricing pages, so treat these as examples of the shape of limits, and check the current documentation before you build on them.

GitHub is the friendliest example, and the one most developers meet first. Its REST API allows 5,000 requests per hour for an authenticated user, and 60 per hour without authentication. That gap is deliberate: signing in tells GitHub who you are, so it can give you a generous allowance and hold you to it. The response headers tell you how many requests remain, and when the window resets.

Stripe, the payment processor, works differently. Its limits are per second rather than per hour, because payments are time-sensitive and bursty. Stripe's documentation has long described limits in the region of 100 requests per second in live mode for most accounts, with higher limits available on request. A payment API thinks in seconds, while a data API thinks in hours, and your code has to match the rhythm of the service it calls.

Then there are the cautionary tales. In 2023, both Reddit and X, the service formerly known as Twitter, changed their API access in ways that shook the developers who depended on them. Reddit announced new API pricing in the spring of 2023, and third-party apps that had relied on generous free access suddenly faced bills they could not pay. Apollo, one of the most popular Reddit apps, shut down on 30 June 2023. X made similar changes the same year, and in July 2023 it imposed temporary rate limits on how many posts users could read in a day. A limit is not just a technical detail. It is a business decision, and it can change.

The practical takeaway is simple. Before you build anything serious on an API, read its rate limit documentation, note the numbers for your plan, and work out what happens at your expected volume. A hobby project that makes ten calls a day will never notice a limit. A product that syncs data for a thousand users will hit it on the first morning.

Building a Client That Respects Limits

Most rate limit problems are client problems, and most of them are fixable with habits rather than heroics.

The first habit is caching. If you fetched a user's profile five minutes ago, do you need to fetch it again? If the data changes once a day, why ask for it every minute? Every request you do not make is a request that cannot hit a limit. A weather app that caches the forecast for an hour makes a fraction of the calls of one that fetches fresh data on every screen open, and the user cannot tell the difference.

The second habit is batching. Many APIs let you fetch several things in one request. Ten separate requests for ten items is ten chances to hit a limit. One request for ten items is one.

The third habit is backing off properly. When you get a 429, wait. Use the Retry-After header if there is one. If there is not, wait a few seconds, then longer if it fails again. Add a random delay so your retries do not line up with everyone else's, and stop after a handful of attempts.

The fourth habit is queuing work instead of doing it all at once. A background job that processes a thousand records does not need to fire a thousand requests in a minute. It can work through a queue at a steady pace and finish in ten minutes instead of one. This is also where webhooks help: instead of polling an API every minute to ask whether anything changed, a webhook lets the service tell you when something changed. Polling is the most common cause of self-inflicted rate limiting there is.

Finally, test against the limit on purpose. Before launch, point your code at the real API, or a realistic test version of it, and run it at full volume. Find out where the limit bites, and what your code does when it does. Finding out in testing is a bug report. Finding out from your users is an outage.

If You Run the API: Designing Fair Limits

Sooner or later, many developers end up on the other side of the table, running an API of their own. The principles are the same, seen from the opposite direction.

Start by limiting per user or per API key, not per server. A single global limit punishes everyone when one caller misbehaves. Per-key limits contain the damage, and you can raise the limit for a good customer without touching anyone else.

Make the limits visible. Return headers that say how many requests remain and when the window resets, and document the numbers plainly alongside the rest of the API documentation. Developers will forgive a strict limit far more readily than a mysterious one.

Choose limits that match the use case. A login endpoint might allow five attempts a minute, a search endpoint a hundred, a bulk export endpoint one request an hour, because each one is expensive. Different endpoints do different amounts of work, and the limits should reflect that.

Think about what happens at the edge. When a caller hits the limit, return a clear 429 with a Retry-After header, not a generic error or a silent timeout. Log the events, so you can see which keys are hitting the limit and whether the limit is doing its job or just annoying your best customers. And build in a way to raise limits for paying customers, because the day a good customer outgrows the free tier is a good day, not a problem.

One more thing: rate limiting is not a substitute for authentication, and it is not a complete defence against attack. A determined attacker can spread requests across many accounts. Limits slow abuse down and make it visible. Pair them with proper authentication and monitoring.

Frequently Asked Questions

What does HTTP 429 mean?

It means too many requests. You have sent more than the service allows in the current time window. Wait — ideally for the seconds in the Retry-After header if one is sent — and then try again. It is not a ban, and it is not a bug in your code.

How many requests per minute is normal?

There is no normal number. A small free API might allow 60 requests an hour. GitHub allows 5,000 an hour for signed-in users. A payment service might allow 100 a second. The only reliable answer is to read the documentation for the specific API and plan you are using.

Should I retry immediately after a 429?

No. Retrying immediately is the most common mistake, and it makes the problem worse. Wait, preferably for the time in the Retry-After header, then retry once. If it fails again, wait longer. Use exponential backoff — doubling the wait each time, with a little randomness — and stop after a few attempts rather than retrying forever.

Is rate limiting the same as throttling?

The two words are often used interchangeably, but there is a useful distinction. Rate limiting refuses requests over the limit, usually with a 429. Throttling slows requests down, queuing them or delaying the response, rather than refusing them outright. Many services do a bit of both, and the documentation does not always say which. What matters for your code is the same either way: respect the pace the service sets.

Can I just pay to remove the limit?

Usually you can raise it, not remove it. Most paid plans come with higher limits, and large customers can often negotiate custom ones. But even the biggest customers have limits, because the provider still needs to protect the service from a runaway client. Unlimited access to a shared system is not a product anyone sensible sells.

Slow Down on Purpose

Rate limiting feels like an obstacle the first time you meet it, usually in the form of a 429 at the worst possible moment. After a while, most developers come to see it differently: as the rule that keeps shared services usable. The limit is what stops one careless loop from taking down the service for everyone else, what keeps a free tier affordable, and what turns a billing disaster into an error message.

The developers who handle limits well are not the ones with the cleverest workarounds. They are the ones who read the documentation before they build, cache what they can, batch what they can, back off gracefully when told to, and test at full volume before launch. That is the difference between an integration that quietly works for years and one that pages someone at 2 a.m.

So the next time a service says slow down, take it at its word. Wait the few seconds it asks for. Your code will be better for it, the service will stay up for everyone, and Maya's Friday evening project — the one that worked fine until the fourth test account — will work on the fifth account too.

Was this article helpful?

Muhammad Tahir

Author

 

Get new articles by email

 

Comments