LESSON 01 · Contract

Define what is being limited

A limit has an identity, an action, a quota, a time scale, and a response.

SYSTEM VIEW

The decision path

Diagram view
Swipe or scroll to explore the full diagram
A quota needs a precise scopeAn identity and action select a rule; the resulting decision either forwards the request or returns a throttle response.A quota needs a precise scopeidentifylook uproomfullCalleruser · key · IPPolicy keyidentity + operationQuota ruleamount + periodAllowforward requestThrottle429 + retryA shared IP can represent many legitimate users.
An identity and action select a rule; the resulting decision either forwards the request or returns a throttle response.
Trace the quota decision before a request reaches the API.
THE IDEA

How it works

Start with the reason for throttling, which means refusing or delaying requests beyond an agreed allowance: protect an expensive endpoint, contain abuse, or allocate a fair share of capacity. Specify the key (authenticated user, API key, IP address, or a combination), the operation, the allowed amount, and the time period. A per-IP login limit can punish people behind a shared network; a per-user limit does not help before sign-in. The correct identity depends on the threat and product contract.

As an example, a login endpoint might use two rules: 5 failed attempts per account in 15 minutes to stop password guessing, and 300 attempts per IP address per minute to stop one machine trying many accounts. An office of 2,000 people behind one address stays under the second rule unless more than 300 sign in within a minute, and one person’s typos lock only their own account. GitHub’s REST API splits identity in a similar way: 60 requests per hour by IP address for unauthenticated callers, and 5,000 per hour by account for ordinary signed-in users.

State whether the quota must be strict, whether brief bursts are useful, and what happens when the store is unavailable. Decide if excess requests are rejected, delayed, or queued; a synchronous API commonly returns HTTP 429 with a useful retry signal. Set latency and accuracy targets before selecting an algorithm. Limits also cost a lookup per request and block some real users. For internal batch work you control, a queue with a fixed worker count is often simpler.

DECISION POINT

A university shares one public IP, and students report being blocked from signing in. What would you revisit?

Write a sentence or two to unlock the guidance. Committing first is what makes it stick.

Keep in mind

  • A rate limit is a policy scoped to an identity and operation.
  • Define burst, failure, and client response behavior before implementation.
CHECK YOUR UNDERSTANDING

Put it into practice.

1 OF 3
RecallQUESTION 01

What must a useful limit rule identify?

Choose an answer. You’ll see the explanation once you get it right.

Next lesson

0 of 3 checkpoints answered correctly to complete this lesson.