Scrivio Interview library
DesignAdvanced5 min read · updated 12 November 2026

Define a versioning and deprecation policy for public and internal REST APIs across a company of many teams. What counts as a breaking change, how long do old versions live, and how is retirement enforced?

The policy lists breaking changes explicitly (removing or renaming fields, changing types or meaning, new required inputs, changed error codes, stricter validation) and states that additive changes never need a new version because clients must ignore unknown fields. It sets published support windows, longer for public APIs than for internal ones, and enforces retirement with Deprecation and Sunset headers, documentation, direct notice and tracking of remaining traffic per client.

Why this question is asked

Without a shared policy, each team decides on its own what breaking means and how long old versions live. One team keeps three versions forever, another removes a field on a Friday and breaks a partner. Interviewers ask this design question to see whether a candidate can write rules that are precise enough to apply and humane enough that teams follow them. In this answer, we will define breaking changes, state the rules for additive changes, set support windows, design the deprecation signals, and see how retirement is enforced with data rather than hope.

1Why the Definition of Breaking Must Be Written Down

A breaking change is any change after which a correctly written existing client stops working or starts behaving wrongly. That sounds clear, but teams disagree about the edge cases. Is making validation stricter breaking? Is adding a new value to an enum? If the policy leaves it open, every team argues it again, and some will guess wrong. So the policy contains an explicit list, and API reviews and diff tools check changes against it.

Breaking or not?
ChangeBreaking?Why
Remove or rename a response fieldyesclients reading it get null or fail
Change a field's type or meaningyesamount in cents instead of euros breaks silently
Add a required request fieldyesold requests are now rejected
Change error codes or status codesyesclient error handling misfires
Make validation stricteryesrequests that used to work now fail
Add an optional field or endpointnotolerant clients ignore what they do not know
Add an enum value in a responseonly if declared closedpolicy must say clients handle unknown values
The list is part of the policy and of the CI diff rules.

2Additive Changes Never Need a Version

The other half of the definition is a promise from clients. The policy requires that clients ignore unknown fields and handle unknown enum values with a sensible default. With that promise, adding an optional response field, a new endpoint or an optional query parameter is always safe and never needs a new version.

This rule does most of the work. In a typical API, the large majority of changes are additions. If teams know they can add freely, they stop bundling small changes into big new versions, and the number of live versions stays low. In Java clients this is mostly free, because Spring Boot configures Jackson not to fail on unknown properties, but the policy says it explicitly because clients in other languages may need it.

3Support Windows

When a breaking change is unavoidable, the old version stays available for a published period after its successor ships. The window depends on who the consumers are. For public and partner APIs, whose clients release on their own schedules and may need budget to change, a window of 12 months or more is common. For internal APIs, where the consumers are known teams, contract tests show who depends on what, and both sides share a roadmap, 3 months may be enough.

The policy also limits how many versions may be live at once, for example two for any internal API and three for public ones. That keeps the cost of the old versions bounded and forces a conversation before a third or fourth appears.

4Signalling Deprecation

A deprecated version still works but has a retirement date. Clients need to learn this through several channels, because developers read different things. We update the documentation and changelog, email or message known consumers, and add headers to every response of the deprecated version so that the signal reaches code and logs too.

Java
HTTP/1.1 200 OK
Deprecation: @1767225599
Sunset: Thu, 30 Apr 2027 23:59:59 GMT
Link: <https://api.example.com/docs/migrate-v1-to-v2>; rel="deprecation"
Content-Type: application/json

The Sunset header (RFC 8594) gives the date after which the version may stop responding, and the Deprecation header (RFC 9745) says the resource is deprecated, here as a timestamp; check the RFC for the exact syntax your tooling expects. The Link points to the migration guide. Client libraries and API gateways can log or alert on these headers, so a team learns about a deprecation even if they missed the email.

5Enforcing Retirement With Data

A sunset date alone does not retire anything. We need to know who still calls the old version. The gateway or tracing system records traffic per version and per client identity, so we can see every caller that remains and how much they send. As the date approaches, we contact the remaining callers individually and offer help.

Near the end we use gradual measures: scheduled brownouts, where the old version returns errors for short announced periods so forgotten integrations surface, and finally removal. For internal APIs, contract tests in the consumers' pipelines make the dependency explicit, so a team cannot release a change that still needs a retired version. Retirement decisions and exceptions are recorded so the next team follows the same path.

Step throughLifecycle of an old version
  1. Successor shipsold version marked deprecated
  2. Headers, docs and direct noticeDeprecation, Sunset, Link
  3. Track traffic per clientgateway and tracing data
  4. Still callers near sunset?
    YesContact them, run brownoutsNoRemove the version
  5. Remove the versionrecord the decision

5 steps in order. Play them, or step through them one at a time.

6Follow-up questions

What do you do when an important customer will not migrate before the sunset date?

First we find out why: missing features in the new version, no engineering capacity, or a contract that promises the old behaviour. If our new version lacks something, we fix that. If it is capacity, we offer migration help or tooling. If the business decides the customer is worth it, we grant a time-limited extension in writing, ideally priced or tied to the contract, and keep the old version running for that customer only, for example behind the gateway by client id, so everyone else still moves on schedule.

Is adding a new value to an enum breaking?

It depends on what the policy promised. If clients were told that enums are open and they must handle unknown values, it is additive. If the enum was documented as closed, a strict client may fail on the new value, so it is breaking. A good policy declares response enums open from the start.

Who enforces the policy across teams?

Tooling does most of it: an OpenAPI diff in CI flags breaking changes and requires an explicit approval, and the gateway reports traffic on deprecated versions. A small API review group handles exceptions and keeps the rules up to date.

7Conclusion

In this answer, we wrote a versioning and deprecation policy for many teams. It defines breaking changes in an explicit list, guarantees that additive changes need no new version because clients ignore unknown fields, sets published support windows that are longer for public APIs than for internal ones, signals deprecation through documentation, direct notice and Deprecation and Sunset headers, and enforces retirement by tracking remaining traffic per client, with brownouts and contract tests to finish the job.

What to say in the interviewAbout 80 seconds aloud

Open with

I would start by writing down what breaking means, as a concrete list: removing or renaming a field, changing a type or its meaning, adding a required input, changing error or status codes, and making validation stricter.

Then, if they want more

The flip side is that additive changes, like new optional fields or endpoints, never need a new version, because the policy requires clients to ignore unknown fields and handle unknown enum values. That rule keeps the number of versions low.

For unavoidable breaking changes, the old version gets a published support window after the successor ships, something like 12 months for public and partner APIs and maybe 3 months for internal ones, where we know the consumers and have contract tests. I would also cap how many versions can be live at once.

Deprecation is signalled in several ways at the same time: documentation and changelog, direct notice to known consumers, and Deprecation, Sunset and Link headers on every response of the old version. Retirement is enforced with data: the gateway tracks traffic per version and client, we contact remaining callers, run announced brownouts near the date, and then remove the version.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Define a versioning and deprecation policy for public and internal REST APIs across a...": https://scrivio-interview-library.netlify.app/spring-boot/rest-api-design/11a0079fc9/