API Versioning & Backwards Compatibility

Difficulty
Importance

The problem

An API's shape inevitably needs to change over time, but existing clients — sometimes ones you don't control and can't force to update — depend on its current shape staying stable, so a change that breaks them silently is a real production incident, not a harmless refactor.

Why now

REST API design established a stable, learnable contract as the whole point of good API design; versioning and backwards compatibility are what protect that contract's stability over time, once real clients depend on it and the design inevitably needs to evolve anyway.

Mental model

An API is a promise to existing callers, not just a description of current behavior — a breaking change is any change that would make a correct, unmodified existing client start failing. Versioning is how you keep an old promise (v1) alive unchanged while making and eventually promoting a new one (v2), rather than breaking the old promise out from under whoever's still relying on it.

Requires

Used in

Projects

  • Take an existing API and make a genuinely breaking change (renaming a field) two ways — as a hard break, and properly versioned (/v2/) alongside the still-working /v1/ — and compare the impact on existing clients
  • Write a deprecation plan for an API endpoint, including a timeline and how clients would be notified

Examples

  • Renaming a JSON field from user_name to username breaks every client parsing the old field, unless done behind a new API version
  • Adding a new optional field to a response is backwards compatible; removing or renaming an existing field never is

Resources

Mastery checklist