API Fundamentals

API Versioning

Versioning lets an API evolve without breaking the integrations already built against it.

What you'll learn

  • Explain why APIs need versioning
  • Tell breaking changes from additive ones
  • Recognise the main versioning strategies
  • Pin to a version deliberately in requests
  • Plan a calm path through version upgrades

6 min

Why versioning exists

An API is a public contract, and a great many integrations depend on it behaving consistently from one day to the next. Yet the service behind that contract must keep improving — adding new fields, renaming awkward concepts, tightening loose validation. Versioning is how a provider reconciles those two pressures, evolving the API while still giving existing callers a stable target to keep building against.

Without versioning, any change risks breaking someone's production system overnight, with no warning and no recourse. With it, a provider can ship a new version while the old one keeps working unchanged, and you upgrade when you are genuinely ready rather than at the moment the provider happens to deploy. That shift of timing from them to you is the whole value of the mechanism.

Breaking versus additive

Not every change needs a new version, and treating them all as equal would make versioning impossibly heavy. Additive changes — a new optional field, a brand-new endpoint, an extra enum value — generally do not break well-written clients, which is exactly why you should ignore fields you do not recognise rather than failing the moment one appears.

Breaking changes are a different matter. Removing a field, renaming one, changing its type, or making validation stricter can all break callers who relied on the old shape. These are the changes a responsible provider gates behind a new version, so your code keeps seeing the previous behaviour until you deliberately opt in. Knowing which category a change falls into tells you immediately whether you can ignore it or must plan for it.

Where the version lives

Providers express the version in a few common ways, and it helps to recognise each. A URL path version puts it directly in the address, such as /v1/cases. A header version sends it as a dedicated request header. A date version pins behaviour to the API as it stood on a particular calendar day.

GET /v1/cases HTTP/1.1
Accept: application/json

Each style carries its own trade-offs, but from your side the task is identical regardless of which one the provider chose: state the version explicitly, so you are never silently migrated onto a newer one without noticing. Relying on an unversioned default leaves you exposed to changes you did not choose and cannot predict, which is the very situation versioning exists to prevent.

Upgrading safely

When a new version arrives, read the changelog and migration notes carefully to see exactly what changed and why. Then update and test in a non-production environment, comparing the new responses against the old field by field, before you ever switch live traffic across. A staged upgrade catches surprises while they are cheap.

Build defensively in the meantime so that additive change cannot hurt you: tolerate unknown fields, avoid hard-coding the full list of enum values, and centralise the version string in one place so changing it later is a single one-line edit rather than a hunt across your whole codebase. Small habits like these turn version upgrades from a source of dread into routine, low-risk maintenance work.

Staying current

Versioning is fundamentally a two-way courtesy between provider and consumer. The provider promises stability within a given version; you promise, in return, to keep an eye on deprecations and to migrate before old versions are eventually retired. Watching the changelog turns those upgrades into planned, scheduled work instead of unexpected fire drills triggered by something breaking in production without warning. A few minutes of reading every release saves hours of emergency firefighting later on.

For how providers actually announce and retire versions — the response headers and published timelines that warn you in advance — read API deprecation and changelogs, which covers the signals to watch for and exactly how to act on them well before a sunset deadline arrives.

Key takeaways

  • Versioning lets the API evolve without breaking existing callers
  • Additive changes are usually safe; breaking changes need a new version
  • Versions may live in the URL path, a header, or a date
  • Always pin a version explicitly rather than trusting a default
  • Read the changelog and test before upgrading production

FAQ

Should I always use the newest version?

Use a version you have tested. Newer is not automatically better for you — upgrade deliberately after reviewing the changelog and validating responses.

Is adding a field a breaking change?

Not for a well-written client. If you ignore unknown fields, new optional ones cannot break you. Removing or renaming fields is what breaks callers.

What happens when an old version retires?

Calls to it eventually stop working, so migrate before the announced retirement date. Providers publish deprecation timelines for exactly this reason.

Integrate with Merion

Ready to build?

Read the API reference, grab the OpenAPI spec, and ship a resilient integration.