Skip to content

429 Too Many Requests — Meaning, Common Causes & How to Fix

429 4xx Client Error RFC 6585

429 Too Many Requests means: The client has sent too many requests in a given time window — rate limiting. The response should include Retry-After telling the client when to try again; it is the standard, machine-readable way to enforce quotas and protect backends. Client-error 4xx codes mean the request itself is the problem: malformed syntax, missing credentials, forbidden access, a nonexistent resource or a violated precondition. The server is telling the client what to change; retrying the identical request without a fix will reproduce the same error. In practice you will meet 429 when exceeding an api's per-key or per-ip request quota; a retry storm: failed requests retried without backoff amplify traffic; scraping or polling loops faster than the documented rate limit. On the client side, honor Retry-After, implement exponential backoff with jitter, cache responses, and batch requests; distribute load across keys only if the provider allows it. On the server side, return Retry-After (seconds or HTTP-date) and document limits in headers (RateLimit-Limit/Remaining/Reset); apply limits consistently at the edge.

Advertisement
Ad slot · ref-top

When 429 happens

  • Exceeding an API's per-key or per-IP request quota
  • A retry storm: failed requests retried without backoff amplify traffic
  • Scraping or polling loops faster than the documented rate limit

How to fix it

On the client

Honor Retry-After, implement exponential backoff with jitter, cache responses, and batch requests; distribute load across keys only if the provider allows it.

On the server

Return Retry-After (seconds or HTTP-date) and document limits in headers (RateLimit-Limit/Remaining/Reset); apply limits consistently at the edge.

Should you retry?

Retryable after Retry-After; use exponential backoff with jitter and cap attempts.

Debugging steps

When 429 appears unexpectedly, start by capturing the full exchange: 'curl -i' or the browser DevTools Network tab shows the exact status line and response headers, which often carry the real explanation. Read the error body first — well-designed APIs name the offending field or missing credential. Then diff your actual request, headers included, against the documented contract. For this code specifically, check whether the most common trigger applies to your situation: exceeding an api's per-key or per-ip request quota. Compare your exchange against the raw HTTP example above. If you operate the server, correlate the timestamp with application and proxy logs using the request id; if you are the client, verify the request shape against the API documentation before changing anything or retrying.

Notes & gotchas

Always send Retry-After with 429 and document limits in RateLimit headers; clients that can see their remaining quota pace themselves instead of discovering the limit by hitting it.

Examples

Raw HTTP
HTTP/1.1 429 Too Many Requests
Retry-After: 30
Content-Type: application/json
Content-Length: 101

{
  "error": "too_many_requests",
  "message": "Exceeding an API's per-key or per-IP request quota"
}
curl
curl -i https://api.example.com/v1/resource   # read Retry-After, wait, then retry with backoff
JavaScript (fetch)
const res = await fetch("https://api.example.com/v1/resource");
if (res.status === 429) {
  const wait = Number(res.headers.get("Retry-After") ?? 5);
  await new Promise(r => setTimeout(r, wait * 1000));
  // retry with exponential backoff + jitter; cap attempts
  return retryWithBackoff();
}
Python (requests)
import time

import requests

res = requests.get("https://api.example.com/v1/resource", timeout=10)
if res.status_code == 429:
    wait = int(res.headers.get("Retry-After", 5))
    time.sleep(wait)  # then retry with exponential backoff + jitter
    # consider requests.adapters.HTTPAdapter(max_retries=Retry(...)) for automation

Frequently asked questions

How should I back off after 429?

Wait at least Retry-After, then use exponential backoff with jitter (e.g. 1s, 2s, 4s + random) and cap retries; never hammer in a tight loop.

Do rate-limit headers exist?

Yes — the RateLimit-Limit/Remaining/Reset fields (RFC 9651 era drafts, widely adopted) let clients pace themselves before hitting 429.

Are 4xx errors always the client's fault?

By contract yes — the server asserts the request must change. In practice servers sometimes misuse 4xx for their own problems (e.g. 400 for internal validation bugs), so read the error body before blaming your client code.

Should I retry 4xx responses automatically?

Generally no: the server says the request must change. Exceptions are 408 (fresh connection), 425 (after handshake) and 429 (after Retry-After). Blind retries of 400/401/403/404 just burn quota.

Advertisement
Ad slot · ref-in-article

Try the JSON Validator

Check JSON syntax and locate errors by line and column.

Open tool →