How to design limits you can defend: key or tenant, burst or steady, 429 semantics, backoff, and how to explain a limit before a customer hits it.
A rate limit on an API is not a number you pick to put in the documentation. It is two promises at once: a promise to the customer that nobody will exhaust their share, and a promise to yourself that cost and architecture will not collapse under unexpected load. When the number is chosen without those two promises, the result is arbitrary limits that fall at the first objection, or limits so wide they protect nothing.
This article is about designing limits, not about writing a service-level agreement. The difference between a deadline, a target and an indicator is covered in our guide to SLA and SLO negotiation. A rate limit is often a clause in that agreement, but it needs an engineering decision before it becomes a contractual promise. Here we separate the two: what the product decides, and what the system enforces.
What is the limit applied to?
The first decision is not the number but the unit being counted. A limit on IP address protects against one source but punishes an entire tenant behind a single proxy. A limit on key looks fair but lets one tenant create a hundred keys and exceed its share. A limit on user stops an individual's abuse but does not protect the system from a tenant that spreads load across its users.
In multi-tenant systems, the tenant-level quota is the unit you can explain in a contract, with a second limit per key to stop one software defect from consuming the whole company's share. That combination — a tenant ceiling and a smaller key ceiling — is what makes a limit defensible: it protects neighbour from neighbour, and the tenant from itself. We covered the isolation shape in multi-tenant SaaS architecture.
| Limit dimension | What it protects | Unit | Where enforced | What the client sees |
|---|---|---|---|---|
| Key | One broken integration | Requests per key per minute | API gateway | 429 with the key name and quota |
| Tenant | A tenant consuming everyone else's share | Requests per tenant per month | Gateway and quota layer | A usage view and plan limits |
| Endpoint | One heavy query crushing the rest | Requests per route per second | The endpoint's own service | 429 naming the route |
| User | Abuse from a single account | Requests per user per minute | Authentication layer | A clear message, not a permanent block |
| Cost | Unbounded metered consumption | Billing units per operation | Metering layer | A predictable bill, not a surprise |
Burst versus steady rate
Most systems do not need a fixed rate; they need the ability to absorb a short burst and then return to a lower rate. That is why counters allow an accumulated balance: it fills during quiet periods and is spent during the burst. This protects the server and lets a legitimate integration move quickly when it must, without opening the door to sustained load.
A fixed window is the simplest to implement but allows double the rate at the window boundary: a burst in the last second and a burst in the first second of the next window pass as if they were separate. A sliding window is more accurate and more expensive to compute. Choose by the harm: if exceeding the limit costs you real money, pay for precision; if it costs only response time, a fixed window with a safety margin may be enough.
Always add a ceiling per request as well: payload size, number of rows requested, execution time. Many incidents come not from many requests but from one request asking for every record. A limit on count without a limit on size leaves the door open to the heaviest form of consumption.
The meaning of 429: a status that must be understood
The 429 status means the client has sent more requests than are allowed at that moment, and it is defined in the HTTP specification. Using it correctly lets a client distinguish "you are too fast" from "you are not authorised" and "the system is down". Returning 403 or 500 instead pushes the client to retry in the wrong case, or to call support instead of waiting.
Send three things with a 429: an approximate retry time, the kind of limit the client hit, and the remaining quota where possible. The retry-after header is defined in HTTP, and using it lets a client wait instead of guessing. The message body should also be readable by a human, because the first person to see it is often an engineer on launch night.
Do not hide limits until a client hits them. Publish them in the documentation, show them in ordinary responses through quota headers, and make the usage view display what remains before it runs out. A client that knows it has a hundred requests left behaves differently from one that discovers the exhaustion at failure.
Backoff and retries
An immediate retry is worse than no retry, because it turns a temporary error into doubled load. Ask clients for exponential backoff with jitter, a wait ceiling, and a bounded number of attempts. Jitter is not a detail: without it, every client retries at the same instant and creates a second wave stronger than the first.
Separate what deserves a retry from what does not. An input error is not fixed by repetition, and neither is an authentication error. Operations that create something must be safe to repeat, or a retry creates two of them. That is the subject of idempotency keys, which we covered in the payment context in payment gateway integration.
Also watch who retries too much. A client retrying a thousand times a minute does not need a higher limit; it needs a fix in its integration. Send an early warning as the quota approaches, and contact the tenant before it hits the limit, not after its operation fails.
Explaining limits before they bite
A good limit is explained in four places: the documentation, the plan page, the response headers, and the usage view. If it appears in only one, it will be discovered in the wrong place. The list below is what we consider necessary so a limit does not become a surprise managed through support tickets.
From reading to shipping
Want this built, not just explained?
Bring us the problem behind the article. We will tell you what it takes, what it costs, and whether we are the right team.
A table per plan stating the number, its unit and the measurement period, not a phrase about "fair use" with no definition.
Headers on every response showing the limit, what remains and the reset time, including on successful responses.
A comprehensible error message naming the limit, the period and what can be done, not technical text copied into a search engine.
A warning at eighty percent of quota by email or webhook, before work stops rather than after.
A usage view for the tenant showing consumption by day and by endpoint, not only a monthly total.
Parity between test and production limits, otherwise the client tests behaviour it will never see in reality.
Advance notice of change when a limit is lowered or the unit changes, with time for the client to adjust.
A clear increase request path, with criteria, a decision and a duration, not a support address that forwards.
Quotas as a commercial instrument
A quota is not a punishment; it is a way to distribute a limited resource fairly. That is why it should connect to the plan, the price and the real cost of the service. If the higher plan gives ten times the quota for twice the price, you are not selling capacity; you are selling a number. If every plan has the same quota, there is no reason to pay more except another advantage that must be clear.
Also decide what happens on overage: does the request stop, slow down, or bill extra? Each option has an effect on trust. A sudden stop breaks an integration that may be critical, throttling needs explanation, and extra billing needs a cap. Choose deliberately and write the choice into the contract, because the client will discover it at the worst time.
Operating and monitoring limits
After launch, a limit needs monitoring like any component. Watch 429s per tenant, whether they rise after a release, who consumes the largest share, and whether a tenant touches the ceiling every day. A sudden rise in 429s after a release usually means a client or system bug, not growth in usage.
Own an overload plan: what you shed first, whom you protect, and how you communicate. A system that slows for everyone under load loses trust faster than one that clearly refuses specific requests. That is not only an engineering decision but a product decision, and the person who owns the customer relationship should agree to it.
Frequently asked questions (FAQ)
What is the right limit per tenant?
There is no universal number. Start from the customer's actual consumption on its highest day, double it as a margin, then test the system at that load. A limit at which you have never observed the system is not a limit; it is a guess. Revisit it after every major change in architecture or customer behaviour.
Should I use 429 or 503 under overload?
429 means the client exceeded its quota; 503 means the service is temporarily unavailable. The first is about the client, the second about the system. Use 429 when the cause is a quota and 503 when the service itself cannot respond, and do not mix them because clients build different behaviour on each.
How do I handle clients behind a single proxy?
Do not rely on IP alone. Use the key or the tenant as the primary unit, and treat the IP as a supporting signal rather than a verdict. If the proxy is legitimate, ask for a header that identifies the tenant or user and verify it with trust, because a header the client sends without verification is not an identity.
Should I raise a limit just because a client complained?
Not before you know why consumption is high. The client may be sending duplicate requests, fetching every record each time, or retrying a permanent error. Raising the limit hides the problem and moves the cost to you. Raise it after you have seen that the behaviour is legitimate and the system can bear it.
Are quotas part of the SLA?
Often yes, but they should be written as limits and exclusions rather than an open promise. An agreement that promises a response time without mentioning the quota allows contradictory readings: the client believes the time is guaranteed at any load, while you know it is guaranteed within the limit. Write the number, and write what happens outside it.
Sources
RFC 6585 — the definition of the 429 (Too Many Requests) status.
RFC 9110 — HTTP semantics, including the retry-after header.
RFC 9457 — problem details for HTTP APIs, for a machine-readable error body.
OWASP API Security Top 10 — resource consumption and broken authorisation risks.
A good limit answers two questions at once: what it protects, and how the client knows it has reached it. Start with the unit, separate burst from steady rate, make the 429 clear and readable, then publish the number before it is touched. If you are building a public API for a product, look at our SaaS platforms and integrations.
Cover image: Scott Rodgerson, Unsplash License, via Unsplash.

