Free through lesson 3

API Design for Beginners

We start with what an API actually promises, then move on to choosing URLs and status codes, unifying how errors look, idempotency and retries, rate limiting, OpenAPI, GraphQL, and finally cutting versions and retiring old ones. Across 30 lessons you'll build "a yardstick for design that still works when the framework changes." Every request and response shown here comes from a real server written with nothing but the Node.js 26.9 standard library, captured with curl.

about 1.5 hours in total (estimate)

Slides for this course (for classes and in-house training) →

Curriculum

The 30 lessons are split into 6 chapters. We recommend going in order from chapter 1, but feel free to dip into whatever interests you. Note: lessons that start a server can't run in the browser, so try them with Node.js and curl on your own machine. Short snippets that only check a design decision run right in the browser.

Chapter 1 — What Does an API Promise? (lessons 1–5)

We draw a line between your internal implementation and the promises you make to the outside world. We reread HTTP as a design tool, and finish by checking method safety and idempotency with curl on your own machine.

Chapter 2 — Designing Resources (lessons 6–12)

We decide how to shape URLs, how to choose status codes, and how to return lists. We finish by comparing paging, filtering, and sorting through the responses of a real, running server.

6

A URL Names a Resource: Keep Verbs Out

Replace the urge to put verbs in URLs with nouns, step by step. We also measure accidents where one thing gets several names: trailing slashes, capitals, zero padding.

about 2 min 🔒 Basic
7

Collections, Single Resources, and Where to Stop Nesting

Build a design from just two kinds: lists and single items. Nest only for ownership and stop at two levels, explained by how fast the URLs multiply.

about 2 min 🔒 Basic
8

Expressing Operations That Don't Fit CRUD

Express "verbs" like archive, send, and approve in three ways: a state update, an event as a resource, or async acceptance. We build all three and compare responses.

about 2 min 🔒 Basic
9

Choosing a 2xx: 200, 201, 202, 204

Success comes in four flavors. Tell apart Location on create, 202 for work that won't finish right away, and 204 with no body, using real response headers.

about 2 min 🔒 Basic
10

Choosing 4xx and 5xx

Sort 400, 401, 403, 404, 405, 409, 415, 422, and 429 by who needs to fix what. Mix them up and you break retry decisions and security.

about 2 min 🔒 Basic
11

Paging: Offsets and Cursors

What happens with offset paging when data is added between pages? Compare it with cursors on the same data, and decide how to return a Link header and next.

about 5 min 🔒 Basic
12

Filtering, Sorting, and Trimming Fields

Try out query parameter choices on a working list API: trimming fields with fields, and where to stop before you add too many filters.

about 6 min 🔒 Basic

Chapter 3 — Errors and Reliability (lessons 13–18)

We give errors a single shape and build in design that assumes failure: retries, idempotency, rate limits, and deadlines. We finish by setting a deadline on an entire call.

Chapter 4 — Writing the Spec (lessons 19–23)

We turn the design in your head into OpenAPI, then generate types, mocks, and tests from it. We finish by letting CI catch drift between the spec and the implementation.

Chapter 5 — GraphQL: A Different Answer (lessons 24–27)

We run schemas, resolvers, N+1, and error responses for real and compare them side by side with REST. You'll come away with what you need to decide which one to choose.

Chapter 6 — Growing It, Then Retiring It (lessons 28–30)

We decide how to cut versions and plan the steps to retire an old one. We finish by generating docs and the changelog automatically from the spec, so nothing is copied by hand.

Once you've finished all 30 lessons, head to FastAPI for Beginners to actually build the APIs you've learned to design. A membership unlocks every course.