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.

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 37 mock REST APIs