Lesson 8 of 9 · 24m
Deprecation, Migration, and the Long Tail of Consumers
Retire API behavior with measurable usage, explicit timelines, migration tooling, and empathy for clients you do not control.
Deprecation is where good API citizenship goes to die. Teams mark an operation deprecated: true, update a docs page, and then act surprised when a partner integration using it breaks eighteen months later. Deprecated does not mean dead. It means “we have committed to a migration path and a measurable sunset.”
Deprecation is a lifecycle, not a label
OpenAPI can mark operations or schemas deprecated, but metadata is only the start; you also need runtime telemetry, consumer communication, migration documentation, deadlines, and a shutdown decision process:
paths:
/v1/reports/{reportId}:
get:
deprecated: true
description: Deprecated. Use GET /v2/reports/{reportId}.Measure before you threaten
Before announcing removal, answer:
Who still calls it? Which keys, user agents, SDKs, or partner accounts?
What volume and criticality? What replacement covers the workflow and behavioral differences?Logs often lie because user agents are missing or generic. If you control SDKs, embed version and integration identifiers responsibly — enough to understand migration, not enough to create a privacy problem.
Use Sunset and deprecation headers carefully
RFC 8594 defines the Sunset header, and many APIs also emit deprecation warnings, though humans still need the same information in docs, release notes, email, and dashboards:
Deprecation: true
Sunset: Sat, 30 May 2026 23:59:59 GMT
Link: <https://api.example.test/docs/migrations/reports-v2>; rel="deprecation"Real consumers miss headers all the time.
Migration guides need diffs, not essays
A useful migration page shows exact before and after:
-GET /v1/reports/{reportId}
+GET /v2/reports/{reportId}
-{"total": 1299, "currency": "USD"}
+{"totals": {"amountMinor": 1299, "currency": "USD"}}Explain semantic differences: changed permission behavior, pagination defaults, asynchronous processing, new error states, and data retention. Customers care about behavior, not the engineering elegance of the redesign.
Shutdown is an operational event
When the deadline arrives, do not simply delete the route and hope. Prefer staged enforcement: warning windows, brownouts for noncritical consumers, explicit contact with remaining accounts, then final removal. For internal APIs, block deployments that still depend on the old contract. For public APIs, treat shutdown as customer-impacting change management.
Field notes
- “No usage in logs” often means no usage this week, not no usage ever. Batch jobs and seasonal clients exist.
- Preserve old contract tests until removal. Deprecated behavior still needs correctness while supported.
- Never silently repurpose a retired field name for different semantics. Somebody's archived client will find it.
- If migration requires data transformation, provide a rehearsal path or dry run when feasible.
Was this lesson helpful?