Handling API Rate Limits

Status Code 429 Too Many Requests

When an API rate limits you, it should return a 429. As a frontend developer, you must handle this gracefully rather than repeatedly crashing the request.

Standard Headers

Look for these headers in the response to implement retry logic:

  • X-RateLimit-Limit: The total requests allowed in the window.
  • X-RateLimit-Remaining: How many requests you have left.
  • X-RateLimit-Reset: The Unix timestamp when the limit resets.

Use these headers to implement exponential backoff algorithms on the client side.