What Is a 429 Status Code?
The user has sent too many requests in a given amount of time (“rate limiting”).
The response representations SHOULD include details explaining the condition, and MAY include a Retry-After header indicating how long to wait before making a new request.
HTTP/1.1 429 Too Many Requests
<title>Too Many Requests</title>
<h1>Too Many Requests</h1>
<p>I only allow 50 requests per hour to this Web site per
logged in user. Try again soon.</p>
Note that this specification does not define how the origin server identifies the user, nor how it counts requests. For example, an origin server that is limiting request rates can do so based upon counts of requests on a per-resource basis, across the entire server, or even among a set of servers. Likewise, it might identify the user by its authentication credentials, or a stateful cookie.
Responses with the 429 status code MUST NOT be stored by a cache.
- Source: RFC6585 Section 4
429 CODE REFERENCES
Symfony HTTP Status Constant
Apache HttpComponents Core o
429 status code example
Here is an example of a request and response that could result in a 429 status code:
GET /api/data HTTP/1.1
HTTP/1.1 429 Too Many Requests
"message": "You have exceeded the maximum number of requests. Please try again later."
In this example, the client has made too many requests to the
/api/data endpoint and the server has responded with a 429 Too Many Requests status code. The response includes a
Retry-After header indicating the number of seconds the client should wait before making another request. The response also includes a JSON object with an
error field and a
message field providing additional information about the error.
To fix a 429 error, the client should wait until the
Retry-After period has passed before making another request. The server may also provide additional information or guidance in the error message about how to avoid rate-limiting errors in the future.
How to fix a 429 status code
To fix a 429 Too Many Requests status code, the client should wait until the
Retry-After period specified in the response has passed before making another request. The server may provide a specific time interval or a timestamp for the client to wait before trying again.
In addition to waiting, there are a few other strategies to avoid hitting the rate limit in the first place:
- Implement client-side throttling: By implementing client-side throttling, the client can limit the frequency of requests sent to the server, which can help avoid rate limits. This can be done by setting a maximum number of requests per second or by implementing an exponential backoff algorithm that increases the time between requests after each error response.
- Increase rate limits: If the server allows for rate limit customization, the client can request to increase their limit by contacting the server administrator or by following the server’s documentation on how to do so.
- Optimize requests: If the client is making inefficient or redundant requests, they can optimize their requests to reduce the overall number of requests. This can include batching requests together or using a more efficient API endpoint.
Overall, the best strategy to fix a 429 error is to wait for the specified
Retry-After period to pass and then adjust the client’s behavior to avoid hitting the rate limit in the future.
What is the difference between a 429 status code and a 503 status code?
A 503 Service Unavailable status code is returned by a server when it is temporarily unable to handle a request. This can happen due to server overload, maintenance, or other reasons. A 429 Too Many Requests status code, on the other hand, is returned by a server when the client has exceeded the rate limit or request quota.
The main difference between these two status codes is that a 503 error is typically due to issues on the server side, while a 429 error is due to issues on the client side. A 503 error indicates that the server is currently unavailable to handle requests, while a 429 error indicates that the server is available, but the client has sent too many requests too quickly.
In terms of how to fix these errors, a 503 error can be fixed by waiting for the server to become available again or by contacting the server administrator to address the issue. A 429 error can be fixed by adjusting the client’s behavior to send fewer requests or by waiting for the specified
Retry-After period to pass before making another request.
Does a 429 status code affect SEO?
A 429 Too Many Requests status code is not likely to have a direct impact on SEO because it is related to the frequency of requests being made by a client, rather than the content or structure of the website. However, if a website frequently returns a 429 error to search engine bots, it may cause the bot to stop crawling the website, which could impact indexing and ultimately affect search rankings.
- Learn about web development
- Learn about SEO
- Web development services from WebFX
- SEO services from WebFX
- MDN Web Docs