█
LastWrite
  • > Curriculum
  • > Pricing
  • > For Educators
  • > About
  • > Contact
Log InGet Started

Questions, concerns, bug reports, or suggestions? We read every message, write to us at [email protected].

More ways to reach us →
LastWrite

Structured computer science lessons for aspiring developers and security professionals.

[email protected]

(201) 785-7951

Mon–Fri, 9 AM–5 PM EST

Learn

  • Curriculum
  • Pricing

Company

  • About
  • For Educators & Schools
  • Contact Us

Legal

  • Terms of Service
  • Privacy Policy
© 2026 LastWrite. All rights reserved.
Curriculum/Programming Languages/REST APIs/Versioning and Backwards Compatibility
40 minIntermediate

Versioning and Backwards Compatibility

After this lesson, you will be able to: Evolve an API without breaking existing clients: additive changes, deprecation strategy, version sunsets.

Real APIs ship for years. Breaking changes lose customers. This lesson is how to make APIs evolve safely.

Prerequisites:Documentation

What's a breaking change

Renaming or removing a field. Changing a field's type (string → number). Adding a required parameter. Changing default behavior of an endpoint. Removing an endpoint. Tightening validation that previously accepted some inputs.

What's NOT breaking (additive)

Adding a new optional field to a response. Adding a new endpoint. Adding a new optional query/body parameter (with a default). Loosening validation. These don't need a version bump. Clients that don't care just ignore them.

Deprecation pattern

Standard headers + docs warning.

tsx
// On the response of a deprecated endpoint:
Deprecation: true // RFC 9745
Sunset: Wed, 31 Dec 2026 23:59:59 GMT // RFC 8594
Link: <https://api.example.com/docs/v2>; rel="successor-version"
Warning: 299 - "This endpoint is deprecated; use /v2/users"
// In your docs: mark deprecated endpoints + give migration steps.
// In your changelog: announce deprecation 6-12 months before sunset.

💡 Version your contract, not your code

Version is a CONTRACT signal to clients, not a label for internal code state. Bump v1 → v2 only when clients must change to keep working. Internal refactors, performance fixes, additive changes, same version. Many APIs live their entire lives on /v1. That's a sign of good design.

Strategies for big breaking changes

Parallel versions: run /v1 + /v2 simultaneously for 6-12 months. Clients migrate when they can. Feature flags: gate the new behavior behind a header (X-API-Beta: my-feature) for early adopters. GraphQL-style additive evolution: never break, only add. Older clients keep working forever, but you accumulate cruft. Big-bang migration: only if you control all clients (internal API).

Common mistakes

Treating ALL renames as 'just a doc update' (it's a breaking change). No deprecation notice (clients break on a Tuesday). Bumping v1 → v2 for an additive change (forces clients to migrate for no reason). Killing v1 without telling anyone (= losing customers).

Sign in and purchase access to unlock this lesson.

Sign in to purchase
←Documentation: OpenAPI and Scalar
Back to REST APIs
Rate Limiting→