stackbook.io
🔍
← Back to Syllabus
Day 5Level 2 — API Craft

Versioning and Deprecation

Learn: 30 minMap: 20 minDesign: 45 min

Core Concepts (5)

  • 1.Additive changes are safe, removals and meaning changes are not
  • 2.Consumers upgrade on their schedule, not yours
  • 3.Versions can live in the path, a header, or a date
  • 4.Deprecation needs notice, telemetry, and a firm date
  • 5.Every live version multiplies testing and support cost

Map to Your Experience

Think of a time a dependency changed under you. How did you find out, and how long did the fix take?

Design Brief: Plan an API v2 Transition

Learn

An API is a contract with people you may never meet, and their code keeps running whether or not you change yours. Evolution is therefore the central challenge of API design, and the first skill is classifying a change. Adding an optional field, a new endpoint, or a new enum value that clients can ignore is usually compatible. Removing a field, renaming it, tightening validation, or changing the meaning of a value is breaking.

Good habits reduce the need for versions at all. Tell clients to ignore unknown fields. Never reuse a field name with new meaning. Prefer adding over changing. Mark fields as experimental before they are stable. These rules let an API grow for years on a single version.

When a break is unavoidable, choose a scheme. A version in the path is visible and easy to route. A version in a header keeps URLs clean but hides the choice. A date-based version pins each consumer to the behaviour they first integrated with. None is perfect, so pick one and apply it everywhere.

Deprecation is a process, not an announcement. Publish the plan, add a deprecation signal to responses, and measure who still calls the old behaviour. Contact the largest remaining consumers directly. Set a retirement date and keep it, perhaps with a brief brownout period where the old version fails for a short time to flush out forgotten callers.

Remember the cost side. Each live version needs tests, documentation, monitoring, and expertise. A small team supporting four versions will move slowly and make mistakes. Decide up front how many versions you will run at once, and write that policy where consumers can read it.

Map

Write down five possible changes to an API you know, such as renaming a field or adding an enum value. Mark each as compatible or breaking and say why. Pick the one that surprises you most.

Design

Draft the v2 transition plan for the orders API: the list of breaking changes, the versioning scheme and reasoning, and a dated timeline from announcement to retirement. Include how you will measure remaining usage of v1. Keep your answer concrete: name real numbers, owners, and examples wherever you can, and note any assumption you had to make so a reviewer can challenge it.

Requirements

  • •Classify the changes as breaking or compatible
  • •Choose a versioning scheme
  • •Lay out a deprecation timeline with milestones

Constraints

  • •Hundreds of external consumers
  • •Support team of three

Must Cover

compatibilityversioning-schemedeprecation-timeline

Trade-off Axis

consumer stability vs team velocity

Competencies Advanced

economics evolution → L2distribution communication → L3

Ready to Design?

Open this day in the Design Studio. The studio follows this track: its days, concepts, patterns and trade-offs are loaded, and you keep one design across the whole track.

Open in Studio →