← API Security learning pathAPI Security · Module 5 of 8
Rate limiting and abuse protection
Keep one client from harming everyone.
📖 Key ideas
- Rate limits cap requests per user, API key or IP address in a time window.
- Return HTTP 429 Too Many Requests with a Retry-After header when the limit is hit.
- Apply stricter limits to sensitive actions: login, OTP, password reset and payments.
- Protect expensive operations, such as reports and exports, with quotas and queues.
- Monitor unusual patterns, such as many failed logins or one key calling every record in order.
💡 Real-life example: Rate limiting is like an ATM's daily withdrawal limit: normal customers never notice it, but a thief with a stolen card cannot empty the account in one go.
Rate limitMaximum requests allowed in a time window
HTTP 429Response meaning too many requests
QuotaAllowance of usage over a longer period
Retry-AfterHeader telling the client when to try again