Rate limiting
Capping how many requests a user, key or IP can make in a time window, and answering HTTP 429 above it.
Rate limits protect logins from password guessing, APIs from scrapers and expensive endpoints, such as AI calls, from runaway bills. A good 429 response includes Retry-After, so honest clients back off. Limits keyed by account are fairer than by IP, because many users can share one address.
Related terms
- Cost cap: A hard spending limit enforced by your code, per user, per day or per month.
- WAF (web application firewall): A filter in front of a web app that blocks malicious HTTP requests before they reach your code.
- Idempotency (idempotency key): An operation is idempotent if doing it twice has the same effect as doing it once. Retries become safe.
