What is API versioning? API versioning is the practice of managing changes to an application programming interface by publishing distinct versions, so existing consumers keep working while new features, fixes and breaking changes are introduced for those who are ready. Without versioning, a renamed field or a changed response can silently break partner integrations, mobile apps and internal services. Good versioning combines a clear strategy, such as URL path, header or media type versions, with semantic rules about what counts as a breaking change, a deprecation policy and communication with consumers. This guide explains the main versioning approaches, how to decide what is breaking, how to deprecate safely and how to govern versions across an API estate.
Short answer: API versioning lets you evolve an API without breaking clients. Pick a consistent approach, keep changes backwards compatible where possible, publish versions and deprecation timelines and retire old versions deliberately.
What is API versioning?
Versioning is a core discipline of API management and applies to REST, GraphQL and event interfaces. It protects API consumers, supports microservices that release independently and underpins long term system integration. The semantic versioning specification offers a useful vocabulary of major, minor and patch changes.
Breaking and non breaking changes

| Change | Breaking? | Notes |
|---|---|---|
| Add an optional field to a response | Usually no | Clients should ignore unknown fields |
| Add a new endpoint | No | Safe if it does not change existing behaviour |
| Add an optional request parameter | No | Default must preserve old behaviour |
| Remove or rename a field or endpoint | Yes | Needs a new version |
| Change a field type or meaning | Yes | Even subtle changes break clients |
| Make an optional parameter required | Yes | Existing calls start failing |
| Change error formats or status codes | Often yes | Clients depend on them |
| Tighten validation or limits | Possibly | Test with real consumer traffic |
Versioning strategies
| Strategy | Example | Pros | Cons |
|---|---|---|---|
| URL path | /v2/orders | Simple, visible, cache friendly | Version spreads across URLs |
| Query parameter | /orders?version=2 | Easy to add | Easy to omit, cache issues |
| Custom header | X-API-Version: 2 | Clean URLs | Less visible, harder to test in a browser |
| Media type (content negotiation) | Accept: application/vnd.company.v2+json | Precise, RESTful | More complex for clients |
| Date based versions | 2026-11-01 header | Fine grained evolution | Needs tooling to manage many dates |
| No explicit version (additive only) | Evolve compatibly | Least overhead | Needs strict discipline and consumer tolerance |
Most teams choose URL path versioning for external APIs because it is easy to understand, route and document. Whatever you choose, apply it consistently across all APIs, so consumers and gateways can handle versions in the same way.
Principles for evolving APIs safely
- Prefer additive, backwards compatible changes and avoid new major versions unless necessary.
- Tell consumers to ignore unknown fields, following the robustness principle.
- Never change the meaning of existing fields, add new ones instead.
- Use specifications such as OpenAPI and automated contract tests to detect breaking changes.
- Version the contract, not each deployment, and keep patch fixes invisible.
- Keep the number of supported versions small, ideally two or three.
How to run a version lifecycle
- Define the policy. Set rules for breaking changes, version naming, support length and notice periods.
- Publish clear documentation. Show a changelog, migration guide and status for each version.
- Run versions side by side. Route by version at the gateway and share backend logic where possible.
- Announce deprecation early. Use headers, portal notices and direct contact, with a firm sunset date.
- Measure usage. Track calls by version and consumer to see who has not migrated.
- Help consumers migrate. Offer testing sandboxes, examples and support windows.
- Retire on schedule. Return clear errors after sunset and remove code and infrastructure.
Versioning for GraphQL, events and SDKs
| Interface | Approach |
|---|---|
| GraphQL | Evolve the schema additively and deprecate fields with notices instead of versioning the endpoint. Compare with GraphQL versus REST |
| Event and message schemas | Use schema registries and compatibility rules so producers and consumers can change independently |
| Webhooks | Version payloads and let subscribers choose a version. See what is a webhook |
| SDKs and clients | Follow semantic versioning and pin supported API versions |
Our API development service designs evolvable APIs with contract testing and a clear version policy, and our system integration service manages migrations for partners and internal teams.
A worked example: moving partners from v1 to v2
A payments company needs to change its transaction API, replacing a single amount field with an amount and currency object. Instead of editing v1, the team publishes v2 at a new path and runs both behind the gateway, with v1 adapting to the same service layer. Contract tests verify that v1 responses remain identical.
The developer portal publishes a migration guide and a sandbox, and v1 responses include a deprecation header with the sunset date nine months ahead. Analytics show forty partners on v1 at the start and five by month eight, and the account team contacts the remaining few directly. On the sunset date v1 returns a clear error with a link to the guide, and the old code is deleted.
Governance and communication
Versioning is as much about communication as technology. Assign an owner to each API, keep a public status page for versions and publish a roadmap so consumers can plan. Send notices through several channels, track acknowledgement for critical partners and make deprecation dates contractual where the relationship requires it. A predictable, honest process builds trust, and trust is what lets you improve APIs without fear of breaking the businesses that rely on them.
Testing compatibility
Automate compatibility checks so humans do not have to remember every rule. Compare OpenAPI specifications between builds and fail the pipeline on breaking differences. Use consumer driven contract tests, in which each consumer publishes the expectations it relies on, to learn about hidden dependencies before release. Replay a sample of real traffic against the new version in a staging environment, and use canary releases to confirm that error rates stay flat before routing all consumers.
Common versioning mistakes
- Creating a new major version for every change, which multiplies maintenance work.
- Changing behaviour inside an existing version without telling consumers.
- Supporting too many versions at once, so fixes and security patches slow down.
- Having no sunset date, so old versions live on indefinitely.
- Versioning the URL but not the data models, which causes hidden incompatibilities.
- Ignoring internal consumers, who often depend on APIs in surprising ways.
Avoid these by agreeing a short written policy, publishing it with every API and enforcing it through reviews and pipeline checks. A small amount of discipline up front saves considerable support effort later and keeps both your engineers and your integration partners productive.
Cost and effort of supporting multiple versions
Every supported version has a cost: tests, documentation, security patching, monitoring and support questions. Share code between versions through an internal domain model and thin adapters, so differences live at the edge, not in every layer. Track the number of active versions and consumers on each and review the cost when you plan releases. If a version has very few users, contact them directly and retire it early, rather than carrying it for years.
Key takeaways
- API versioning lets APIs evolve without breaking existing consumers.
- Prefer additive changes and reserve new versions for genuine breaking changes.
- URL path versioning is the most common choice, but consistency matters more than the method.
- Run versions side by side, publish deprecation timelines and measure migration.
- Use specifications and contract tests to detect breaking changes automatically.
Quick glossary
| Term | Meaning |
|---|---|
| Breaking change | A change that makes existing clients fail or behave incorrectly |
| Deprecation | Announcing that a version will be retired |
| Sunset date | The date a version stops working |
| Contract test | A test that verifies an API meets consumer expectations |
| Semantic versioning | Major, minor and patch version rules |
Read next: What Is API Management? Lifecycle, Features, Tools · What Is a Message Queue? Patterns and Best Practices · What Is RabbitMQ? Exchanges, Queues and Use Cases
Frequently asked questions
What is API versioning in simple terms?
It is giving each significant form of an API a version, so old clients keep working while new ones use updated features.
What is the best API versioning strategy?
URL path versioning is the most common and easiest to understand, while headers or media types suit teams that want clean URLs. Consistency matters most.
What counts as a breaking change?
Removing or renaming fields or endpoints, changing types or meanings, making optional inputs required or altering error behaviour that clients rely on.
How long should I support an old API version?
It depends on consumers and contracts. Six to eighteen months of notice is common for external APIs, shorter for internal ones.
Do I need a new version for every change?
No. Additive, backwards compatible changes can be released within the current version. New major versions are for breaking changes.
How do I deprecate an API version?
Announce early, add deprecation headers and documentation, track usage, help consumers migrate and retire on a published date.
How is GraphQL versioned?
Usually by evolving the schema additively and marking fields as deprecated, rather than creating separate versioned endpoints.
How can I detect breaking changes automatically?
Compare API specifications in your pipeline, run consumer driven contract tests and monitor errors by version during rollout.
