Skip to content
Web Development4 min read

API Versioning and Backward Compatibility: A Practical Engineering Guide

How to version APIs: breaking vs non-breaking changes, URL, header and date-based versions, Deprecation and Sunset headers, and compatibility testing.

01

How should you version an API?

Prefer additive, backward-compatible changes; introduce a new version only for unavoidable breaking changes; choose one versioning approach (URL path, header or date-based) and use it consistently; announce deprecations with dates, migration guides and the Deprecation and Sunset response headers; track usage of old versions; and test compatibility automatically. The goal is to change the API without breaking the people who depend on it.

This guide is for API owners and engineers. For documentation, see API documentation best practices; for partner ecosystems, SaaS integration marketplaces.

02

Key takeaways

  • Know what counts as breaking.
  • Make additive changes the default.
  • Pick one versioning scheme and document it.
  • Deprecate with dates, headers and direct contact.
  • Keep old versions working until the sunset date.
  • Run contract tests for every supported version.
03

Breaking vs non-breaking changes

Usually non-breakingUsually breaking
Adding an optional request fieldMaking a field required
Adding a response fieldRemoving or renaming a field
Adding an endpointRemoving an endpoint
Adding an enum value (if clients tolerate it)Changing a field's type or format
Relaxing validationTightening validation
New optional query parameterChanging default sorting, paging or error codes
04

Versioning approaches

ApproachExampleNotes
URL path/v1/orders, /v2/ordersSimple to route and understand
Header or media typeAccept: application/vnd.example.v2+jsonStable URLs; less visible
Date-basedA version header pinned to a dateFine-grained; used by Stripe
No explicit versionsAdditive changes onlyRequires discipline; still need a plan for breaks
05

Deprecation and sunset

Publish a deprecation policy with minimum support periods. When deprecating, announce it in the changelog and by email to known clients, add migration guides, and return the Deprecation header (RFC 9745) and, when a removal date is set, the Sunset header (RFC 8594) on affected responses. Monitor which clients still call old versions and contact them before removal. Google's API design guidance is another useful reference.

06

Mobile apps and long-lived clients

Mobile apps on users' devices cannot all be updated at once. Keep APIs compatible with app versions still in use, track app versions in requests, use minimum supported version checks with friendly upgrade prompts, and plan backend changes around store release cycles. See mobile app API integration.

07

Testing compatibility

  • Compare OpenAPI descriptions between releases and flag breaking changes in CI.
  • Run consumer-driven contract tests for key clients.
  • Keep regression tests for each supported version.
  • Monitor error rates by client and version after releases.
08

Hypothetical example: a logistics API

This example is hypothetical. A logistics platform needed to split an address field into structured parts. It added the new fields alongside the old one, documented the change, and released v2 only for clients that wanted the old field removed. v1 responses carried a Deprecation header and, six months later, a Sunset header with a date. The team tracked v1 usage by client and contacted the remaining integrators before switching it off.

09

12 versioning decisions to make before external integrations grow

Versioning is cheap to decide early and expensive to retrofit once partners, mobile apps and customers depend on your API. Make these decisions explicitly and publish them, so integrators know what to expect.

DecisionOptionsWhy it matters
1. What counts as breakingRemoved or renamed fields, new required inputs, changed meanings or errorsIntegrators need a clear promise
2. Where the version livesURL path, header, or date-based version per accountAffects routing, caching and documentation
3. Versioning granularityWhole API or per resourcePer-resource versions are harder to explain
4. Default version for new clientsLatest, or pinned at sign-upPinning protects existing clients from surprises
5. How many versions you support at onceFor example the current and previous versionEach version is code and tests to maintain
6. Deprecation notice periodA published minimum periodPartners need time to plan work
7. How you announce changesChangelog, email, response headersSilent changes break trust
8. Sunset behaviourError responses, redirects or brownouts before removalGives late adopters a clear signal
9. Additive-change rulesClients must ignore unknown fieldsLets you add fields without a new version
10. Webhook and event versioningVersion payloads separately or with the APIEvents often outlive request APIs
11. Mobile app compatibilityMinimum supported app versions; forced updatesOld app versions stay installed for years
12. Testing across versionsContract tests per supported versionCatches accidental breaking changes
10

Common mistakes

  • Breaking changes shipped without a new version.
  • Several versioning schemes in one API.
  • Removing versions without warning or usage data.
  • Forgetting older mobile app versions.
  • No automated check for breaking changes.
11
12

Conclusion

API versioning is mostly about avoiding breaks: change additively, version when you must, deprecate transparently with dates and headers, and test compatibility automatically. Clients trust APIs that change predictably.

Evolving an API others depend on?

ZSpace Labs is an India-based, remote-first technology studio working with Australian and international businesses on APIs and integrations and mobile apps that consume them. If it would help to plan a versioning strategy, we are happy to talk it through.

Start a Project
FAQ

Common questions.

Anything that can make existing clients fail: removing or renaming fields or endpoints, changing types or formats, making optional inputs required, changing error codes or behaviour, tightening validation, or changing authentication. Adding optional fields or new endpoints is usually non-breaking, provided clients ignore unknown fields.

Both work. URL versions (such as /v1/) are visible and easy to route and cache. Header or media-type versions keep URLs stable. Date-based versions, used by Stripe, pin each client to the API behaviour at a date. Choose one approach and apply it consistently.

Announce it with a timeline, document migration steps, signal deprecation in responses (the Deprecation header in RFC 9745 and the Sunset header in RFC 8594), track who still uses it, contact those clients directly, and only remove it after the sunset date.

Long enough for clients to migrate, which depends on who they are. Internal clients may move in weeks; partners and mobile apps on users' devices often need many months. Publish the policy and keep to it.

Some teams evolve APIs only through additive, backward-compatible changes and rarely introduce new versions. It requires discipline, tolerant clients and good testing. Breaking changes will still occasionally be needed, so have a versioning policy ready.

Get in touch

Have a project in mind?

Whether you're building a new digital product, improving an existing website, or looking to automate part of your business — let's talk.