429 Too Many Requests Error
Learn what 429 Too Many Requests means, how rate limiting works, and how to handle or avoid hitting API rate limits.
What Does This Error Mean?
The 429 Too Many Requests status code means the user has sent too many requests in a given amount of time (rate limiting). The server is protecting itself from abuse by temporarily blocking further requests.
Common Causes
Sending requests faster than the API rate limit allows
Missing delay between retry attempts in a loop
Multiple instances or threads not sharing rate limit state
No backoff strategy when retrying failed requests
Aggressive polling or web scraping without throttling
DDoS protection systems (Cloudflare, AWS WAF) blocking legitimate traffic
How to Fix It
Implement exponential backoff
When you get a 429, wait increasing amounts of time before retrying.
async function fetchWithRetry(url, retries = 3) {
for (let i = 0; i < retries; i++) {
const res = await fetch(url)
if (res.status === 429) {
const retryAfter = res.headers.get("Retry-After") || Math.pow(2, i) * 1000
await new Promise(r => setTimeout(r, Number(retryAfter) * 1000))
continue
}
return res.json()
}
throw new Error("Rate limited after retries")
}Check rate limit headers
Many APIs include headers that tell you your current rate limit status.
// Common rate limit headers X-RateLimit-Limit: 100 X-RateLimit-Remaining: 42 X-RateLimit-Reset: 1640995200 Retry-After: 60
Add request queuing
Queue requests and send them at a controlled rate to avoid bursts.
class RateLimiter {
constructor(limit, interval) {
this.queue = []
this.tokens = limit
setInterval(() => { this.tokens = Math.min(this.tokens + 1, limit) }, interval / limit)
}
async request(fn) {
while (this.tokens <= 0) await new Promise(r => setTimeout(r, 100))
this.tokens--
return fn()
}
}Before & After Examples
for (let i = 0; i < 1000; i++) {
await fetch("/api/items/" + i) // Hits rate limit immediately
}const limiter = new RateLimiter(10, 1000) // 10 requests per second
for (let i = 0; i < 1000; i++) {
await limiter.request(() => fetch("/api/items/" + i))
}Related Tools
Use these tools to debug and fix this error:
HTTP Status Code Reference
Searchable reference of all HTTP status codes with descriptions and use cases.
REST API Client
Send HTTP requests (GET, POST, PUT, DELETE) and inspect responses from your browser.
Request Builder
Build HTTP requests interactively and generate code snippets in multiple languages.
Related Errors
Other common errors in this category:
401 Unauthorized Error
Learn what a 401 Unauthorized error means, common causes, and how to fix authentication failures in your web applications.
403 Forbidden Error
Learn what 403 Forbidden means, how it differs from 401, and how to fix access denied errors in your applications.
404 Not Found Error
Learn what 404 Not Found means, common causes, and how to fix broken links and missing resources on your website or API.
500 Internal Server Error
Learn what 500 Internal Server Error means, common causes, and how to debug and fix server-side failures.
Frequently Asked Questions
How long should I wait after a 429?
Check the Retry-After header which tells you exactly how many seconds to wait. If it's not provided, use exponential backoff starting at 1 second.
Is 429 the same as rate limiting?
Yes. 429 is the standard HTTP status code for rate limiting. Some services may return 503 Service Unavailable instead, but 429 is the correct semantic status.