Skip to content

HTTP Status Code 429 – Too Many Requests

HTTP Status Code 429 – Too Many Requests

The HTTP 429 Too Many Requests response status code indicates that the user has sent too many requests in a given amount of time (“rate limiting”). This status is often returned by APIs to prevent abuse or overuse of the server resources.

Example 1: API Rate Limiting

Consider a scenario where an API allows only 100 requests per hour. If a client exceeds this limit, the server will respond with a 429 status code.

HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 3600

{
  "error": "Too many requests",
  "message": "You have exceeded the 100 requests in 1 hour limit. Please try again later."
}
    

In this example, the Retry-After header indicates that the client should wait 3600 seconds (or 1 hour) before making a new request. The JSON response body provides additional information about the rate limit and suggests when the client can try again.

Example 2: Web Scraping Protection

A website may implement rate limiting to protect against excessive web scraping. If a bot sends requests too quickly, the server might block it temporarily using a 429 status.

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

<html>
<head><title>Too Many Requests</title></head>
<body>
  <h1>Too Many Requests</h1>
  <p>You have been temporarily blocked due to excessive requests. Please try again after 10 minutes.</p>
</body>
</html>
    

Here, a Retry-After header of 600 seconds suggests a 10-minute wait. The HTML response provides a human-readable message indicating the block due to too many requests.

Example 3

# Client sends a request example.
GET /example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 429 429 Too Many Requests
Date: Wed, 09 Oct 2024 23:07:16 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Description of the error for 429"
}

Example 4 Scenario

# Client sends another example request.
POST /another-example HTTP/1.1
Host: www.example.com

# Server Response
HTTP/1.1 429 429 Too Many Requests
Date: Wed, 09 Oct 2024 23:07:16 GMT
Server: ExampleServer/1.0
Content-Type: application/json

{
    "error": "Detailed message for 429"
}

Summary:

The HTTP 429 status code is used to enforce rate limits and prevent server overload by controlling the frequency of requests from clients. It is accompanied by the Retry-After header, which informs the client how long to wait before retrying. This status is crucial for maintaining service quality and protecting resources.

I am the founder of SEO Leaders and have been involved in the internet and web development in one way or another for over 20 years. Since founding SEO Leaders some 6 years ago I have been heavily involved in web develepment, Digital PR and technical SEO for a wide variety of projects. I hope to enlighten you on a wide range of topics related to my chosen profession!

Back To Top