Agent Wranglers

API-29Recommended

Announce deprecation and sunset in headers

Mark a retiring endpoint with the Deprecation header and its shutdown date with Sunset, and link to the migration guide.

How to do it

Send Deprecation as RFC 9745 defines and Sunset as RFC 8594 defines, plus Link with rel="deprecation". The sunset date comes at least six months after the deprecation date for public APIs. After the sunset, answer 410 Gone. The website playbook's deprecation rule has the full headers. SDKs and libraries deprecate in code, as Deprecate in a minor release before removing in a major one says.

Examples

HTTP example

HTTP/1.1 200 OK
Deprecation: @1788220800
Sunset: Tue, 31 Aug 2027 00:00:00 GMT
Link: <https://example.com/docs/migrate-to-v2>; rel="deprecation"; type="text/html"

How to check

curl -sI https://api.example.com/v1/orders shows Deprecation, Sunset and the Link to the guide.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/api-design/changes-over-time/deprecation-headers">Agent Wranglers API design playbook</a>. In code you write, add a comment next to it with the same link.