Note · APIs

Rate limits are interfaces

19 August 2026 · 4 min read

A rate limit is often treated as an obstacle that appears after the API is designed. In practice it is part of the interface. It tells the client how much work it may ask for, how quickly, and what to do when the answer is no. A service that returns 429 without a useful retry signal is asking every client to invent its own backoff policy.

The token bucket model is a good place to start because it makes the parameters explicit: a bucket size for bursts, a refill rate for sustained traffic, and a decision about whether requests that exceed the bucket are rejected or queued. Two services with the same average limit can behave very differently depending on the burst allowance.

On the client side, the important question is not “how do I avoid all 429s?” It is “what happens when I get one?” A retry that fires immediately makes the problem worse. A retry with a fixed delay creates synchronization. A retry with jitter and a cap behaves better, especially when many clients are involved.

Retry-After: 2
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1760000000

Headers are useful, but only if they are consistent and honest. A reset timestamp that moves every time the client asks is not a reset timestamp. A remaining count that does not reflect the actual bucket is worse than no count at all, because clients will build retry budgets on top of it.

The server also has a responsibility to make the limit legible. Which dimension is limited: requests per second, concurrent requests, bytes, or a weighted cost? If the limit is per tenant, say so. If it is shared across a pool, say that too. Clients cannot make good decisions from a status code alone.

The best rate limits feel less like a wall and more like a conversation about capacity. The client learns the shape of the budget, the server protects itself without collapsing, and the retry path is designed rather than accidental.

← All notes