Networking

429 Too Many Requests: What It Means and How to Fix It

HTTP 429 "Too Many Requests" means the server is rate limiting you: you, or something sharing your connection, sent more requests in a given amount of time than it allows. Stop sending requests, wait for the time given in the Retry-After header (or a minute or two if there is none), and try again.

RFC 6585 defines the code: "the user has sent too many requests in a given amount of time" ("rate limiting"). The response should explain the condition and may include a Retry-After header saying how long to wait. The RFC does not define how the server identifies the user or counts requests, so every site decides that for itself.

What a 429 response looks like

This is the example response from MDN's page on the status code:

HTTP/1.1 429 Too Many Requests
Content-Type: text/html
Retry-After: 3600

<html lang="en-US">
  <head><title>Too Many Requests</title></head>
  <body>
    <h1>Too Many Requests</h1>
    <p>You're doing that too often! Try again later.</p>
  </body>
</html>

Here Retry-After: 3600 means requests are allowed again after 3,600 seconds (60 minutes). The wording of the page varies by site: "429 Too Many Requests", "Error 429", "Rate limit exceeded", or a custom message. Cloudflare-protected sites may show "Error 1015: You are being rate limited", covered below.

How to fix a 429 as a visitor

  1. Wait. Rate limits reset after a window. Look at the page or the response headers for a retry time; if there is none, wait a few minutes.
  2. Stop refreshing. Cloudflare's documentation warns against repeatedly trying to access the site in a short period because that may extend the block.
  3. Close extra tabs and pause anything automatic. Auto-refresh extensions, download managers, link checkers and scrapers all multiply requests.
  4. Check whether others share your IP address. MDN says limits are typically based on the client's IP, so an office, school, VPN or mobile network can trip a limit through other people's traffic. Trying a different network (for example your phone's connection) shows whether that is the cause.
  5. Sign in, if the site offers it. Some services give logged-in or authenticated users a higher limit than anonymous traffic. GitHub's REST API, for instance, allows 60 requests per hour unauthenticated and 5,000 per hour authenticated.
  6. Contact the site. If you are blocked and have not done anything unusual, the site owner controls the rule. Cloudflare notes that it does not decide who gets rate limited; the website owner does.

How to fix a 429 in your code or script

If you are calling an API or scraping, the fix is to slow down and obey the server's instructions. The order of preference:

  1. Read Retry-After and wait at least that long.
  2. If the API sends its own reset headers, use them. GitHub documents x-ratelimit-remaining and x-ratelimit-reset (a UTC epoch time in seconds), and says not to retry before that time.
  3. If neither is present, back off exponentially (for example 1, 2, 4, 8 seconds) with a small random delay, and give up after a fixed number of attempts.

The two formats of Retry-After

MDN documents two forms, and code must handle both:

FormExampleMeaning
Delay in secondsRetry-After: 120A non-negative integer: wait this many seconds after the response is received
HTTP dateRetry-After: Wed, 21 Oct 2015 07:28:00 GMTDo not retry before this date and time

A retry loop in Python

This sketch uses the requests library and the standard library only. It was not executed as part of writing this article, so test it against your own endpoint before relying on it.

import random
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime

import requests


def seconds_to_wait(retry_after: str | None, attempt: int) -> float:
    """Turn a Retry-After value (seconds or HTTP date) into a delay."""
    if retry_after is not None:
        if retry_after.isdigit():
            return float(retry_after)
        retry_at = parsedate_to_datetime(retry_after)
        return max(0.0, (retry_at - datetime.now(timezone.utc)).total_seconds())
    return min(60, 2 ** attempt)  # 1, 2, 4, 8 ... capped at 60 s


def get_with_retry(url: str, max_attempts: int = 5) -> requests.Response:
    for attempt in range(max_attempts):
        response = requests.get(url, timeout=30)
        if response.status_code != 429:
            return response
        delay = seconds_to_wait(response.headers.get("Retry-After"), attempt)
        time.sleep(delay + random.uniform(0, 1))  # jitter
    raise RuntimeError(f"Still rate limited after {max_attempts} attempts: {url}")

To look at the headers yourself, run curl -i https://example.com/api/items. The -i flag prints the response headers before the body, so you can see Retry-After and any x-ratelimit-* headers the API sends. Header names vary by provider; only Retry-After is standardised.

Ways to send fewer requests

  • Cap concurrency. Ten parallel workers each retrying on their own hit the limit together. Use a queue or semaphore.
  • Cache responses you have already fetched instead of asking again.
  • Authenticate where the API offers higher limits for credentials.
  • Know the secondary limits. GitHub documents separate limits for concurrency (100 concurrent requests), content creation (roughly 80 requests per minute and 500 per hour) and more, and says continuing to make requests while rate limited may result in your integration being banned. When a secondary limit applies and there is no retry-after header, GitHub says to wait at least one minute.

Note that GitHub can answer a rate-limited request with 403 as well as 429, so check the response body and headers, not only the status code. For AI provider APIs, which add token and spend limits, see rate limit error 429 in LLM APIs.

What "Error 1015" on Cloudflare sites means

Cloudflare's "Error 1015: You are being rate limited" appears when a site's owner has set a rate-limiting rule and your requests exceeded it. Cloudflare says the site "has temporarily blocked you". The visitor advice is the same as above: wait, and do not hammer the page. Cloudflare's documentation does not state the HTTP status code returned with this error, so do not assume it is 429.

If you own the site, Cloudflare suggests reviewing your thresholds. For a rule that blocks over a very short window such as one second, it suggests lengthening the window to 10 seconds, since legitimate pages that load many assets can trip short windows.

How to fix a 429 as a site owner

If real users see 429 on your own site, your limit may be too low for normal behaviour, or a few clients are generating most of the traffic. First find out which: check your access logs for the client IPs or API keys receiving 429, and compare them with normal usage. Then either raise the limit, widen the window, or cache the expensive endpoint.

If you run nginx, the limit comes from limit_req_zone and limit_req. This is the example from the nginx documentation:

http {
    limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

    server {
        location /search/ {
            limit_req zone=one burst=5;
        }
    }
}

That allows an average of 1 request per second per client address on /search/, with a burst of up to 5 extra requests queued. By default the burst size is zero, so a rule with no burst rejects any request that arrives faster than the rate. Rejected requests get status 503, because the documented default is limit_req_status 503;. Add limit_req_status 429; if you want clients and tools to see the standard rate-limit code.

When you send 429 yourself, include a Retry-After header so well-behaved clients know when to come back, and a short body explaining the limit. RFC 6585 says the response should include details explaining the condition.

If the 429 won't go away

  • It persists after waiting an hour. You may be on a shared or flagged IP address, or the limit is tied to your account or token. Try another network, and check whether your account or API key is suspended.
  • It appears on the first request. Something else on the network (a shared proxy, another device, a script you forgot) is using the same limit. Stop other clients and retry.
  • No Retry-After and no documentation. Treat the limit as unknown: slow down sharply, add exponential backoff, and look for the site's published API limits.
  • A browser extension is the cause. Disable extensions that auto-refresh, prefetch links or scan pages, then reload.

Frequently asked questions

How long does a 429 error last?
It lasts as long as the server's rate-limit window. If the response has a Retry-After header, that tells you: a value of 120 means wait 120 seconds, and a date means wait until that time. Without the header there is no standard answer, so wait a minute or two, then retry with increasing delays.
Is a 429 error my fault or the website's fault?
The status is in the 4xx client-error family, because the server is saying a client sent too many requests. In practice the cause can be your own script or browser extension, other people sharing your IP address (an office, VPN or mobile network), or a site rule set too tight. The response alone does not tell you which.
Does clearing cookies or using a VPN fix a 429?
Sometimes. MDN notes that limits are typically based on the client's IP address but can also be tied to a user account, an API token or a cookie. If the limit is per IP, a different network may work. If it is per account or token, changing network does nothing. Evading a limit set against abuse can also get you blocked longer.
Should I use 429 or 503 when rate limiting my own server?
429 is the status RFC 6585 defines for 'too many requests', and it tells clients the problem is their request rate. 503 means the service is unavailable. Servers are not required to use 429, and nginx's limit_req module returns 503 by default until you set limit_req_status 429.

Sources