An HTTP 429 Too Many Requests error means you’ve sent more requests than the server allows in a given time. The server is rate-limiting you. It’s common with APIs, login pages, scrapers and scripts, and it usually goes away if you slow down and wait.
This guide explains what the 429 status code means, how to handle it in scripts and API clients, and how to set up rate limiting correctly on your own Nginx or Apache server.
What Does 429 Too Many Requests Mean?
The 429 code is defined in RFC 6585: the user “has sent too many requests in a given amount of time.” The server may send a Retry-After header saying how long to wait, either in seconds or as a date:
HTTP/1.1 429 Too Many Requests
Retry-After: 60
Content-Type: application/json
{"error": "rate_limit_exceeded", "message": "Try again in 60 seconds."}
Many APIs also send headers that show your limit and how much of it is left, such as X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset, or the newer standard-style RateLimit and RateLimit-Policy headers. The names vary by provider.
You may see it as:
429 Too Many RequestsorHTTP Error 429Rate limit exceededorYou are being rate limitedError 1015(Cloudflare rate limiting)Too many login attempts. Please try again later.
Common Causes of a 429 Error
- A script or app calling an API too fast, for example a loop with no delay.
- Too many retries: a client that retries failures instantly makes the limit worse.
- Shared IP addresses: everyone behind the same office NAT, VPN or cloud IP shares one limit.
- Login protection: repeated failed logins trigger a temporary block.
- Bots and scrapers, including your own monitoring or SEO tools.
- Plan limits: many APIs set daily or monthly quotas by subscription tier.
Quick Fixes If You’re Visiting the Site
- Wait a minute or two before trying again. Most limits reset quickly.
- Stop refreshing. Every reload counts as another request.
- Turn off your VPN. Shared VPN IPs often hit limits because of other users’ traffic.
- Close extra tabs of the same site and pause browser extensions that auto-refresh pages.
How to Handle 429 in Scripts and API Clients
Respect Retry-After and back off
The right response to a 429 is to wait, then retry with an increasing delay (exponential backoff). Never retry instantly in a tight loop. If the server sends Retry-After, wait at least that long.
curl can do this for you: its --retry option treats 429 as a temporary error, waits, and respects Retry-After:
curl --retry 5 --retry-max-time 120 https://api.example.com/v1/items
In Python with the requests library, a simple version looks like this:
import time, requests
def get_with_backoff(url, tries=5):
delay = 1
for _ in range(tries):
r = requests.get(url, timeout=30)
if r.status_code != 429:
return r
ra = r.headers.get("Retry-After", "")
wait = int(ra) if ra.isdigit() else delay
time.sleep(wait)
delay *= 2
r.raise_for_status()
Reduce how many requests you send
- Add a delay between requests, or limit the number of parallel workers.
- Cache results you’ve already fetched instead of asking again.
- Use batch or bulk endpoints if the API has them.
- Use webhooks instead of polling for changes.
- Check your plan’s limits and quotas, and upgrade if your real usage needs more.
How to Set Up Rate Limiting on Your Own Server
Nginx: limit_req returns 503 by default
Nginx’s limit_req module is the standard way to rate-limit, but it rejects excess requests with 503 Service Unavailable by default, not 429. Set limit_req_status 429 so clients get the correct code and know to slow down:
http {
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
server {
location /api/ {
limit_req zone=api burst=20 nodelay;
limit_req_status 429;
proxy_pass http://127.0.0.1:3000;
}
}
}
This allows 10 requests per second per IP, with short bursts of up to 20 extra requests. Use a stricter zone for login pages, for example rate=5r/m. The limit_conn module limits connections the same way and has a matching limit_conn_status setting.
Test the config and reload:
sudo nginx -t && sudo systemctl reload nginx
Rejected requests appear in the error log as limiting requests, excess: ... by zone "api". To see which clients are being limited:
sudo awk '$9 == 429 {print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head
Don’t rate-limit your own proxy’s IP
If Nginx sits behind a load balancer or CDN, every request appears to come from the proxy’s IP, and one limit applies to all visitors together. Use the real client IP with the realip module, and only trust the header from your own proxies:
set_real_ip_from 10.0.0.0/8;
real_ip_header X-Forwarded-For;
real_ip_recursive on;
You can also exempt trusted IPs (monitoring, office, internal services) by using a geo and map pair that sets an empty key for them. Nginx doesn’t count requests whose key is empty.
Apache
Apache has no built-in per-IP request rate limit like Nginx’s. Common options are the mod_evasive module, ModSecurity rules, or rate limiting at a reverse proxy or CDN in front of Apache. Whatever you use, return 429 with a Retry-After header where the tool allows it.
Send helpful responses from your API
When your own app rate-limits clients:
- Return 429, not 403 or 503, so clients know the fix is to slow down.
- Include
Retry-Afterand a short JSON error body. - Document your limits, and send rate-limit headers so clients can pace themselves.
Related HTTP Error Guides
For the full list of codes and what they mean, see our HTTP status codes list. Guides for other common errors:
- HTTP 400 Bad Request
- HTTP 401 Unauthorized
- HTTP 403 Forbidden
- HTTP 404 Not Found
- HTTP 500 Internal Server Error
- HTTP 502 Bad Gateway
- HTTP 503 Service Unavailable
- HTTP 504 Gateway Timeout
Frequently Asked Questions
What does 429 Too Many Requests mean?
It means you sent more requests than the server allows in a set period. The server is asking you to slow down and try again later.
How long does a 429 error last?
It depends on the server’s limit. Often it’s seconds to a few minutes. If the response has a Retry-After header, wait at least that long. Daily API quotas reset at a fixed time.
How do I fix 429 errors in my script?
Slow down, add delays or fewer parallel requests, cache results, and retry with exponential backoff that respects Retry-After. curl --retry does this automatically.
Why does Nginx return 503 instead of 429 for rate limits?
limit_req and limit_conn use 503 by default. Add limit_req_status 429; (and limit_conn_status 429;) to return the correct code.
Can a VPN cause 429 errors?
Yes. Many people share each VPN IP address, so you can hit a site’s per-IP limit even if you only sent a few requests. Turn the VPN off or switch servers.
Conclusion
An HTTP 429 Too Many Requests error is the server asking you to slow down. Visitors just need to wait a little. Script and API users should pace their requests, cache results and retry with backoff that respects Retry-After. Server admins should rate-limit by real client IP and set limit_req_status 429 in Nginx, so clients get a clear, correct signal instead of a misleading 503.
How did it make you feel?
