GRC Careers

HomeResourcesAPI Rate Limiting

CS-070 · API Security

API Rate Limiting

Controlling how many requests a client can make to protect APIs from abuse, overload, and brute force.

Executive Summary

API rate limiting controls how many requests a given client can make in a period of time, so a single caller cannot overwhelm a service or grind through attacks unchecked. It protects availability, blunts brute force and scraping, and helps control cost. Effective rate limiting combines the right algorithm, clear client keys, sensible limits, and helpful responses when a limit is reached.

What It Is

Rate limiting is a control that caps the number of requests a client may send to an API within a defined window, and throttling slows or queues requests that exceed a threshold. The API tracks usage per identifier, such as an API key, an authenticated user, or an address, and rejects or delays requests once the limit is hit. It is both a reliability control, protecting a service from being overwhelmed, and a security control, making brute force, credential stuffing, and data scraping far slower and more expensive for an attacker. Related mechanisms include quotas, which cap usage over longer periods such as a day or month, and burst allowances, which permit short spikes while holding a steady average.

Why It Matters

Without rate limiting, a single misbehaving or malicious client can degrade a service for everyone, and an attacker can attempt thousands of password guesses or extract large volumes of data through an otherwise legitimate endpoint. Rate limiting turns these attacks from fast and cheap into slow and costly, which is often enough to stop them. It also protects downstream systems and controls the cost of paid or metered dependencies. For engineers and security professionals, rate limiting is a foundational defense that appears in the OWASP API Security Top 10, because the absence of it amplifies almost every other API risk, from brute force on authentication to bulk extraction through weak authorization.

How It Works

Rate limiting depends on identifying the client and counting its requests against a limit. Several algorithms are common. A fixed window counts requests in set intervals, which is simple but can allow a burst at the edges of two windows. A sliding window smooths this by considering a rolling period. A token bucket gives each client a bucket of tokens that refills at a steady rate, allowing short bursts while enforcing an average, and a leaky bucket processes requests at a constant rate and drops overflow. When a client exceeds its limit, a well-designed API returns a clear status indicating too many requests, along with information telling the client how long to wait before retrying. In distributed systems the counters must be shared across servers, often in a fast central store, so the limit holds no matter which server handles a request. Limits are typically layered: stricter on sensitive endpoints such as login, looser on read-only public data.

Architecture Diagram

Incoming request identified by key or userCounter checked against the limitWithin limit: request servedOver limit: request rejectedResponse tells the client when to retry
Each request is identified, counted against the client's limit, and either served or rejected with a retry hint.

Visual Workflow

Identify each client reliably by API key, authenticated user, or another stable key.Choose an algorithm such as token bucket or sliding window that fits the traffic pattern.Set limits per endpoint, with stricter limits on sensitive actions like authentication.Share counters across servers so limits hold in a distributed deployment.Return a clear too-many-requests response with guidance on when to retry.Monitor rejections and abuse patterns and tune the limits over time.

Common Attacks

Common Mistakes

Best Practices

Quick Checklist

Recommended Tools

API gateway
Enforces rate limits and quotas centrally in front of services
Reverse proxy
Applies request throttling at the network edge
In-memory data store
Holds shared counters for fast, distributed limit checks
Web application firewall (WAF)
Detects and blocks abusive request patterns

Industry Standards

OWASP API Security Top 10
Names unrestricted resource consumption and lack of rate limiting as key API risks
IETF guidance on the too-many-requests status
Defines the standard response for exceeding a rate limit
NIST SP 800-63B
Recommends throttling and rate limiting to resist online guessing of credentials

Career Relevance

Rate limiting is a routine responsibility for backend engineers, API security engineers, and application security engineers who design resilient, abuse-resistant endpoints. Security engineers use it to defend authentication and reduce scraping, and reliability and platform teams rely on it to protect availability. Understanding it is also useful for AI governance professionals, since rate limits protect AI service endpoints from abuse and runaway cost.

Interview Questions

Related Certifications

OWASP-aligned application security training CompTIA Security+ (foundational) Cloud and platform engineering certifications (vendor-neutral concepts)

Further Reading

Key Takeaways

Download PDFDownload PNG

FAQ

What is the difference between rate limiting and throttling?

Rate limiting caps the number of requests allowed in a window and rejects those beyond it. Throttling slows or queues requests once a threshold is reached rather than rejecting them outright. Both control how fast a client can call an API.

Why is limiting by address not enough?

Addresses can be rotated across many hosts, and many legitimate users can share one address behind a proxy or gateway. Limiting by a stable identifier such as an authenticated user or API key is more precise and harder to evade.

Does rate limiting stop brute force attacks?

It does not stop them outright, but it makes them far slower and more expensive, which often deters attackers. Combine rate limiting with strong authentication, monitoring, and account protection for effective defense.

Get all 116 reference sheets
The complete AGJ Cybersecurity Professional Reference Library, print-ready PDFs and PNGs.
Browse the library

Related Careers

Related certifications

OWASP-aligned application security trainingCompTIA Security+ (foundational)Cloud and platform engineering certifications (vendor-neutral concepts)

Current openings

Live openings appear on the web version. Browse the job board for current GRC and security roles.
Browse all jobs

Suggested learning path

  1. Ground the basics with CS-001 Cybersecurity
  2. Study this sheet: API Rate Limiting
  3. Go deeper: API Gateways
  4. Go deeper: REST API Security
  5. Validate it: work toward OWASP-aligned application security training
  6. Find the role: browse current openings

Related sheets

More in API Security

Share this LinkedIn Facebook X Email