GET /api/v1/search/fast • HTTP 429 Too Many Requests

Rate-Limiting Headers & HTTP 429 Too Many Requests — Request & Response Example

Shows how scalable web APIs prevent denial-of-service abuse using token bucket algorithms and HTTP 429 status codes with Retry-After headers.

1. HTTP Client Request (GET)

GET /api/v1/search/fast HTTP/1.1
{
  "Accept": "application/json"
}

2. Server JSON Response (HTTP 429 Too Many Requests)

{
  "error": "Too Many Requests",
  "message": "Rate limit quota of 100 requests per minute exceeded. Please back off.",
  "retry_after_seconds": 30
}

Copy-Paste Code Snippets (cURL, JavaScript Fetch, Python, Node.js)

curl -I -X GET "https://cometflow.space/api/v1/search/fast"
fetch('https://cometflow.space/api/v1/search/fast')
  .then(res => {
    if (res.status === 429) {
      const wait = res.headers.get('Retry-After');
      console.warn(`Rate limited! Retry in ${wait}s`);
    }
    return res.json();
  });
import requests

res = requests.get('https://cometflow.space/api/v1/search/fast')
if res.status_code == 429:
    print(f"Rate limited. Retry after: {res.headers.get('Retry-After')} seconds")

How This API Call Works Step-by-Step

  1. 1. Client makes requests too rapidly in a short window.
  2. 2. Redis rate-limiter bucket decrements remaining counter to zero.
  3. 3. Server rejects request with status code 429.
  4. 4. Retry-After header informs client exactly how many seconds to pause before retrying.

Backend API Functions: The rate-limiter middleware checks the client IP or API key against an in-memory Redis sliding window and throws HTTP 429 when the threshold is reached.

Frequently Asked Questions

How should client applications handle HTTP 429?

Implement exponential backoff with jitter: pause for the duration specified in the Retry-After header before attempting an automated retry.