Evolving an API Without Breaking Your Consumers
· Architecture · Microservices · APIs · Contracts
By Alain Cyr, Founder, Koesion

Friday, 16:40. The Policy team ships a tidy-up: insuredName becomes policyholder.name, as the domain experts have been asking for months. It was announced in the channel on Tuesday.
By 17:10 the mobile app shows a blank where the customer’s name should be, and Claims is logging null pointer exceptions at a rate of two hundred a minute. Policy rolls back. On Monday there is a meeting about “communication”.
Communication was not the problem. The Policy team had no way of knowing who read that field, and a message in a channel is not a way of knowing.
All the independence promised by microservices rests on one ability: deploying a provider without deploying its consumers. Here is how to keep it.
What breaks and what does not
The left column needs no coordination at all, provided the consumers hold up their end.
The rule on the provider’s side is to add and never take away. New fields, new endpoints and new optional parameters are fine. Removing, renaming, retyping and redefining are not.
The consumer has a matching duty, known as the tolerant reader: ignore what you do not recognise. A consumer that validates responses against a strict schema, and fails on an unknown field, turns every addition into a breaking change. If you generate clients from an OpenAPI file, check what yours does. Some generators are strict by default.
Enums deserve a special mention because they fool everyone. Adding SUSPENDED to the policy statuses feels like an addition. For a consumer with a switch whose default branch throws, it is an outage. Document enums as open from the first day, and have consumers map unknown values to something they can display.
When you really have to break it
Sometimes the old shape is wrong and has to go. Then make the change in three releases instead of one.
Slower than a rename, and nobody has to be on a call on Friday evening.
Expand. Add the new field next to the old one and fill both. Nobody notices.
Migrate. Consumers move to the new field, each in its own release and at its own pace.
Contract. Remove the old field once nobody reads it.
The first two steps are easy. The third hangs on a question most teams cannot answer: who still reads the old field?
Knowing who reads what
You can guess, ask around, or grep other teams’ repositories. Or you can have the consumers tell you, in a form a pipeline can check.
That is a consumer-driven contract. Each consumer writes down what it actually uses from your API, which endpoints and which fields, as an executable test. You run every consumer’s contract against your build before you deploy.
The contract lists three fields. Policy returns forty. The other thirty-seven are free to change, as far as Claims is concerned.
Two things change once this is in place. “Can I remove insuredName?” stops being a question for a meeting and becomes a build result. And you find out how little of your API is in use, which is usually a pleasant surprise for the people who maintain it.
Pact is the usual tool. The tool matters less than the habit. A consumer that does not publish a contract is choosing to learn about your changes in production.
About /v2
A version in the URL looks like the grown-up answer. Treat it as a last resort.
A second version is a second API. You will fix bugs in both, secure both and keep both alive for as long as one consumer remains on the old one. The usual outcome is that v1 runs for years because the team that owns its last consumer has other priorities.
If you do need one, because the resource is being reshaped beyond what expand and contract can absorb, then do three things. Serve both versions from the same underlying model. Announce an end date and put it in the responses, with the Deprecation and Sunset headers. And graph v1 traffic per consumer, so you know exactly whom to call.
Five of the six never need a version number.
Events are harder
Everything above applies to events, with two aggravating factors. You often do not know your consumers. And events are stored, so a consumer replaying last year’s topic meets last year’s shape.
The same rules hold, applied more strictly. Add only, never reuse a field name with a new meaning, and put a schema registry with compatibility checks in the publisher’s pipeline. When a real break is needed, publish a new event type alongside the old one for a while. That is expand and contract again.
A provider can deploy alone only if it knows what its consumers actually read.
Where to go next
- The Distributed Monolith: Symptoms and the Way Out — lockstep releases are what you get without any of this;
- Backend for Frontend: The Missing Link — the BFF is a consumer too, and a good first place to write contracts.
References
- Martin Fowler, TolerantReader — the consumer’s half of the bargain;
- Ian Robinson, Consumer-Driven Contracts: A Service Evolution Pattern — the original article;
- Pact documentation — the most widely used contract-testing tool;
- Danilo Sato, ParallelChange — expand and contract, under its other name;
- RFC 8594: The Sunset HTTP Header Field — how to say “this goes away on that date” in a response.