The problem
An API has twelve consumers. One of them needs a change. The provider makes it, tests it, and releases it. Two other consumers fail the next morning, because they depended on something nobody knew they depended on.
The usual reaction is to freeze the API or to demand that all consumers test every release. Both make delivery slower without removing the risk. The tactics below let an API keep changing while its consumers keep working.
First, agree what “breaking” means
Teams argue about this after the incident. Publish the list before it.
| Change | Breaking? | Note |
|---|---|---|
| Add an optional request field | No | Old consumers do not send it. |
| Add a response field | No, if consumers ignore unknown fields | Make that a rule for every consumer. |
| Add a new value to a list of codes | Often yes | Consumers with a fixed list fail on the new value. |
| Make an optional field required | Yes | Old requests are now rejected. |
| Remove or rename a field | Yes | Even if you believe nobody uses it. |
| Change a type, format or unit | Yes | Amounts and dates are the common cases. |
| Tighten validation | Yes | Requests accepted yesterday fail today. |
| Change an error code or status | Yes | Consumers branch on them. |
| Change a default or the sort order | Yes | The contract file does not change, the behaviour does. |
Tactic 1: Add, never alter, and require tolerant consumers
- Providers only add. New optional fields, new operations, new endpoints. Existing fields keep their name, type and meaning.
- Consumers ignore what they do not know. An unknown response field is skipped, not treated as an error. Check this in the onboarding tests.
- Consumers handle unknown codes. Every list of codes has a documented fallback: treat an unknown value as “other” and carry on.
Tactic 2: Know who uses what
You cannot retire a field safely if you do not know who reads it. Record usage per consumer, per operation and per version at the gateway.
Operation: GET /accounts/{id}/summary Period: last 90 days
Consumer Version Calls Last call Sends legacy header
-------------- -------- --------- ------------ -------------------
mobile-app v2 4,812,330 today no
web-portal v2 1,204,118 today no
back-office v1 88,402 today yes
partner-a v1 311 41 days ago yes
batch-reports v1 0 never -
With this report the retirement of v1 is a conversation with two teams, not an announcement to everyone followed by a wait.
Tactic 3: Let consumers’ expectations run in the provider’s pipeline
Each consumer records the requests it sends and the parts of the response it relies on. These expectations are stored with the provider and run on every build.
- A change that breaks a consumer fails the provider’s build, before release.
- The failure names the consumer and the field. The provider knows whom to call.
- Consumers no longer need to test every provider release by hand.
Start small. The three largest consumers and the ten most-used operations cover most of the risk.
Tactic 4: Expand, migrate, contract
When a change cannot be additive, split it into three releases.
-
Expand
Add the new field or behaviour next to the old one. Both work. Nothing breaks.
-
Migrate
Consumers move one by one, in their own releases. The usage report shows progress.
-
Contract
Remove the old form only when usage has been zero for an agreed period.
If the old form is never removed, the API carries every past design forever. Put the removal date in the plan at the start, and give it an owner.
Tactic 5: Version rarely, and keep one implementation
- A new major version is the last resort. Use it when the model itself changes, not for a renamed field.
- One implementation behind both versions. The old version is a thin translation in front of the new one. Two full copies drift apart and double the fixes.
- At most two versions live. A third version starts only when the first is gone.
Tactic 6: Retire by evidence, not by announcement
-
Mark it
Flag the operation or field as deprecated in the contract. Return a response header that says so, with the removal date.
-
Tell the consumers who still use it
By name, from the usage report, with what to change.
-
Watch usage fall
Chase the ones that do not move. Escalate with numbers.
-
Rehearse the removal
Switch the old form off in the test environments first, then for short planned windows, before removing it for good.
-
Remove it
When usage has been zero for the agreed period.
Pitfalls
- “Nobody uses that field.” Somebody does. Check the usage report, not memory.
- Bug fixes that change behaviour. Consumers may depend on the bug. Treat the fix as a change and check the contract tests.
- Generated clients with strict parsing. Some reject unknown fields by default. Find them during onboarding.
- Batch consumers. A job that runs once a month does not appear in a seven-day usage report. Use a period longer than the slowest cycle.
- Removal dates that keep moving. After the second extension, nobody believes the date. Extend once, with a reason, and hold it.
Checklist
-
Publish the list of breaking changes
And the rule that consumers must ignore unknown fields and handle unknown codes.
-
Turn on usage reporting per consumer and version
Keep at least 90 days.
-
Collect contract expectations from the largest consumers
Run them in the provider pipeline.
-
Use expand, migrate, contract for the next non-additive change
With the removal date agreed up front.
-
Retire one old version using the evidence steps
One completed retirement makes the next one routine.