Rate limiting caps how many requests a client can make to a website or API in a given period, and slows or rejects the rest. It protects capacity, keeps one client from crowding out others, and makes brute-force and high-volume abuse slower and more expensive.
How it works
A rate limiter counts requests per key, such as an IP address, API key, account or session, and compares the count with a limit. Common algorithms:
- Fixed window: count per clock minute or hour. Simple, but allows bursts at the window edges.
- Sliding window: count over the last N seconds, which smooths those bursts.
- Token bucket: tokens refill at a steady rate and each request spends one, which allows short bursts up to the bucket size.
- Leaky bucket: requests drain at a fixed rate, which evens out traffic.
When a client goes over the limit, the server usually answers with status 429 Too Many Requests, optionally with a Retry-After header. An IETF draft, RateLimit header fields for HTTP, defines RateLimit and RateLimit-Policy headers so servers can advertise their quotas. It is not yet an RFC.
Limits against bots
Per-IP limits catch only clumsy attacks. Credential stuffing and scraping tools rotate through residential proxies, so each address stays under the limit. Limits work better when keyed on something the attacker can’t rotate cheaply: the target account, a device fingerprint, a TLS fingerprint or a session.
In bot management, a rate limit is one possible action alongside challenges and blocks, often applied per bot category, for example to slow AI crawlers without blocking them.
For APIs, see API abuse and the mobile app and API bot protection rankings.