← Alle Vorlagen

Limits pro Nutzer und pro IP, 429 mit Retry-After, Limits je nach Tarif.

Spec — Rate limiting

Status: draft · Created: 2026-11-10

1. Context and goal

The API protects itself and its customers from bursts and abuse, with limits that clients can see and plan around.

2. Functional requirements (EARS)

  • FR-1: THE SYSTEM SHALL count requests per authenticated user and per client IP in a sliding window of 60 seconds, shared by all instances.
  • FR-2: WHERE a request is authenticated, THE SYSTEM SHALL apply the limit of the caller's plan (for example 60, 600 and 6,000 requests a minute), and 30 requests a minute per IP to anonymous requests.
  • FR-3: WHEN a client exceeds a limit, THE SYSTEM SHALL answer 429 with Retry-After in whole seconds until a request would be accepted, without running the handler.
  • FR-4: THE SYSTEM SHALL send RateLimit-Limit, RateLimit-Remaining and RateLimit-Reset headers on every response.
  • FR-5: WHEN an operator changes the limit of a plan, THE SYSTEM SHALL apply it within 60 seconds without a deploy.
  • FR-6: IF the counter store is unreachable, THEN THE SYSTEM SHALL let requests through, log the failure and raise an alert within 1 minute.

3. Out of scope

  • Billing for usage above the limit.
  • DDoS protection at the network edge.