Design Tiered Rate Limiting For The Public Developer API

Last updated: November 29, 2026

Quick Overview

Design rate limiting for the X developer API, which sells Free, Basic, Pro and Enterprise tiers with different per-endpoint limits per 15-minute window and monthly post caps, so that limits are enforced across a global fleet and clients get accurate remaining-quota headers.

X
System Design
Software Engineer
X
November 29, 2026
Software Engineer
System Design Round
System Design
Medium

0

0

0 solved


Design rate limiting for the X developer API, which sells Free, Basic, Pro and Enterprise tiers with different per-endpoint limits per 15-minute window and monthly post caps, so that limits are enforced across a global fleet and clients get accurate remaining-quota headers.

The X API is a paid product and quota is literally what customers buy, so overcounting angers paying developers and undercounting gives away revenue and invites scraping. Interviewers want a concrete algorithm choice, a data store design that survives hot keys, and clear semantics across regions.

What the Interviewer Expects
  • Separates short-window rate limits from monthly usage caps
  • Chooses an algorithm (sliding window counter or token bucket) and justifies it
  • Keys limits by app, user context and endpoint
  • Returns standard headers and 429 with reset time
  • Discusses local versus global counters and accuracy
  • Plans for limiter store failure
Key Topics to Cover
rate limiting
sliding window counter
token bucket
Redis
API monetization
quota headers
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • Should a failed request (500 from us) count against quota?
  • How do you handle an Enterprise customer with a custom limit without a deploy?
  • A scraper rotates thousands of free apps. How do you detect and limit that?
  • What happens if the limiter's Redis cluster is unreachable?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Per tier and endpoint: N requests per 15 minutes, keyed by app (app-only auth) or by app plus user (user-context auth). Monthly caps on posts read and posts created per project. Return `x-rate-limit-l...

High-Level Design

API gateway calls a limiter library in-process. The library looks up the plan for the app (cached config service), builds keys like rl:{app}:{user}:{endpoint}:{window} and checks a Redis cluster sha...


Submit Your Answer
Markdown supported

Related Questions