What Is API Versioning? Releasing Breaking Changes Safely
API versioning is the policy for distinguishing and releasing changes so an API can evolve while keeping its contract with existing clients. Compatible changes, such as adding a response field, may fit within an existing version; changes that can break consumers, such as removing a field or changing its meaning, need a new version and a migration plan. There is no universally correct choice between path versioning (`/v2`) and header or query versioning, so choose based on consumers and operations, then plan how support will end.
API versioning is the policy for distinguishing and releasing changes so an API can evolve while keeping its contract with existing clients. Compatible changes, such as adding a response field, may fit within an existing version; changes that can break consumers, such as removing a field or changing its meaning, need a new version and a migration plan. There is no universally correct choice between path versioning (/v2) and header or query versioning, so choose based on consumers and operations, then plan how support will end.
Which changes need a version boundary?
An API is a contract between a server and its clients, so changing a database schema or internal implementation does not by itself require a new API version. Removing a response field that existing consumers expect, adding a required request field, or changing a field's type or meaning can break compatibility. Adding a response field may be compatible when consumers are designed to ignore fields they do not know, but the server must still handle older clients that do not send a new request field. Actual compatibility depends on client behavior and code-generation tools, so check it with contract tests. (Microsoft API design guidance)
Where should a client select the version: path, header, or query?
A path version is visible in the called URL and makes routing and documentation straightforward. For example, /v1/orders and /v2/orders can be served by one service or routed to separate implementations. The version becomes part of the resource address, and version-specific paths and documents can multiply. Google API guidance places major versions in REST paths for Google APIs; that is Google's policy, not a requirement for every service. (Google AIP-185)
A header or query parameter can select the response contract while keeping the resource path stable, but check that proxies, caches, logs, and API discovery tools preserve and process the selector. Google's interface-based versioning guidance gives an example of carrying a version in a request header or query parameter. Whichever method you use, a request needs one unambiguous version. Document whether a missing selector chooses a default implicitly or returns an error. (Google AIP-185)
| Decision factor | Path version | Header or query version |
|---|---|---|
| Easy for callers to see | The version appears in the URL | Callers must inspect a separate request field |
| Routing | Path rules can separate versions directly | Gateways and caches must account for the version value |
| Documentation and testing | Version-specific endpoints are clear | One path may require managing multiple contract combinations |
| Consider it when | A simple consumer contract and explicit coexistence matter | A stable URI matters and infrastructure reliably handles the header or query value |
This table summarizes design trade-offs; it does not report measured performance. For a parameter-based selector, also verify HTTP cache keys, CDN settings, observability tools, and client SDK behavior.
How should you handle compatible and breaking changes?
Keep changes to the public contract as limited as possible, and consider adding features while preserving the existing structure. Instead of removing or changing the meaning of a response field, adding a new field and serving both for a transition period may help consumers migrate. By contrast, adding a required input, changing an existing field's type, or changing status-code or side-effect semantics can break existing clients; consider a new API version. Merely changing a version string does not make a release safe. The new version's behavior, validation, documentation, SDKs, and operational deployment must actually be ready.
Serving two versions increases development, testing, and operational costs. API owners should publish supported versions, migration paths, the scope of security fixes, end-of-support criteria, and dates, and give consumers time to move. For an internal API, coordinate the migration with consumer teams. For a public API, you may not know every external user, so observe usage, errors, and calls to old versions while managing the retirement schedule. Microsoft guidance also recommends retaining the previous version and letting consumers select which one to call, but the actual support policy should fit the product's commitments and applicable requirements. (Microsoft API design guidance)
Is OAS info.version the API version?
The top-level openapi field identifies the OpenAPI Specification version followed by the document. info.version is the version of the OpenAPI document itself, separate from the API implementation version and the OAS version. The API's request-version selector belongs in the API contract. For example, an OpenAPI file describing /v2/orders may have openapi: 3.2.1 and info.version: '2026-11-18', but these values do not replace the API's v2 path. (OAS OpenAPI Object, OAS Info Object)
Release checklist
Compare request and response contracts before and after the change. Classify removals, type changes, and meaning changes that could break current consumers.
If a new version is needed, define where callers select it, what happens when it is omitted, which errors are returned, how long versions coexist, and how support ends.
Update the OpenAPI document and examples, then validate them with the supported version and tools. Do not confuse the document's `info.version` with the API version selected by a request.
Run contract checks and representative consumer integration checks for both old and new versions. Also check the gateway, caches, authentication, and monitoring path.
Deploy the new version and observe real calls and errors. Notify consumers of the migration path and end-of-support schedule for the old version.
Before retiring the old version, check its final usage and verify rollback steps and post-retirement error messages.
Passing tests means the checked contracts and cases passed; it does not guarantee compatibility for every undiscovered consumer. Remove an old version only after reviewing usage, the contract, and operational readiness.