---
title: "HTTP 429 Too Many Requests: What It Means and How to Fix It"
description: "A 429 Too Many Requests response means you hit a rate limit. Read Retry-After, wait that long, then retry; a tested Python loop and the headers to watch."
url: https://perceptlayer.com/blog/http-429-too-many-requests
---

[Blog](https://perceptlayer.com/blog) / [Data engineering](https://perceptlayer.com/blog/category/data-engineering)

# HTTP 429 Too Many Requests: What It Means and How to Fix It

15 Oct 2026 Perceptlayer 7 min read

HTTP 429 Too Many Requests means the server is rate limiting you: you sent more requests than it allows in some window of time. It isn't a bug in your request. The fix is to wait the number of seconds in the response's `Retry-After` header, retry, and then send requests more slowly so you stop hitting the limit. This post covers what the status code means, the headers that tell you how long to wait, and a tested Python retry loop.

## Key takeaways

-   429 is defined in RFC 6585: the client sent too many requests in a given amount of time. The server may say how long to wait in `Retry-After`.
-   `Retry-After` is either a number of seconds or an HTTP date. Parse both, wait at least that long, and cap the number of retries.
-   With no `Retry-After`, back off exponentially (2, 4, 8 seconds…) with random jitter so parallel workers don't retry at the same moment.
-   Headers such as `RateLimit-Remaining` and `RateLimit-Reset` let you slow down before you get a 429 at all.
-   On Perceptlayer a 429 costs nothing: it returns `X-Credits-Used: 0`, and `Retry-After` gives the seconds until the per-minute window resets.

## What does 429 Too Many Requests mean?

The 429 status code says the user has sent too many requests in a given amount of time, which is rate limiting. RFC 6585 defines it, and says the response should explain the condition and may include a `Retry-After` header saying how long to wait before making a new request ( [RFC 6585](https://www.rfc-editor.org/rfc/rfc6585), 2012). The same RFC says a 429 response must not be stored by a cache.

The RFC deliberately leaves the counting to the server. It doesn't say how the server identifies "the user" or how it counts: a limit can apply per resource, across a whole server, or across a set of servers. In practice an API usually counts per API key or per account, and a website per IP address or session.

So a 429 tells you two things: your request was probably fine, and you sent it too soon. Retrying at once makes it worse, because every rejected request usually still counts against the limit.

## Who is sending the 429, and is it you or them?

The 429 comes from whichever server enforces the limit, and that decides what you can do about it. If you call an API, its rate limit is in its docs and its headers, and you fix the 429 by slowing your client down. If you're a visitor on a website and see a 429 page, the site has decided your browser or network sent too many requests, and the only fix on your side is to wait.

Shared limits cause most surprises. When several scripts or workers use one API key, or one account, they draw on the same budget, so each one can be well under the limit while together they're over it. An office or a cloud provider's IP range can look like one heavy user to a website that limits by IP.

If you run the server and your own users see 429s, check the limit's scope first. A per-IP limit behind a proxy or load balancer may be counting every user as the proxy's address.

## How do you read Retry-After and RateLimit headers?

`Retry-After` is the header to read first, because it's the server telling you exactly when to come back. RFC 9110 defines its value as either an HTTP date or a number of seconds to wait after receiving the response ( [RFC 9110](https://www.rfc-editor.org/rfc/rfc9110#field.retry-after), 2022). Servers also send it on 503 Service Unavailable responses, to say how long the service is expected to be down.

| Header | Example | What it tells you |
| --- | --- | --- |
| `Retry-After` | `17` or `Wed, 21 Oct 2026 07:28:00 GMT` | When to retry |
| `RateLimit-Limit` | `300` | Requests allowed in the window |
| `RateLimit-Remaining` | `12` | Requests left in this window |
| `RateLimit-Reset` | `17` | Seconds until the window resets |
| `RateLimit-Policy` | `300;w=60` | The quota and the window length in seconds |

The `RateLimit-*` names come from the IETF HTTP APIs working group's draft on rate-limit headers. The current draft folds them into two structured fields, `RateLimit-Policy` and `RateLimit` ( [draft-ietf-httpapi-ratelimit-headers](https://github.com/ietf-wg-httpapi/ratelimit-headers), 2026), and many APIs still send older names, often with an `X-` prefix. Read whichever your API documents, and treat them as hints: the draft itself says available quota is not a guarantee the next request will be served.

## How do you fix a 429 in your code?

Retry the request after the wait the server asked for, and stop after a few attempts. The loop below handles `Retry-After` as seconds or as a date, falls back to exponential backoff when the header is missing, adds jitter, and gives up rather than sleeping for an unreasonable time. It retries only 429 and 503; other errors such as 400 or 401 won't fix themselves, so it returns them for your code to handle.

```python
import random
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime

import requests

RETRYABLE = {429, 503}

def retry_after_seconds(value):
    """Retry-After is either delay-seconds or an HTTP-date (RFC 9110)."""
    if not value:
        return None
    if value.strip().isdigit():
        return int(value)
    try:
        when = parsedate_to_datetime(value)
    except (TypeError, ValueError):
        return None
    return max(0, (when - datetime.now(timezone.utc)).total_seconds())

def get_with_retry(url, params=None, headers=None, max_attempts=5, max_wait=120):
    for attempt in range(1, max_attempts + 1):
        resp = requests.get(url, params=params, headers=headers, timeout=60)
        if resp.status_code not in RETRYABLE:
            return resp
        if attempt == max_attempts:
            break
        wait = retry_after_seconds(resp.headers.get("Retry-After"))
        if wait is None:
            wait = min(2 ** attempt, 60)  # no header: exponential backoff
        wait += random.uniform(0, 1)  # jitter, so parallel workers don't retry in step
        if wait > max_wait:
            break
        print(f"{resp.status_code}, waiting {wait:.1f}s (attempt {attempt})")
        time.sleep(wait)
    resp.raise_for_status()
    return resp
```

We tested it against a local mock server that answered a 429 with `Retry-After: 2`, then a 503 with no header, then a 200:

```text
429, waiting 2.9s (attempt 1)
503, waiting 5.0s (attempt 2)
final 200 after 3 requests
```

The first wait followed the header, the second fell back to backoff. Most HTTP clients have this built in under another name, such as `urllib3`'s `Retry` with `respect_retry_after_header`, so check yours before writing your own. [Handle Web Data API Errors in Python](https://perceptlayer.com/blog/handle-web-data-api-errors-python) covers the other status codes.

## How do you stop getting 429s in the first place?

Send requests no faster than the limit, and let one place in your code decide the pace. Retrying fixes the request in front of you; pacing fixes the cause.

1.  **Know the number.** Read the API's documented limit, or `RateLimit-Limit` and `RateLimit-Policy`, and convert it to the unit you schedule in.
2.  **Throttle at the source.** A token bucket or a semaphore in front of all workers keeps the total rate under the limit, however many workers you run. [Concurrent API Requests in Python](https://perceptlayer.com/blog/concurrent-api-requests-python-rate-limit) builds one with asyncio.
3.  **Watch `RateLimit-Remaining`.** When it's low, sleep for `RateLimit-Reset` seconds before the next request rather than after a 429.
4.  **Don't fetch twice.** Cache responses that don't change within your job, so repeated questions don't spend requests. [Cache Web Data API Responses](https://perceptlayer.com/blog/cache-web-data-api-responses) covers what to cache and for how long.
5.  **Stagger scheduled jobs.** If several of your jobs share a key and start in the same minute, they compete for the same window. Start them a few minutes apart.

For agents, put the cap in the tool layer, because a model in a loop can issue calls faster than you expect. [MCP Server Rate Limiting](https://perceptlayer.com/blog/mcp-server-rate-limiting-agents) shows where.

## What does a 429 look like on Perceptlayer, and does it cost anything?

A 429 from Perceptlayer costs nothing. Rate limits are per account, shared by all its keys, and counted in a fixed one-minute window: a free account gets 1 request a second (60 a minute), and a paying account gets the rate of the credits it's using, at least 5 a second (300 a minute). When the window is full you get status 429, the error code `rate_limited`, `X-Credits-Used: 0`, and a `Retry-After` header with the seconds until the window resets.

```bash
curl -i "https://api.perceptlayer.com/v1/google-search/search?query=best+restaurants+in+Berlin&hl=en" \
  -H "X-API-Key: $API_KEY"
```

We didn't run this request for this post. Responses also carry `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` and `RateLimit-Policy`, and the error body has the usual shape: `{"error": {"code", "message", "request_id"}}`. The [rate limits docs](https://docs.perceptlayer.com/rate-limits) list the rates per pack, and the [errors docs](https://docs.perceptlayer.com/errors) list every code.

### What does that mean for a batch job?

A free account can run 60 searches a minute. A job of 3,000 searches therefore needs at least 3,000 ÷ 60 = 50 minutes; paced at that rate it never sees a 429, and it costs 3,000 × 1 credit = 3,000 credits. At a paying account's 300 a minute the same job takes 10 minutes. Firing all 3,000 at once doesn't finish sooner: at most 60 succeed in a window and the rest are rejected with 429 until the window resets. See [pricing](https://perceptlayer.com/pricing) for the rate each pack includes.

One caution for retries in general: a request that timed out on your side may still have succeeded on the server. [Retry Web API Calls Without Paying Twice](https://perceptlayer.com/blog/retry-web-api-calls-without-paying-twice) covers that case. To see the headers on a real response, run a search in the playground on the [Google Search API page](https://perceptlayer.com/apis/google-search), or [get a free API key](https://perceptlayer.com/signup) and run the cURL above with `-i`.

## APIs in this post

-   [Google Search **1 credit per call** · 7 endpoints](https://perceptlayer.com/apis/google-search)

## Frequently asked questions

### How long should I wait after a 429?

Wait the number of seconds in the `Retry-After` header, or until the date it gives, plus a second of random jitter. If there's no header, back off exponentially: about 2 seconds, then 4, then 8, with a cap. Retrying immediately usually fails again, because rejected requests often count against the same limit.

### Is a 429 error my fault or the server's?

Usually neither is broken. The server is enforcing a limit it chose, and your client exceeded it, often because several workers share one key or account. Slow the client down to the documented rate. A 429 on a website you're browsing means the site is limiting your browser or network; waiting a few minutes is the fix.

### What is the difference between 429 and 503?

A 429 says you sent too many requests; a 503 says the server or the service behind it can't handle the request right now, whoever sent it. Both may carry `Retry-After`, and both are worth retrying after the wait. On Perceptlayer, neither costs credits: `rate_limited` (429) and `temporarily_unavailable` (503) both return `X-Credits-Used: 0`.

### Does a 429 count against my credits?

Not on Perceptlayer. Only a successful response debits credits; a 429, like every other error, returns `X-Credits-Used: 0` and still reports `X-Credits-Remaining`. On other APIs, check the docs: some count rejected requests toward a daily quota even when they don't bill for them.

### Should I retry a 429 forever?

No. Cap the attempts (five is plenty) and the longest wait you'll accept, then fail and log it. A 429 that persists after the reset means your overall rate is too high, and more retries only add load. Fix the pace instead: throttle all workers through one limiter set below the documented limit.

http 429 rate limits retry-after python api errors

## More from the blog

1.  [Data engineering](https://perceptlayer.com/blog/category/data-engineering) 25 Oct 2026 Perceptlayer 7 min read
    
    ## [API Rate Limiting: How Limits Work and How to Stay Under](https://perceptlayer.com/blog/api-rate-limiting-explained)
    
    API rate limiting from the client side: per-minute limits, the RateLimit and Retry-After headers, and a Python pacer that runs 3,000 searches in 50 minutes.
    
2.  [Data engineering](https://perceptlayer.com/blog/category/data-engineering) 5 Oct 2026 Perceptlayer 8 min read
    
    ## [Concurrent API Requests in Python: Asyncio Under Rate Limits](https://perceptlayer.com/blog/concurrent-api-requests-python-rate-limit)
    
    A Python asyncio fetcher that paces calls to your per-second limit, honours Retry-After and prices a 20,000-call batch at 20,000 credits.
    
3.  [Data engineering](https://perceptlayer.com/blog/category/data-engineering) 9 Sept 2026 Updated 10 Nov 2026 Perceptlayer 7 min read
    
    ## [Handle Web Data API Errors in Python: 4xx, 5xx and Timeouts](https://perceptlayer.com/blog/handle-web-data-api-errors-python)
    
    Map the API's error codes to retry, fix or stop in Python: 429 and 503 honour Retry-After, 4xx stops, and failed calls cost 0 credits.
