Skip to content
On this page

Rate limiting is a control that caps how many requests a single client can make to a server within a fixed time window. A site might allow 60 requests per minute per IP address, or 1,000 per hour per API key. Go over the limit and the server stops serving you - usually with an HTTP 429 Too Many Requests response, sometimes a temporary block. Sites use it to protect their infrastructure from overload, keep one user from hogging capacity, and slow down automated traffic.

Quick facts

Measured inRequests per second, minute, hour, or day
Keyed byIP address, API key, account, or session
Typical signalHTTP 429, sometimes 503; Retry-After header
Common algorithmsToken bucket, leaky bucket, fixed/sliding window
Scraper fixThrottle, back off on 429, spread load across IPs

How rate limiting works

A server tracks how many requests have come from a given key - most often an IP address or an API token - and compares that count against an allowance. The two most common implementations are the token bucket and the sliding window. A token bucket hands each client a bucket that refills at a steady rate (say, one token per second up to a cap); each request spends a token, and when the bucket is empty, requests are rejected until it refills. A sliding window counts requests over the trailing N seconds. When you exceed the allowance, the server returns a 429 status, often with a Retry-After header telling you how many seconds to wait. Well-behaved clients read that header and pause; clients that ignore it and keep hammering frequently earn a longer, harder block.

Why rate limiting matters for web scraping

Rate limiting is the wall most scrapers hit first, before any CAPTCHA or fingerprint check. Fire requests as fast as your code can loop and you will trip a per-IP limit within seconds, and from then on the site sees a stream of 429s instead of data. The naive fix - add a sleep between requests - works for small jobs but does not scale: one IP at a polite rate is still one IP, and the whole job runs at that single IP's allowance. The real fix is to spread the load. Distribute requests across a pool of rotating proxies so no single IP exceeds the per-IP cap, while keeping each individual IP's rate plausibly human.

Staying under the limit

A robust scraper handles rate limits in layers. Respect the Retry-After header when you get a 429 and back off exponentially - wait 1s, then 2s, then 4s - instead of retrying instantly. Cap your concurrency so you are not sending fifty parallel requests to a site that allows ten. Spread traffic across many IPs via a rotating proxy pool, and add small random jitter to your timing so the pattern looks organic rather than a metronome. A managed scraping API folds all of this together: it pools IPs, paces requests per target site, and retries on 429 automatically, so you send one call and get the data without tuning backoff by hand. See also throttling and request retries.

Code example

python
import time, requests

def get_with_backoff(url, max_tries=5):
    delay = 1.0
    for attempt in range(max_tries):
        r = requests.get(url)
        if r.status_code != 429:
            return r
        # honor Retry-After if the server sent one
        wait = int(r.headers.get('Retry-After', delay))
        time.sleep(wait)
        delay *= 2  # exponential backoff
    raise RuntimeError('rate limited after retries')

# At scale, rotate IPs instead of just sleeping - one IP = one allowance.

Next in When requests get blocked · 4 of 6

Handling limits well is mostly a retry-strategy problem.

What Are Request Retries?

Related terms

Concept map

Concept map

How Rate Limiting connects

The terms most directly tied to this one. Hover a node to see its neighbours, click to preview, drag to rearrange.

0 terms · 0 connections
You are here · Web Scraping APIs
Building map…

Frequently asked questions

What is the difference between rate limiting and a 429 error?

Rate limiting is the policy - the rule that caps requests per time window. A 429 Too Many Requests error is the response a server sends when you break that rule. The 429 often includes a Retry-After header telling you how long to wait before the limit resets.

How do scrapers get around rate limits without breaking them?

By spreading load rather than overwhelming one endpoint: distributing requests across a pool of rotating IPs so no single address exceeds its per-IP allowance, capping concurrency, and backing off when a 429 appears. The goal is to stay under each IP's limit, not to overpower the limit itself.

What algorithms power rate limiting?

The common ones are token bucket and leaky bucket (which refill or drain at a steady rate), and fixed-window or sliding-window counters (which tally requests over a time span). Token bucket is popular because it allows short bursts while enforcing a steady average rate.

Why do sites use rate limiting?

To protect server capacity from overload, ensure fair access so one client cannot starve others, control infrastructure cost, and slow down automated abuse like credential stuffing or aggressive scraping. It is a core reliability tool, not only an anti-bot measure.

Last updated: 2026-06-08