API Design
Learn to design APIs that are understandable, consistent, evolvable, secure, observable, performant and difficult to misuse. Never memorize an endpoint convention without knowing what the client needs, what the contract guarantees, and how it can change without breaking anyone.
Your path through API Design
Start with these 5 lessons
Then follow the stages in order
Each stage builds on the ones before it. Labs and simulators sit right after the lessons they exercise. Open a stage to see its lessons. Full roadmap with goals →
Level 1 · Think in contracts, not endpoints0 of 18 lessons done
- What an API Contract Actually IsFoundation≈ 10 min
- Start With Requirements, Not EndpointsFoundation≈ 5 min
- Consumer-First DesignFoundation≈ 5 min
- API Granularity and the Chatty APIFoundation≈ 5 min
- Public vs Internal APIsFoundation≈ 5 min
- API Ownership and the CatalogFoundation≈ 5 min
- Design Principles Without CommandmentsFoundation≈ 5 min
- API Anti-Patterns Field GuideFoundation≈ 5 min
- From Domain to ResourcesFoundation≈ 10 min
- Resource or Action?Foundation≈ 10 min
- The "Everything Is CRUD" TrapFoundation≈ 10 min
- HTTP Methods Are PromisesFoundation≈ 10 min
- GET: The Promise of SafetyFoundation≈ 10 min
- POST: More Than CreateFoundation≈ 10 min
- Status Codes Clients Can Branch OnFoundation≈ 15 min
- Request Contracts: Required, Optional, Null and AbsentFoundation≈ 10 min
- Response Contracts Are Not Database RowsFoundation≈ 10 min
- One Vocabulary: Naming and ConsistencyFoundation≈ 10 min
Level 2 · Design the failure and query surface0 of 13 lessons done
- The Error Model: Structure Over ApologyFoundation≈ 10 min
- An Error Taxonomy Clients Can Branch OnFoundation≈ 10 min
- Validation Errors: Feedback, Not VerdictsFoundation≈ 10 min
- Retryability: Telling Clients What To Do NextFoundation≈ 10 min
- Partial Failure: When 3 of 5 SucceedFoundation≈ 10 min
- Over-Fetching and Under-FetchingFoundation≈ 10 min
- Pagination: Choosing How Lists EndFoundation≈ 15 min
- Offset Pagination: Simple, Jumpable, and Lying Under WritesFoundation≈ 15 min
- Cursor Pagination: An Opaque Bookmark, Not a PositionFoundation≈ 15 min
- Filtering: An Allowlist With an Index BillFoundation≈ 10 min
- Sorting: Determinism or DriftFoundation≈ 10 min
- Search Is a Different Contract Than FilteringFoundation≈ 10 min
- Unbounded Collections: The Anti-Pattern With a FuseFoundation≈ 10 min
Level 3 · Survive retries and concurrent writers0 of 13 lessons done
- PUT vs PATCHFoundation≈ 10 min
- DELETE: What Does Gone Mean?Foundation≈ 10 min
- Conditional Requests: ETags, 304 and 412Foundation≈ 10 min
- Idempotency: Surviving the RetryFoundation≈ 10 min
- Idempotency Keys: The MechanismFoundation≈ 10 min
- Idempotency vs DeduplicationFoundation≈ 5 min
- Optimistic Concurrency: Versions and If-MatchFoundation≈ 10 min
- The Lost Update, Step by StepFoundation≈ 10 min
- Consistency as a Contract ClauseFoundation≈ 10 min
- There Is No Transaction Across APIsFoundation≈ 10 min
- Retries and Timeouts as Contract GuidanceFoundation≈ 10 min
- Resources Have State MachinesFoundation≈ 5 min
- Designing State TransitionsFoundation≈ 10 min
Level 4 · Choose a style with open eyes0 of 9 lessons done
- Which API Style Should I Use?Intermediate≈ 10 min
- REST as a Practical StyleIntermediate≈ 10 min
- The "REST Purity" Anti-PatternIntermediate≈ 5 min
- RPC: Operation-Oriented ContractsIntermediate≈ 5 min
- gRPC: Schema, Codegen and StreamsIntermediate≈ 10 min
- GraphQL: Client-Shaped Queries Over One SchemaIntermediate≈ 5 min
- What GraphQL CostsIntermediate≈ 10 min
- Backend for FrontendIntermediate≈ 5 min
- Batch APIs and Partial FailureIntermediate≈ 10 min
Level 5 · Escape request/response when it stops fitting0 of 14 lessons done
- Long-Running Operations: 202 and the Job ResourceIntermediate≈ 15 min
- The Async Job PatternIntermediate≈ 10 min
- How the Client Learns the Job FinishedIntermediate≈ 10 min
- WebSocket Message ContractsIntermediate≈ 10 min
- Server-Sent EventsIntermediate≈ 10 min
- Streaming APIs: Partial Data as a ContractIntermediate≈ 10 min
- Slow Clients and BackpressureIntermediate≈ 10 min
- Webhooks: The Inverted ContractIntermediate≈ 10 min
- Webhook Delivery: States, Retries, RedriveIntermediate≈ 10 min
- Consumer-Side IdempotencyIntermediate≈ 10 min
- Webhook Ordering: Assume NoneIntermediate≈ 10 min
- The Webhook Security ContractIntermediate≈ 10 min
- Large Requests and Documented LimitsIntermediate≈ 10 min
- File Upload APIs: Authorize, Upload Directly, ConfirmIntermediate≈ 10 min
Level 6 · Evolve without breaking anyone0 of 6 lessons done
- Versioning: What a Version Even PromisesIntermediate≈ 10 min
- Backward Compatibility: The Real RulesIntermediate≈ 10 min
- Enum Evolution: The New Value That Broke Old ClientsIntermediate≈ 15 min
- Removing Fields Without Removing ConsumersIntermediate≈ 10 min
- Deprecation as a Process, Not a LabelIntermediate≈ 10 min
- Consumer-Driven Evolution: Telemetry Before BreakageIntermediate≈ 10 min
Level 7 · Make the contract secure, fast and observable0 of 13 lessons done
- Authentication in the ContractAdvanced≈ 10 min
- Authorization Design in the ContractAdvanced≈ 10 min
- Scopes: Least Privilege as Contract SurfaceAdvanced≈ 10 min
- API Keys: Identity for ApplicationsAdvanced≈ 10 min
- The Rate-Limit ContractAdvanced≈ 10 min
- Quotas vs Rate LimitsAdvanced≈ 10 min
- Caching as a Contract ClauseAdvanced≈ 10 min
- API Performance: The Levers You Actually OwnAdvanced≈ 10 min
- Payload Size: 20KB, 200KB, 5MBAdvanced≈ 10 min
- Compression: Cheaper Bytes, Not FewerAdvanced≈ 10 min
- Request IDs: The Contract's Correlation ClauseAdvanced≈ 10 min
- API Metrics: Rate, Errors, Duration, SizesAdvanced≈ 10 min
- API Logging Without LeakingAdvanced≈ 10 min
Level 8 · Run an API as a product0 of 5 lessons done
Level 9 · Migrate, compose and govern at scale0 of 3 lessons done
What are you designing?
Which consumers will you never meet, and what must the contract promise them without a conversation?
The learning loop
Every lesson and lab returns to the same chain. An endpoint is not designed until you can answer every step for it.
Flagship experiences
Learn → model → design → compare → simulate → break → review → evolve → practice → interview.
An API as shipped. Find the problems, run the design linter, compare redesigns — several are valid.
Duplicate requests, old clients, unknown enums, huge payloads, dead dependencies. Toggle contract protections and rerun.
Six product requirements arrive one by one. Evolve the contract without breaking the clients that shipped yesterday.
Payments, uploads, messaging, search, analytics, agent runs — full contracts with their decision logs.
Learning modules
An API is a behavioral contract, not a list of endpoints. Requirements before endpoints, consumer tasks before resources, granularity, ownership — and why internal APIs still need contracts.
From domain to resources, from resources to operations. Resource vs action, state machines with explicit transitions, backend-for-frontend, and composition — without REST dogma.
Methods as promises: safety, idempotency, and what retries, proxies and caches are allowed to assume. Status codes that mean something, conditional requests, and caching as part of the contract.
REST, RPC, gRPC and GraphQL as tools with prices, not religions. What each buys, what each costs operationally, and how consumer environment decides — never “which one is best”.
Required vs optional vs null, response models that are not database rows, over- and under-fetching, batch endpoints, size limits, and file uploads that bypass the API for the bytes.
A stable error contract: machine-readable codes, a taxonomy clients can branch on, field-level validation feedback, explicit retryability, and honest partial-failure semantics.
Every list endpoint is a query API. Offset vs cursor under concurrent writes, stable ordering, filter allowlists, search as a different contract — and the index each promise requires.
The network loses responses, so clients retry. Idempotency keys, dedup vs idempotency, optimistic concurrency with versions, lost-update prevention, and consistency the contract admits to.
When request/response stops fitting: WebSocket message contracts, SSE, streaming, the async job pattern for long-running work, and how completion actually reaches the client.
Your contract running against someone else’s server: delivery states, retries, duplicate events, ordering you must not assume, and the signature that makes any of it trustworthy.
Where authentication and authorization live in the contract: token placement, resource-level permission design, scopes, API keys, rate limits and quotas as documented behavior.
The longest-lived part of the contract. Additive change, enum evolution, deprecation as a process, consumer telemetry before removal, schema-first vs code-first, docs and SDKs.
The API-shaped levers: payload size, compression, request count, caching. Request IDs, metrics without high-cardinality labels, logs that never contain tokens, and contract tests.
Not a REST tutorial
Engineer Atlas never teaches "REST endpoints should use nouns" as a rule. It teaches what contract the client actually needs, which guarantees the API should provide, and how that contract can evolve without breaking consumers — then lets you break your own design to see whether the guarantees hold.