What Is Rate Limiting?
Rate limiting restricts how many requests a client can make to an API within a given time window, protecting the service from overload or abuse.
Published November 17, 2026
Rate limiting caps how many requests a client can make in a time window, protecting your API from abuse and overload. Exceeding it returns HTTP 429 Too Many Requests.
The concept
Common algorithms: fixed window (100/min per key), sliding window and token bucket (tokens refill at a steady rate, allowing short bursts).
Limits are keyed by IP, API key or user. Responses should include headers like Retry-After and X-RateLimit-Remaining.
Token bucket
- Bucket holds up to N tokens, refilled steadily
- Each request consumes one token
- Empty bucket → reject with 429
- Tokens refill, requests resume
Practical examples
Laravel throttle
Route::middleware('throttle:60,1')->group(function () { /* 60 requests per minute */ });Express
import rateLimit from 'express-rate-limit'
app.use(rateLimit({ windowMs: 60_000, max: 100 }))429 response
HTTP/1.1 429 Too Many Requests
Retry-After: 30Client back-off
if (res.status === 429) await sleep(Number(res.headers.get('Retry-After')) * 1000)Common mistakes
- Limiting only by IP behind shared NAT.
- No Retry-After header.
- Storing counters in process memory with multiple servers (use Redis).
Key takeaways
- Cap requests per window.
- 429 + Retry-After.
- Share counters across servers.
FAQ
Rate limit vs throttle?
Often used interchangeably; throttling may slow requests instead of rejecting.
Where to enforce?
At the edge or gateway, plus sensitive endpoints in the app.