API Design Workbook
63 topics across API foundations, communication patterns, architectural styles, security, operational concerns, worked API designs, and public postmortems. Every system uses the same 9-step API-design walk-through; every building block has a consistent design template.
Foundations
6 items What APIs are, why API design is its own discipline, the network primitives every product engineer should know.
Foundations
6 items- What Is API Design?
APIs as contracts between systems. The product-architecture lens, why API design is its own discipline, and what good looks like.
Concept Foundational - Business Considerations of APIs
APIs as products. Monetisation, partner programs, developer experience as a moat, why Stripe is Stripe.
Concept Foundational - The Narrow Waist of the Internet
Why IP is the everything-over-IP-and-IP-over-everything pivot, and what that means for API designers building on top.
Concept Foundational - Latency and Throughput
The two performance dimensions every API designer must hold in head. The 100 ms human-perception ceiling and the throughput-vs-latency trade.
Concept Foundational - Network Sockets — The Foundation
Sockets as the OS-level primitive every HTTP server stands on. Why API designers should know what's underneath.
Concept Foundational - The World Wide Web
URLs, HTTP, HTML — the three-letter trio Tim Berners-Lee picked in 1989 and the rest of API design has been catching up with since.
Concept Foundational
Communication Patterns
7 items HTTP and its evolution, RPCs, WebSockets, and the textual + binary data formats every API designer must read fluently.
Communication Patterns
7 items- Data Representation and Efficient Communication
On the wire, every API is bytes. The trade-off between human-readable and compact, and why both have their place.
Concept Foundational - HTTP — The Foundational Protocol for APIs
Methods, status codes, headers, persistent connections — the parts of HTTP every API designer must own.
Building Block Foundational - The Evolution of HTTP — 1.1, 2, 3
Pipelining → multiplexing → QUIC. How each version solved the previous one's head-of-line problem and what that buys API designers.
Building Block Intermediate - Remote Procedure Calls (RPCs)
Calling a remote function as if it were local. The 'function-call' abstraction, its leaks, and where it's still the right call.
Building Block Intermediate - WebSockets — Bidirectional Streaming
Upgrade-handshake, full-duplex frames, the long-lived connection model. When push beats poll.
Building Block Intermediate - Textual Data Formats — JSON, XML, YAML
The trio every API designer must read fluently. Why JSON won, where XML still lives, what YAML costs in subtle bugs.
Building Block Foundational - Binary Data Formats — Protobuf, MessagePack, Avro
When the wire matters more than the diff. Schema-first vs schema-less, evolution semantics, the size-vs-debuggability trade-off.
Building Block Intermediate
Architectural Styles
6 items REST, GraphQL, gRPC, and the honest comparison every API designer needs to make.
Architectural Styles
6 items- Web API Architectural Styles — Overview
REST, GraphQL, gRPC, SOAP, WebSocket, webhook. The catalogue, when each is right, and why every team thinks theirs is special.
Concept Foundational - REST — The Architectural Style
Resources, verbs, statelessness, cache, uniform interface, HATEOAS. Fielding's PhD thesis applied to your CRUD endpoints.
Building Block Foundational - RESTful API Design in Practice
Path conventions, status codes that fit, payload shape, pagination, filtering, the bulk-operations friction every REST API hits.
Building Block Foundational - GraphQL — A Query Language for APIs
One endpoint, client-shaped responses, the N+1 problem, schema as the contract. When the flexibility earns its complexity.
Building Block Intermediate - gRPC — Protobuf over HTTP/2
Service-definition-first, code-generated clients, streaming variants, the polyglot internal-RPC story that won at Google.
Building Block Intermediate - REST vs GraphQL vs gRPC — Comparison
The honest trade-offs. Latency, payload size, tooling, debuggability, mobile-friendliness, where each one breaks first.
Concept Intermediate
Security
8 items TLS, input validation, CORS, AuthN/AuthZ, OAuth 2, OpenID, SAML — the security surface every API designer owns.
Security
8 items- API Security — An Overview
The threat model: authentication, authorization, integrity, confidentiality, availability. What an API designer owns.
Concept Foundational - Transport Layer Security (TLS)
TLS 1.2 vs 1.3 handshake, cert chains, mTLS, the cost of a TLS terminator, why HTTPS is non-negotiable.
Building Block Foundational - Securing APIs Using Input Validation
Validate at the boundary, reject early, normalise once. SQL/NoSQL injection, type confusion, the OWASP API top-10.
Building Block Foundational - CORS — Cross-Origin Resource Sharing
The same-origin policy, preflight, Access-Control-Allow-*, credentials, the wildcard that breaks production.
Building Block Intermediate - Authentication vs Authorization
Who you are vs what you can do. The two-word vocabulary every API designer must use precisely.
Concept Foundational - OAuth 2 — The Authorization Framework
Authorization Code + PKCE, refresh tokens, scopes, the four roles. The protocol every modern API uses and gets wrong half the time.
Building Block Intermediate - OpenID Connect and SAML
OIDC layers identity on OAuth; SAML is the older enterprise SSO. When to pick each, and why both still ship in 2026.
Building Block Intermediate - API Security — A High-Level Recap
The checklist: TLS, validate, AuthN, AuthZ, rate limit, audit. The mnemonic an API designer carries into every review.
Concept Foundational
Operational Concerns
17 items Versioning, rate limiting, caching, idempotency, retries, circuit breakers, monitoring — the production-grade concerns of a real API.
Operational Concerns
17 items- API Versioning
URI versioning, header versioning, semantic versioning. The choice that ages well vs the one that bites every quarter.
Concept Intermediate - Evolving an API Design
Backward-compatible additions, breaking-change taxonomy, deprecation timelines. How successful APIs survive a decade.
Concept Intermediate - Rate Limiting
Token bucket, leaky bucket, fixed window, sliding window. Per-user vs per-IP, the 429 contract, and the burst question.
Building Block Intermediate - Client-Adapting APIs
When the server shapes its response to the client (mobile vs web vs partner). The BFF pattern in API form.
Concept Intermediate - Data Fetching Patterns
Eager vs lazy, batch vs single, paginated vs streamed. The four levers every API designer pulls.
Concept Intermediate - Event-Driven Architecture Protocols
Webhooks, server-sent events, Kafka, message queues. The push-shaped alternative to request/response.
Building Block Intermediate - Cookies and Sessions for APIs
Stateful sessions over stateless HTTP, the SameSite / Secure / HttpOnly trio, when JWTs replace cookies and when they shouldn't.
Building Block Foundational - The Role of Idempotency in API Design
Idempotency keys, safe retries, the difference between idempotent and safe verbs. Why payments APIs care most.
Concept Intermediate - Server-Side Rendering vs Client-Side Rendering
The render seam shapes the API contract. SSR's full-payload vs CSR's many-small-calls, and the hybrid in between.
Concept Intermediate - Speeding Up Web Page Loading
Critical render path, third-party blockers, what an API designer can give the front-end to win the LCP and CLS scores.
Concept Intermediate - Resource Hints and Debouncing
preload, prefetch, dns-prefetch, preconnect. Debouncing user input to API calls; the trade-off between fresh and floody.
Concept Intermediate - The Circuit Breaker Pattern
Closed → Open → Half-Open. Failing fast when a dependency is sick; the cascade-prevention pattern Netflix made famous.
Building Block Intermediate - Managing Retries
Exponential backoff, jitter, retry budgets, the retry-storm that takes down a recovering service. Idempotency is mandatory.
Building Block Intermediate - Caching at Different Layers
Browser, CDN, gateway, app, database. Where to cache, what to cache, the cache-invalidation problem the joke is about.
Building Block Intermediate - API Monitoring
Logs, metrics, traces, the four golden signals (latency, traffic, errors, saturation), what the on-call must see in 5 seconds.
Building Block Intermediate - Estimating API Latency — Back-of-Envelope
Processing time + network time + queueing. The numbers every engineer should know (memory, SSD, datacenter RTT, cross-continent RTT).
Concept Intermediate - The API-Design Walk-through
A repeatable seven-step recipe for an API-design interview: requirements, endpoints, data, constraints, auth, evolution, latency.
Concept Foundational
API Designs
15 items Worked API designs for canonical product surfaces — Search, File, Comment, Pub-Sub, YouTube, Stripe, Twitter, Uber, and more.
API Designs
15 items- Design a Search Service API
Query, suggest, rank, paginate. Where latency budget lives and how to write a search API that won't go viral on the wrong page.
System Intermediate - Design a File Service API
Upload, download, range requests, multipart, signed URLs, resumability. The S3-shaped contract every backend reinvents.
System Intermediate - Design a Comment Service API
Threaded comments, pagination by cursor, moderation hooks, the reaction subsystem. The CRUD that scales to millions of nodes.
System Intermediate - Design a Pub-Sub Service API
Topics, subscribers, fan-out, at-least-once vs exactly-once. The asynchronous backbone of every modern microservice mesh.
System Intermediate - Design the YouTube Streaming API
Upload pipeline, transcode, ABR manifests, CDN, recommendation. The biggest video service in the world, from the API's side.
System Advanced - Design the Facebook Messenger API
Real-time delivery, presence, read receipts, group threads, end-to-end encryption. WebSockets + a careful state machine.
System Advanced - Design the Google Maps API
Tiles, geocoding, routing, places, distance matrix. The geospatial endpoints behind a billion daily queries.
System Advanced - Design a Chess API
Game lifecycle, move validation, time control, spectator stream. The cleanest turn-based-game API in the catalogue.
System Intermediate - Design the Zoom API
Meetings, participants, signalling, recording, webhooks. The video-conferencing API behind a pandemic-era infrastructure.
System Advanced - Design the LeetCode API
Problem, submission, judge, leaderboard. The fan-out from problem-fetch to async judge to result subscription.
System Intermediate - Design the Stripe Payment API
PaymentIntent, charge, refund, webhook, the cards-network interaction. The gold-standard for payments-API design.
System Advanced - Design the Twitter API
Tweet, timeline, follow graph, search, streaming. The read-heavy fan-out problem at planet scale.
System Advanced - Design the Uber API
Riders, drivers, dispatch, trip lifecycle, surge. Real-time matching with geospatial constraints.
System Advanced - Design the CamelCamelCamel API
Price-tracking for Amazon products. A scraper-shaped API that must respect a partner's rate limits and ToS.
System Intermediate - Design a Gaming API
Matchmaking, lobby, real-time game state, leaderboards, anti-cheat hooks. Latency-sensitive APIs where 50 ms is everything.
System Advanced
Failures & Postmortems
4 items Public API postmortems — Knight Capital 2012, AWS S3 2017, Facebook + Uber outages. What the contract didn't enforce.
Failures & Postmortems
4 items- What Causes API Failures — A Taxonomy
Deploy bugs, capacity, contract drift, dependency outage, cascading retries. The five patterns that recur in every public postmortem.
Concept Foundational - Knight Capital 2012 — The 45-Minute $440M Bug
An un-removed feature flag (SMARS) revived dead code on one of eight servers. A trading-API contract that didn't enforce safety.
Postmortem Foundational - AWS S3 2017 — The us-east-1 Service Disruption
A typo in a maintenance command cascaded through the S3 control plane. The API's read path went down and took half the Internet.
Postmortem Foundational - Facebook and Uber API Outages — Patterns
Two short case studies of cascading API failures from major social and mobility APIs. What the contract didn't say.
Postmortem Foundational