Testing rate limits, 429s and backoff

Almost nobody tests rate limiting, because a well-behaved API will not rate limit you on demand — and so the retry policy that turns a slowdown into an outage ships untested. The Coffee Shop API enforces a genuine quota over a live window, so you can exceed it deliberately and watch it reopen.

Rate limit testing — request and response sequence Sequence diagram for Rate limit testing: GET /coffee/v1/rush-hour answers 429 Too Many Requests. GET /protocol/v1/maintenance answers 503 Service Unavailable. Your client Fun API Playground GET /coffee/v1/rush-hour 429 Too Many Requests Too many requests — wait for Retry-After seconds GET /protocol/v1/maintenance 503 Service Unavailable Always, with a Retry-After header. Good retry/backoff pra…
Real endpoints from the catalog — every request above is served, and every status code shown is one that endpoint actually returns.

How to practise it

  1. Send requests until you get a 429, then read Retry-After and wait exactly that long before retrying.
  2. Read X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset on successful calls and throttle from them, rather than waiting to be refused.
  3. Verify your retry policy applies backoff and a ceiling — an immediate retry loop on a 429 is indistinguishable from an attack.
  4. Check that a 429 is not counted as a permanent failure in your circuit breaker.
  5. Use the Fault Injection API to combine a rate limit with intermittent 503s and see whether your client still converges.

APIs to try it on

Status codes involved

Other techniques

Getting started guide · All 39 mock REST APIs

Last updated