Handling Deprecation

1. Announcing Deprecation

Lead TimeAudience
3-6 months minimumPublic APIs
6-12 monthsEnterprise customers
2+ yearsMajor platform shifts

2. Using Deprecation Header

HeaderRFC
Deprecation: trueRFC 9745 — boolean flag
Deprecation: @1735689600Unix timestamp deprecated since

3. Using Sunset Header

Example: Deprecation + Sunset

HTTP/1.1 200 OK
Deprecation: true
Sunset: Sat, 01 Jan 2027 00:00:00 GMT
Link: <https://api.example.com/v2/users>; rel="successor-version"
Link: <https://docs.example.com/v1-to-v2>; rel="deprecation"

4. Providing Migration Guides

SectionContent
What's changingList of removed/renamed/changed elements
WhyRationale (performance, security)
Step-by-stepCode before/after
ToolingCodemods, automated migration scripts
TimelineDeprecation date, sunset date

5. Maintaining Deprecated Endpoints

During Sunset WindowMaintenance Level
Security patchesAlways
Critical bugsYes
New featuresNo
Performance workMinimal

6. Returning Warning Headers

HeaderFormat
Warning: 299 - "Deprecated API"Generic warning
Warning: 299 example.com "Field 'foo' deprecated; use 'bar'"With agent
NoteWarning header is itself deprecated in HTTP semantics; use Deprecation/Sunset

7. Documenting Deprecation Timeline

MilestoneDate
Announced2026-05-15
Deprecation header live2026-06-01
Final warning email2026-12-01
Sunset (removed)2027-01-01

8. Implementing Feature Flags

UseBenefit
Gradual rollbackRe-enable deprecated path if regressions found
Per-customer overrideExtend lifeline for key accounts
Dark launch new versionTest before public flip

9. Notifying API Consumers

ChannelWhen
EmailInitial + 30-day reminder + 7-day final
Dashboard bannerContinuous
Response headersEvery request after deprecation
Webhooks/SlackStatus feed for power users

10. Removing Deprecated Endpoints

Sunset Day BehaviorStatus
Hard removal410 Gone
Redirect to new301/308 (only if compatible)
Grace period410 + extended notice for late adopters