HTTP status code 429 Too Many Requests indicates that a client has sent too many requests to a server within a given time frame. This is commonly triggered by rate limiting rules on APIs or web servers to prevent abuse and ensure fair usage.
When a server detects excessive requests from a client (IP, token, or user), it responds with status code 429. Optionally, the response may include a Retry-After header telling the client when it is safe to retry.
// Express.js example showing rate limit handling
app.use((req, res, next) => {
res.status(429).json({ message: "Too many requests, please try again later." });
});
The server immediately rejects further requests and returns a JSON response with HTTP status 429. Clients should pause and retry later.
Imagine a counter that allows only 5 API requests per minute. Once the limit is exceeded, all further requests receive a 429 response until the timer resets.
Retry-After response headerCreate a small API with a rate limit of 3 requests per minute. Send 5 rapid requests and observe when the server starts responding with HTTP 429.