API Versioning, Deprecation and Backward Compatibility Questions
Evolving an API without breaking existing consumers: versioning schemes (URI, header, media type, semantic versioning), classifying breaking versus non-breaking changes including behavioural ones such as defaults and error text, deprecation and sunset policy and timelines (including accelerated retirement), running multiple versions concurrently, and planning consumer migrations at scale including SDK, partner, mobile and long-tail client impact. Also covers finding who still calls an old version, catching accidental breaks with contract checks in CI, expand-then-contract evolution of fields and stored data, gradual rollout with per-version monitoring, and compatibility between independently deployed services, streams and libraries. Covers compatibility guarantees across REST, GraphQL and gRPC consumers. Excludes general API surface design, payload and OpenAPI schema design, protobuf field-level mechanics, writing the notices themselves, rate limiting, gateways and database schema migration.
Design the deprecation lifecycle for a public API: which stages does an endpoint pass through from release to shutdown, what minimum notice does each customer tier get, what signals tell clients, and what happens to clients who have not moved when the date arrives? How do you balance shipping improvements against customer stability?
Sample Answer
The idea in plain words
A deprecation lifecycle is the fixed sequence of states an endpoint passes through between release and shutdown, with an entry condition, an exit condition and a customer-visible signal for each state. Deprecation means "scheduled for removal, still works"; the sunset is the date it stops. The balance between shipping improvements and customer stability is set by one rule: you may change anything you like, but only through the lifecycle, so customers can predict what happens to them. The lifecycle below has six stages, a per-tier notice floor, machine-readable signals, and a defined outcome for a client that is still calling on the sunset day.
The six stages
| Stage | Meaning | Exit condition | Customer-visible signal |
|---|---|---|---|
| 1. Preview | Opt-in, no stability promise | Owner decides to promise stability | Marked preview in the docs and spec |
| 2. Current | Fully supported, compatible changes only | A replacement exists and a sunset date is approved | None needed |
| 3. Deprecated | Fully supported, scheduled for removal, replacement documented | Announced notice period has run its course to the restriction date | Deprecation and Sunset headers, changelog, email, dashboard banner |
| 4. Restricted | Still works, no new features, planned brownouts (short windows in which calls fail on purpose) | Sunset date arrives | Brownout calendar, direct outreach to remaining callers |
| 5. Sunset | Calls fail fast with 410 Gone | A quiet period with no traffic from known keys | Machine-readable error body with a link to the migration guide |
| 6. Removed | Code, routes, dashboards and runbooks deleted | Finished | Docs archived |
Minimum notice per customer tier
These floors are assumptions to be set with the business, not industry facts: self-serve and free keys 6 months, paid plans 12 months, contracted enterprise accounts 18 months or the notice written in their contract, whichever is longer.
I would publish one sunset date for everybody, announcement plus 12 months, and honour the 18-month contracts with a per-key allowlist (a list of API keys that keep working past the date) at the gateway (the front-door service that every request passes through, where authentication, rate limits and headers are applied). Free keys then receive 12 months, more than their floor. The reason is operational: the old code must stay alive until the last paying tier's date anyway, so an earlier date for free keys saves almost nothing and adds a second date to explain.
Signals to clients
Illustrative worked example. Assumption: the v1 reports endpoint is announced on Tuesday 2027-01-12 (UTC), with a public sunset on Wednesday 2028-01-12 (365 days later; the leap day, 2028-02-29, falls after the sunset). The Deprecation header (RFC 9745) carries a Unix timestamp, written @ followed by a count of seconds (this is the notation HTTP calls a structured-field date). Unix time counts the seconds elapsed since 1970-01-01 00:00 UTC. From that moment to 2027-01-12 00:00 UTC is 20,830 days, and each day has 86,400 seconds, so 20,830×86,400=1,799,712,000 and the header value is @1799712000. The Sunset header (RFC 8594) carries an HTTP date, the human-readable form Wed, 12 Jan 2028 00:00:00 GMT (weekday, day, month, year, time, always in GMT). Both Link relation names, deprecation and sunset, are listed in the IANA registry of link relation types, which means tools may recognise them without guessing. This response is illustrative, not a capture, and its Content-Length equals the 31-byte body.
GET /v1/reports/88 HTTP/1.1
Host: api.example.com
Authorization: Bearer <token>
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 31
Deprecation: @1799712000
Sunset: Wed, 12 Jan 2028 00:00:00 GMT
Link: <https://docs.example.com/migrate-v1-to-v2>; rel="deprecation"; type="text/html", <https://docs.example.com/sunset-v1>; rel="sunset"; type="text/html"
{"id":"rep_88","state":"ready"}
Read the header block line by line. Deprecation says "this became deprecated at this instant" (the date may also lie in the future, meaning it will become deprecated then; here it equals the announcement). Sunset says "it stops working at this instant". The first Link entry (rel="deprecation") points a human at the migration guide; the second (rel="sunset") points at the sunset policy page; type="text/html" says each target is a web page. A client library can follow these links and show them in its logs.
Headers are only read by clients that log them, so they are one signal among five: the headers, a dated changelog entry, email to every key owner who called the endpoint in the last 90 days, a dashboard banner, and a named contact for contracted accounts.
Dated calendar for that endpoint
| Date | Day | Stage change |
|---|---|---|
| 2027-01-12 | Tue | Deprecated: announcement and headers |
| 2027-12-14 | Tue | Restricted: 1-hour brownout (29 days before sunset) |
| 2028-01-04 | Tue | 4-hour brownout (8 days before sunset) |
| 2028-01-12 | Wed | Sunset: 410 Gone for all keys not on the allowlist |
| 2028-07-12 | Wed | Contract allowlist (18 months) ends; the quiet period then starts for removal |
What happens to clients that have not moved
On the sunset date the endpoint answers 410 Gone (the resource is intentionally and permanently gone). I choose 410 over the alternatives by looking at how each kind of client reacts. A 404 reads as a typo or a temporary outage, so developers search for a bug in their own URL and monitors treat it as noise. A redirect to the new version would deliver a different contract to code that never agreed to it, and the caller's parser may fail in a confusing place. A 5xx tells clients "try again later", so retry logic would hammer a dead route. A 410 is the one answer that says "deliberate and permanent", so humans stop retrying and alerting rules can match it. The body uses the problem details format (RFC 9457), a standard JSON shape for error responses with type, title, status, detail and instance fields, so that the body is machine-readable and a client can branch on type without parsing prose. Illustrative, with a 201-byte body:
HTTP/1.1 410 Gone
Content-Type: application/problem+json
Content-Length: 201
{"type":"https://api.example.com/problems/version-retired","title":"This API version has been retired","status":410,"detail":"Version v1 was retired on 2028-01-12. Use v2.","instance":"/v1/reports/88"}
The route is switched off by a feature flag (a configuration switch that turns behaviour on or off without a code deploy), not deleted, for a defined quiet period (for example 30 days with no calls from known keys). During that time an emergency re-enable for a named key is possible, which is the rollback path. Only after the quiet period is the code removed.
Balancing improvements and stability
- Compatible changes ship freely and never enter the lifecycle.
- Breaking changes are batched into a major release rather than trickled out; a team proposing one writes down what it costs customers (keys affected, estimated migration effort) against what it gains. As a judgement call, treat a major release as something to plan at most every 18 to 24 months.
- No replacement, no deprecation. If a legacy service has no successor, the options are keep it in a frozen maintenance state with its running cost visible, or end-of-life it with an executive decision, a data export for customers and the longest notice tier.
- Emergency retirements (security flaw, legal order) can shorten the notice, but need a named approver, direct contact with affected keys and a written reason. They are logged as exceptions so their count is visible.
Company-wide rollout: buy-in, enforcement, measurement
- Buy-in: take leadership one comparison, the recurring engineering cost of old code against the revenue at risk from breaking customers, and ask for a policy signed by a sponsor. Each team's roadmap then includes retirement slots, and a platform team supplies the tooling so a team's cost is filling in a registry entry.
- One registry (a single shared list that records every retirable thing) covers APIs and also product features, configuration options, webhook event types and SDK methods. Each entry has an owner, replacement, stage, announcement date and sunset date. An illustrative row:
GET /v1/reports/{id}, ownerreports-team, replacementGET /v2/reports/{id}, stagedeprecated, announced 2027-01-12, sunset 2028-01-12. - Enforcement: a CI (continuous integration, the automated build-and-test run on every code change) test fails any change that deletes a registered item before its sunset date, and the gateway reads the registry to add the headers and to flip to
410. This is an illustration; it protects registered items and needs reviewers for anything that was never registered. - Compliance measures: share of retirements that met their minimum notice; share of traffic still on the old route 30 days before sunset; count of emergency exceptions; entries overdue in each stage; support tickets in the 30 days after a sunset.
Pitfalls
- Treating the headers as the announcement. Clients that ignore them need the email and the brownouts.
- Redirecting retired routes to the new version.
- A lifecycle with no owner for the "Removed" stage: dead code remains for years.
How would you manage API evolution for a platform with thousands of third-party clients so you can keep innovating while minimising breakage? Think about governance, tooling, deprecation, compatibility checks, SDKs, migration telemetry and what motivates clients to upgrade.
Sample Answer
The idea in plain words
With thousands of third-party clients (the consumers: other companies' programs that call your API), you cannot coordinate a release with each one. So evolution at this scale is a programme with four parts: rules for what counts as a breaking change, automated checks that enforce the rules before release, a published deprecation process with notice periods, and measured migration with incentives. The goal is to make the safe path the default: additive changes ship continuously and need no coordination, while the rare breaking change goes through a slow, visible, measured process.
A breaking change is any change that makes a previously correct client fail or misbehave. Deprecation means "still works, scheduled for removal, please migrate". Sunset is the date the old behaviour stops. An SDK (software development kit) is the client library you publish so consumers do not hand-write HTTP calls.
The method, in the order I would build it
1. Governance: who decides, and what the rules are
- A written compatibility policy the whole company can read: what is guaranteed (response fields are never removed or retyped within a major version, new enum values may appear, new optional fields may appear), what is not (field order, undocumented behaviour), and the minimum notice period for removal.
- A small API review group (a few senior engineers plus a product manager) that approves any change flagged breaking. Teams own their APIs; the group owns the exceptions and the policy, not every change.
- A named owner per endpoint in a registry, so a deprecation always has someone accountable.
As the product manager, the decision I own is the cost trade-off: every breaking change spends consumer trust, so it needs a stated reason (security, legal, an unfixable design flaw), not "the new design is nicer".
2. Tooling: catch breakage before release
- Contract diff in CI (continuous integration, the automated build and test pipeline): compare the proposed API description with the last released one and fail the build on removed fields, retyped fields, new required inputs and tightened validation. Tools in this category exist for OpenAPI, GraphQL schemas and protobuf.
- Consumer-driven contract tests: key partners publish the requests and responses they depend on, and the provider's pipeline replays them against each build. This catches behaviour a schema diff cannot see.
- A compatibility test suite per SDK: each released SDK version runs against the candidate server in CI.
- Feature flags (runtime switches that turn behaviour on or off without a deploy) and canary releases (send a small share of traffic to the new build first, for example 1 percent, then 10 percent, then all, watching error rate by consumer at each step). A canary limits the damage of a break that slips through; a flag is the instant rollback.
3. Deprecation as a process with a calendar
Every deprecation follows the same template: announce, mark in machine-readable form, warn at runtime, brown out, sunset. A brown out is a short, announced window in which the old version deliberately returns errors, so callers who ignore email find out while the harm is small; the sunset is the date the old version is switched off for good. A sample timeline follows in the worked example. The runtime signals use real standards: the Deprecation response header (RFC 9745) and the Sunset response header (RFC 8594), plus a Link header pointing to the migration guide.
4. Migration telemetry
You cannot manage what you cannot see. Log, per API key and per SDK version: which version or endpoint was called, which deprecated features were used, and the error rate. From that, build a dashboard of "keys still on the old path" and a contact list ranked by traffic and by revenue. Keep a note of what this cannot show: a response field a client reads leaves no trace on the server, so SDK-side telemetry, consumer contract tests and direct partner contact fill that gap.
5. What motivates clients to upgrade
Clients migrate when it is cheap, when it is worth it, or when they have no choice, in that order of preference:
- Cheap: a migration guide, a codemod (a script that rewrites a consumer's source code automatically) or SDK upgrade that does most of the work, a test environment for consumers, and an SDK that handles the change so the consumer only bumps a version number.
- Worth it: the new version carries something they want (a feature, better performance, higher rate limits). Do not ship new features to the old version.
- No choice: a dated sunset, brownouts, and direct outreach to the largest consumers. Pressure is the last lever, not the first.
Worked example: a sample deprecation timeline
Assumptions, all illustrative: 4,000 active API keys; the old version is called v1 and the new one v2; the notice period is 52 weeks (364 days) for external consumers. Announcement on Monday 2027-03-01.
| Week | Date (Monday) | Event | Keys on v1 (trailing 30 days) | Share of 4,000 |
|---|---|---|---|---|
| 0 | 2027-03-01 | Announce, publish guide, add Deprecation and Sunset headers on v1, email owners | 4,000 | 4000 / 4000 = 100% |
| 13 | 2027-05-31 | Warning banner in the developer portal; v2 only gets new features | 2,900 | 2900 / 4000 = 72.5% |
| 26 | 2027-08-30 | Personal outreach to the top 50 keys by traffic still on v1 | 1,700 | 1700 / 4000 = 42.5% |
| 39 | 2027-11-29 | Second email; test-environment v2 load test offered | 800 | 800 / 4000 = 20.0% |
| 44, 48, 50 | 2028-01-03, 2028-01-31, 2028-02-14 | Brownouts: v1 returns an error for a short, announced window | 260 at week 48 | 260 / 4000 = 6.5% |
| 52 | 2028-02-28 | Sunset | 40 | 40 / 4000 = 1.0% |
A key counts as on v1 if it called v1 at least once in the trailing 30 days (the 30 days before the date shown), so keys that went quiet do not inflate the count. The top 50 keys by traffic are tracked separately because a few large consumers carry far more requests than hundreds of small ones: a share of keys alone can look healthy while most of the traffic is still on v1.
The sunset rule I would write down: sunset on the later of (announcement plus 364 days) and (the first date at which v1 keys are at most 1.0 percent of active keys and none of the top 50 by traffic remain). Announcement plus 364 days is 2028-02-28, and the table shows 1.0 percent on that date, so the rule is met exactly on the notice date, assuming for this illustration that all of the top 50 have moved by then, and the sunset goes ahead. Had the week-52 figure been 60 keys (1.5 percent), the date would slip until the usage condition held, and the remaining keys would get a tracked, expiring exception rather than an open-ended one.
Illustrative response headers on a v1 call during the notice period (the values match the table: 1803859200 is 2027-03-01 00:00:00 UTC as a Unix timestamp in seconds, and the sunset is the week-52 Monday):
HTTP/1.1 200 OK
Content-Type: application/json
Deprecation: @1803859200
Sunset: Mon, 28 Feb 2028 00:00:00 GMT
Link: <https://developers.example.com/migrate-v1-v2>; rel="deprecation"; type="text/html"
Deprecation: @1803859200 is a structured-field date (a date format from the HTTP structured field values specification: an @ followed by whole seconds since 1970-01-01 00:00:00 UTC, called Unix time; RFC 9745 uses it) meaning "deprecated since this instant". To convert by hand: 1803859200 / 86400 seconds per day = 20,878 whole days after 1970-01-01, and that day is 2027-03-01. Sunset is an HTTP-date (RFC 8594) giving the removal time. The Link header with rel="deprecation" points to the human guide.
Read the sunset rule as two conditions that must both hold: (A) at least 364 days have passed since the announcement, and (B) v1 keys are at most 1.0 percent of active keys and none of the top 50 remain. Sunset is the first date on which both are true. The program below converts the timestamp and checks both conditions against the table.
from datetime import datetime, timedelta, timezone
announce = datetime(2027, 3, 1, tzinfo=timezone.utc)
ts = int(announce.timestamp())
print("Deprecation: @" + str(ts), "=", ts // 86400, "whole days after 1970-01-01 plus", ts % 86400, "seconds")
print("back to a date:", datetime.fromtimestamp(ts, timezone.utc).isoformat())
sunset = announce + timedelta(days=364)
print("Sunset:", sunset.strftime("%a, %d %b %Y %H:%M:%S GMT"))
active_keys = 4000
for week, keys in [(0, 4000), (13, 2900), (26, 1700), (39, 800), (48, 260), (52, 40)]:
day = (announce + timedelta(weeks=week)).date()
print(f"week {week:2} {day} keys on v1: {keys:4} = {100 * keys / active_keys:.1f} percent")
at_sunset = 40
print("usage condition (at most 1.0 percent):", at_sunset / active_keys <= 0.01)
print("date condition (announcement + 364 days):", sunset.date())
Output:
Deprecation: @1803859200 = 20878 whole days after 1970-01-01 plus 0 seconds
back to a date: 2027-03-01T00:00:00+00:00
Sunset: Mon, 28 Feb 2028 00:00:00 GMT
week 0 2027-03-01 keys on v1: 4000 = 100.0 percent
week 13 2027-05-31 keys on v1: 2900 = 72.5 percent
week 26 2027-08-30 keys on v1: 1700 = 42.5 percent
week 39 2027-11-29 keys on v1: 800 = 20.0 percent
week 48 2028-01-31 keys on v1: 260 = 6.5 percent
week 52 2028-02-28 keys on v1: 40 = 1.0 percent
usage condition (at most 1.0 percent): True
date condition (announcement + 364 days): 2028-02-28
Read-out: the first two lines convert the timestamp both ways, and the third is the Sunset value. Condition A is met on 2028-02-28 (announcement plus 364 days). Condition B is met by week 52, where 40 / 4,000 = 1.0 percent is at most 1.0 percent, and the top 50 are assumed gone. Both are true on 2028-02-28, so the sunset goes ahead on that date with nothing to spare; at 60 keys (1.5 percent) condition B would fail and the date would slip.
This timeline is an illustration of the shape (long notice, escalating steps, measured thresholds). A real process must also handle consumers who have no active maintainer, mobile apps that update slowly, regulated customers with change freezes, and contractual notice terms.
Trade-offs and pitfalls
- Versioning the whole API for every change multiplies the versions you support. Prefer additive evolution inside a major version, and cut a new major version only for changes that cannot be made additively.
- Long support windows cost engineering time: each concurrent version is another set of tests, security patches and documentation. Set the maximum number of concurrently supported majors in the policy (for example two) so the cost is bounded.
- Pressure without help creates churn: brownouts without a migration path produce angry support tickets, not migrations.
- The silent consumers are the risk: the biggest breakage comes from keys that never read email. Brownouts are how you find them while the damage is still small.
- Announced dates are promises: moving a sunset later is cheap once; doing it repeatedly teaches consumers that dates are negotiable.
Common mistakes
- Treating deprecation as an email rather than a process with machine-readable signals and measurement.
- Measuring only server traffic and concluding a response field is unused.
- Giving every consumer the same deadline regardless of size, instead of tiered handling (different treatment by consumer size) for the top consumers.
- Announcing a sunset with no migration tooling or test environment.
Running the code
Paste the program into a file and run it with Python 3.12; it needs no extra packages and prints exactly the output shown.
A breaking API change causes a sudden spike in support tickets and error logs. What are your immediate triage steps, how do you communicate with stakeholders, how do you prioritize fixes, and what changes afterwards to stop a repeat?
Sample Answer
The idea in plain words
When a breaking change has shipped and consumers are failing, the order of work is: stop the damage first, understand second, fix properly third, prevent last. The fastest safe way to stop the damage is almost always to restore the old behaviour (revert the deploy, switch off a feature flag, which is a configuration switch that turns new behaviour off without a deploy, or put a small compatibility shim in front, which is a thin translation layer that converts the new response back into the old shape), not to write a forward fix under pressure. Communication runs in parallel with the technical work, with one person responsible for it, on a fixed rhythm. Prioritisation is by impact times reach, not by who shouts loudest. Impact is how bad the failure is for the people it hits (for example 1 for cosmetic, 2 for a workaround exists, 3 for data wrong or a core flow down); reach is the share of the failing requests or affected users that a group makes up. Multiply the two and fix the largest product first. Afterwards you review the incident without blame and change the system so the same class of change cannot reach production unnoticed.
Step 1: immediate triage (first minutes)
- Declare an incident and name roles: an incident commander (decides and keeps order), a technical lead (investigates), and a communications lead (talks to everyone else). Splitting these stops the person debugging from also answering messages. SRE means site reliability engineering; the SRE on call usually starts this.
- Confirm the link to a change. Put the failure graph (client-reported errors and response-validation failures, as described below) beside the deploy and configuration-change markers. A jump that starts at the deploy minute is strong evidence; a jump with no change near it points elsewhere (a dependency, an expired certificate), and you should say so instead of assuming the API change.
- Measure the blast radius (how many users, clients and requests the fault touches) by grouping failing requests by endpoint, status code, API version, client identifier and SDK (software development kit, the client library) version. This answers "who is hurt, and how badly" in minutes. A response-shape break such as the one in the worked example returns 200 from the server, so the server's own error rate stays flat; the failures show up on the client side (SDK error telemetry, partner reports, tickets) and are joined to the server logs by request identifier so they can be grouped. A break that the server itself rejects, such as a new 4xx, is visible directly in the status-code grouping.
- Mitigate. Decide with one question: can the change be reverted without losing or corrupting data? If yes, revert now. If a data migration ran, a pure revert may not be safe, so use a flag or shim that restores the old response shape while the data question is handled.
- Verify the mitigation with the same grouped view: error rate by client returning to its normal level, not just an overall number.
Worked example (all numbers are assumptions)
Assume a deploy at 14:00 changed the type of order.total in v2 from a number to an object. In the first 30 minutes after it, the endpoint served 3,000 requests per minute: 30 x 3,000 = 90,000 requests. The server kept returning 200, but the client-reported failure rate (SDK parse errors and partner reports, joined to server logs by request identifier) rose from near zero to 18 percent: 90,000 x 0.18 = 16,200 failing requests. Support tickets rose from a baseline of 6 per hour to 74 in the first hour, which is 74 / 6 = 12.3 times the baseline.
Grouping the 16,200 failures:
| Group | Share of failures | Failing requests |
|---|---|---|
| Official SDK 2.x | 90 percent | 16,200 x 0.90 = 14,580 |
| Partner A direct integration | 8 percent | 16,200 x 0.08 = 1,296 |
| Everyone else | 2 percent | 16,200 x 0.02 = 324 |
Check: 14,580 + 1,296 + 324 = 16,200. Scoring with impact times reach, where every group has impact 3 (its order parsing fails) and reach is its share of the failures: SDK 2.x scores 3 x 0.90 = 2.70, Partner A 3 x 0.08 = 0.24, everyone else 3 x 0.02 = 0.06. The ranking is SDK first, then Partner A, and the same revert resolves all three. The SDK group is the first thing to fix, and it tells support what to say ("update is not required; we are restoring the old format"). The decision here is to revert the deploy, since no data migration ran.
Step 2: communicating with stakeholders
Different audiences need different content, from different people, on a stated schedule.
| Audience | What they need | Cadence |
|---|---|---|
| Engineering and on-call | Facts, the current hypothesis, who owns what | Continuous, in the incident channel |
| Support and customer success | Plain-language symptom, who is affected, a workaround, a reply template, what not to promise | Update when anything changes, and at least every 30 minutes (assumed) |
| Affected consumers (status page and direct notes to the largest, such as Partner A) | What broke, since when, current status, what they should or should not do, time of the next update | Initial notice within the first hour, then at the promised times |
| Leadership and the product owner or technical product manager (TPM) | Customer impact, risk to contracts or revenue, decisions needed | At declaration, at mitigation, at resolution |
Every message states what is known, what is not yet known, and when the next update comes. Never state a cause as certain before it is confirmed, and never promise a time you do not control.
Step 3: prioritising the fixes
Rank by impact, then reach, then effort.
| Priority | Condition | Examples here |
|---|---|---|
| P0, now | Data wrong or lost, or a core flow down for many consumers | The type change breaking order parsing for SDK 2.x |
| P1, same day | A core flow down for a few consumers, or a safe workaround exists | Partner A's direct integration |
| P2, this sprint | Cosmetic or tolerated by clients | A changed ordering of fields |
Data corruption outranks failed requests, because a failed request can be retried and a wrong stored value cannot.
Step 4: what changes afterwards
Hold a blameless review within a few days: a timeline, the contributing factors (why the change looked safe, why no check caught it, why detection took the minutes it did), and a short list of actions with owners and dates. Typical actions:
- A contract diff in CI (an automated comparison of the new API description with the released one, run on every pull request, that fails the build on a removed or retyped field), and consumer-driven contract tests (each consumer publishes what it reads and the provider's build checks those expectations) so the SDK team's expectations are checked before merge. The diff is the core action here; the contract tests add coverage for known consumers.
- A canary rollout (send the new build to a small share of live traffic first) with failure rate (client-reported errors and response-validation failures) per client and SDK version, with automatic abort, so a break reaches 2 percent of traffic and not 100.
- A regression suite that runs the oldest supported SDK against each build.
- A change classification and deprecation path, so a needed type change ships as a new field or new version with notice.
- Alerting on SDK-reported parse errors and response-validation failures (sampled responses checked against the published contract) by API version, because a response-shape break returns 200 and leaves the server error rate flat, and support tickets should not be the first signal.
- A review of whether support had the information to answer within the hour.
Pitfalls
- Debugging while customers fail, before mitigating.
- Fixing forward by default; it is slower and riskier than a safe revert.
- One long message to everyone instead of audience-specific updates.
- Blaming the author; the review should ask why the process allowed it.
- Skipping outreach to the largest affected consumer and letting them discover the fix themselves.
The ranking table and cadences are illustrations. A real runbook must also cover legal or contractual notification duties, data repair when records were written in the new shape, and handoff between on-call shifts.
Define the versioning and deprecation policy for a public API consumed by external partners. What is the version scheme, what counts as a breaking change, how long do you support old versions, how do you announce changes and what stops the policy from being ignored? Where does it flex for your biggest partners?
Sample Answer
The idea in plain words
A versioning and deprecation policy is a written promise to outside developers (partners) about three things: what you will never change under them, how much warning you give before you remove something, and how they will hear about it. Versioning means labelling editions of the API so old and new behaviour can coexist. Deprecation means announcing that something is scheduled for removal while it still works; the sunset is the date it stops working. The policy only has value if the dates are mechanically enforced and the exceptions are priced, so most of the design below is about enforcement and about where flexibility is allowed.
Terms used below: the gateway is the server in front of the API that receives every request first, checks the key and routes it; the registry is a table listing each API version with its owner and dates; an OpenAPI diff is an automatic comparison of the old and new machine-readable API description; general availability means a version is open to everyone and supported, not just a preview; 410 Gone is the HTTP status code that says the resource has been removed on purpose and will not come back; an allowlist is a list of the only keys that are permitted something; an extended-support addendum is a signed amendment to a partner's contract that keeps the old version alive for them longer.
1. Version scheme
- The major version is an integer in the URL path:
/v1/...,/v2/.... There is no/v1.1. Partners paste URLs, caches key on URLs, and the version shows up in every log line. - Inside a major version only compatible changes ship (section 2). Those are released continuously and recorded in a dated changelog, not in the URL.
- The SDKs (software development kits, the client libraries you publish) follow semantic versioning: MAJOR for changes that break the SDK's own interface, MINOR for backward-compatible additions, PATCH for fixes. An SDK major pins one API major and says so in its README.
2. What counts as breaking
Breaking (needs a new major, or an explicit deprecation cycle):
- Removing or renaming an endpoint, field, parameter or enum value.
- Changing a type, unit, format or meaning of an existing field.
- Adding a required request field or parameter.
- Tightening validation so a previously accepted request is rejected.
- Changing documented defaults, ordering, error codes or authentication requirements.
- Lowering a documented limit (for example, page size or rate limit).
Compatible (ships inside a major, that is, inside one v1, v2 or v3 line): new endpoints, new optional request fields, new response fields, new enum values only where the contract already told consumers to treat the set as open. The contract must state the tolerance rule ("ignore fields you do not recognise"), because otherwise a strict parser turns every addition into a breaking change.
3. How long old versions are supported
Illustrative policy numbers (a starting position to negotiate with the business, not an industry standard):
- Support the current major and the previous major.
- When a new major reaches general availability, the oldest live major gets a 12-month deprecation window before sunset. With v3 released, v1 enters its window and v2 becomes the previous major, so at most three majors are live, and only for that one window.
- Partners with a signed extended-support addendum can be kept on the old major past the public date (section 6).
- Security fixes may shorten any window; that is an emergency exception with direct partner contact, never the normal path.
4. Announcing changes
Channels: email to the technical contact on every key that called the old version in the last 90 days; a dated changelog; response headers on the old version (Deprecation, RFC 9745, and Sunset, RFC 8594, plus a Link header to the migration guide); a dashboard banner; and a named account manager for the largest partners. Each partner gets a usage report listing which of their own endpoints still hit the old major, because "you are affected" is more persuasive than "someone is affected".
5. What stops the policy being ignored
- The dates live in the registry and the gateway applies them. The sunset flips to
410 Gonebecause the registered date arrives, not because someone remembers. - Scheduled brownouts (short planned windows in which the old version returns errors) make silent callers visible before the real date.
- A CI (continuous integration, the automated build and test pipeline) gate on every API change: an OpenAPI diff of the proposed spec against the released spec of the same major fails the build on any item in the breaking list, and a replay (re-sending saved real partner requests to the new build and comparing the answers) checks behaviour the spec cannot show. Two examples of what each catches are given in the section on reading the pieces on real values. A label from a named API review group is the only override. This check is an illustration: it sees structural differences and the examples you recorded. A real process also needs review of behaviour changes the spec does not express (ordering, latency, error text, limits).
- The policy is referenced in partner terms, so the notice period is a commitment on your side too.
- A named owner and an executive sponsor; a monthly review of share of traffic per version.
6. Where it flexes for the biggest partners
The flex is in time and help, never in what v1 means.
- An extended-support addendum: the partner's keys stay on the old major past the public sunset, up to a cap (here 6 months, once), for a fee that covers the cost of keeping the old code alive, with migration milestones written into the addendum.
- At the gateway this is a per-key allowlist; everyone else gets the
410on the public date. - Engineering help (a migration engineer, a sandbox for their test traffic) is offered before the extension is.
- Partners get no private breaking changes in the old major. A partner request that cannot be met compatibly goes into the next major or a clearly marked preview channel (endpoints that opt-in keys can use, with no stability promise), so fast experimentation does not pressure the stable contract.
7. Concurrency without tripling the work
Keep one core implementation. Each old major is a thin translation layer at the edge that converts its requests into the current core model and the responses back. Customers on different majors simply call different URLs, and there is nothing to negotiate per request. Rollback of a bad release follows the same split: an API change that proves breaking despite review is reverted on the server (the policy treats it as a bug, not a new version); a bad SDK release is superseded by a fixed PATCH release and marked deprecated in the package registry, and a version number is never reused.
Worked timeline for one breaking change
Illustrative assumption: v3 reaches general availability and, under the policy in section 3, v1 (the oldest live major) is announced for retirement on Tuesday 2027-03-02, with the 12-month standard window. v2 stays live as the previous major.
| Date | Day | Event |
|---|---|---|
| 2027-03-02 | Tue | Announcement, Deprecation and Sunset headers on v1, migration guide, per-partner usage reports |
| 2027-06-02 | Wed | Month 3 reminder email, dashboard banner |
| 2027-09-02 | Thu | Month 6: v1 frozen (no new features); direct outreach to partners still above a traffic threshold |
| 2027-12-02 | Thu | Month 9 reminder, list of partners without a migration plan goes to account managers |
| 2028-02-02 | Wed | Month 11 reminder (29 days before sunset) |
| 2028-02-16 | Wed | Brownout of 30 minutes (15 days before sunset) |
| 2028-02-23 | Wed | Brownout of 2 hours and final notice (8 days before sunset) |
| 2028-03-02 | Thu | Sunset: v1 returns 410 Gone (366 days after the announcement, because 2028 is a leap year) |
| 2028-09-04 | Mon | End of extended-support addenda (186 days after the public sunset) |
The messages are spaced at months 0, 3, 6, 9 and 11 plus the final week, so the cadence covers the whole span, and the standard window equals the 12-month minimum in the policy.
Reading the pieces on real values
The announcement headers. A candidate needs the idea, not the RFC numbers: the response carries a machine-readable "deprecated since" time, a "removed on" time and a link to the guide. Illustrative values for the timeline below (announcement 2027-03-02, sunset 2028-03-02):
HTTP/1.1 200 OK
Deprecation: @1803945600
Sunset: Thu, 02 Mar 2028 00:00:00 GMT
Link: <https://developers.example.com/migrate-from-v1>; rel="deprecation"; type="text/html"
Deprecation (RFC 9745) holds a date written as @ plus seconds since 1970-01-01 UTC; 1803945600 / 86400 = 20,879 whole days, which is 2027-03-02. Sunset (RFC 8594) is an ordinary HTTP date. Link with rel="deprecation" points at the human-readable guide. A partner's code or monitoring can read the first two and raise an alert without a person reading the changelog.
One translation, before and after. Suppose v1 accepts a single customer_name string and the current core model stores a name object. The v1 layer turns the request on the way in and the response on the way out:
// v1 request received at the edge
{"customer_name": "Ada Lovelace"}
// what the core model receives
{"customer": {"given_name": "Ada", "family_name": "Lovelace"}}
// what the layer returns to the v1 caller, rebuilt from the core response
{"customer_name": "Ada Lovelace"}
(Illustrative; real names do not always split on the last space, which is exactly the kind of detail the layer's tests must pin.) The v1 caller never sees the new shape, and the core model never carries customer_name.
A change the CI gate catches. A pull request renames the response field status to state in the spec. The OpenAPI diff reports "response field removed: status", the build fails, and only a label from the API review group lets it merge. A second pull request leaves the spec untouched but changes the code so list results come back newest first. The diff sees nothing; the replay of recorded requests returns the same items in a different order, and the comparison flags it. A behaviour change that no recorded example covers would pass both checks, which is why the human review group stays in the process.
Pitfalls
- Writing a policy with no enforcement mechanism: the first deadline is missed and the policy stops being believed.
- Defining breaking changes by intent ("anything that hurts users") instead of by a checkable list.
- Giving large partners silent exceptions: unpriced extensions teach everyone to wait.
- Letting the notice period be shorter than the partner's own release cycle.
You are removing a legacy shared service that dozens of internal teams depend on. How do you set ownership of the replacement, migration windows and support, and the check that lets you declare the old service retired?
Sample Answer
The idea in plain words
Retiring a shared internal service is a migration programme, not a switch-off. Dozens of teams depend on it, none of them were asked whether they wanted to move, and each has its own priorities. So you need three things up front: one accountable owner for the whole migration (usually the team that owns the replacement, backed by an executive sponsor), a schedule in waves with real support capacity behind it, and a retirement check that is evidence, not opinion: nobody calls it, nothing is registered against it, and a reversible switch-off test went by without anyone complaining. Without a measurable finish line, a legacy service lives for years because "someone might still use it".
Step 1: ownership
| Role | Owns | Does not own |
|---|---|---|
| Replacement team (the platform or service team) | The outcome: the migration plan, migration guide and tooling, a support rota, the status dashboard, retirement of the old service | Every consumer's code changes |
| Each consumer team | Its own cutover work and test sign-off, a named contact | The replacement's design |
| Executive sponsor (an engineering director or the product owner of the platform) | Priority across teams, resolving conflicts, deciding on forced cutovers and on funding | Day-to-day tracking |
| Technical product manager (TPM) or programme manager | Tracking, communication cadence, risk log | Technical decisions |
Write the ownership down as a one-page charter with the end date. Teams will compete with their own roadmaps, so the sponsor's visible priority is what makes the migration happen. A common lever is to charge the legacy service's running cost back to the teams still on it, so the cost of waiting is visible.
Step 2: build the inventory before promising dates
You do not know your consumers until you measure. Combine three sources and take the union:
- Traffic: calls to the service by caller identity, from gateway or service-mesh logs (the mesh is the layer of proxies handling service-to-service traffic).
- Registrations: credentials, API keys, network allow-lists and registry entries.
- Code search: repositories that reference the service's name, client library or URL.
Worked example (all numbers are assumptions): traffic logs show 31 distinct calling teams, and code search finds 36 teams referencing the service. Assume every team seen in the traffic logs also appears in the code search, so the union is 36 teams (if some callers appeared only in the traffic logs, the union would be larger and you would count it that way). The 36 - 31 = 5 teams that reference the service but show no recent traffic are the interesting ones: typically a quarterly batch job, a disaster-recovery path or an unused code path. They must be contacted individually; the traffic log alone would have missed them.
Step 3: migration windows and support
Assume the replacement team can support 12 teams at a time. Then 36 / 12 = 3 waves. Assume 8 weeks per wave, so the migration takes 3 x 8 = 24 weeks, plus a final retirement phase.
| Wave | Teams | Order rule | Window |
|---|---|---|---|
| 1 | 12 | Willing teams and the simplest integrations first, to harden the guide and tooling | Weeks 1-8 |
| 2 | 12 | Medium complexity | Weeks 9-16 |
| 3 | 12 | Hardest or most critical teams, which now benefit from a proven path | Weeks 17-24 |
Support for each wave: a migration guide with before-and-after examples, a compatibility shim or adapter where possible (so a team changes configuration and not logic), a shared channel and office hours, a test environment on the replacement, and a dashboard showing each team's remaining calls to the old service. Announce the end date at the start, and publish the plan to all 36 teams, including which wave they are in. Deprecation signals (the Deprecation and Sunset response headers, RFC 9745 and RFC 8594) can be added to the old service's responses so callers' logs show the date.
Tracking in each wave: percentage of each team's calls moved (from the traffic log), not a status someone types.
Step 4: the check that lets you declare it retired
Use a sequence, each step with an exit condition:
- Zero calls from every caller, observed for at least the longest known business cycle. If the slowest known job runs quarterly, a quarter is at most 92 days (31 + 30 + 31 for the longest cases), so observe for 92 days or rehearse the quarterly job against the replacement before then.
- Zero registrations left: credentials revoked or marked unused, allow-list entries removed.
- Zero code references on the main branches (re-run the code search).
- Scream test: switch the service off in a reversible way (reject calls with a clear error that names the owner and the migration guide) for a short window, such as a few days, and watch for reports. Reversible means you can turn it back on in minutes.
- Decommission: archive data that must be kept under retention rules, then delete the service, its data and its infrastructure, and record the date.
The service is declared retired when steps 1 to 4 pass and the sponsor signs off; step 5 follows.
What happens to teams that do not move
Escalate along a fixed path: team lead, then the sponsor. At the final date you either force the cutover (the scream test at full strength) or approve a time-boxed exception with an owner, a reason and an expiry date, funded by that team. Never leave the service running "for them" with no end date.
Pitfalls
- Declaring retirement from the traffic log alone, missing quarterly and failover callers.
- No sponsor, so every team's roadmap beats the migration.
- All teams in one wave, overwhelming the support team and the replacement's capacity.
- A migration guide written once, never updated by what wave 1 learned.
- Switching off irreversibly in the first test.
The wave size, durations and thresholds above are assumptions chosen to show the arithmetic. A real plan also needs a rollback plan for the replacement itself, data migration and parity checks, security review of the replacement, and handling of teams that are being reorganised or disbanded.
Unlock Full Question Bank
Get access to all 14 API Versioning, Deprecation and Backward Compatibility interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.