API Sunset header: communicate an expected shutdown date accurately
The HTTP Sunset response header signals that the resource is expected to become unresponsive after a specific time. It is not meant merely to mark an API that is no longer recommended. Under RFC 8594, Sunset is a hint about expected unavailability; it does not guarantee which status code or behavior will occur on that date.
The HTTP Sunset response header signals that the resource is expected to become unresponsive after a specific time. It is not meant merely to mark an API that is no longer recommended. Under RFC 8594, Sunset is a hint about expected unavailability; it does not guarantee which status code or behavior will occur on that date.
Use an HTTP-date value
RFC 8594 defines a single HTTP-date timestamp. For example:
HTTP/1.1 200 OK
Sunset: Sat, 31 Dec 2028 23:59:59 GMT
Link: <https://api.example.com/sunset-policy>; rel="sunset"This is a hypothetical value to illustrate the format, not a real service schedule. The date should normally be in the future. If it is in the past, RFC 8594 says the safest assumption is that the resource could become unavailable at any time. Validate date calculation, time zone, deployment settings, and consistency with the human-readable announcement.
What does it mean—and not mean?
By default, RFC 8594 applies Sunset to the resource whose response contains it. If it also covers multiple endpoints or API versions, publish the broader scope explicitly; clients unaware of that rule may interpret the header as applying only to the one resource.
The header communicates intent, but does not guarantee the resource remains available until that date. Afterward, clients might see a client error, a redirect, or no access at all; the header does not specify which. Keep these concepts separate:
**Deprecation:** lifecycle notice that a resource is no longer recommended or has been marked for retirement.
**Sunset:** the expected time after which that resource will stop responding.
**Shutdown behavior:** the actual status code or response after the date, documented separately by the provider.
Do not use Sunset alone to announce a version that is merely operational but no longer preferred. RFC 8594 says the field is not intended for that first stage. If a policy sends both fields, RFC 9745 requires the Deprecation time not to be later than Sunset.
Link to the sunset policy
RFC 8594 allows a Link response header with the sunset relation to lead to policy or migration information. Explain affected resources, dates, alternatives, transition steps, and support contacts. If you publish machine-readable URI migration rules, ensure that the information is authentic and accurate before clients act on it.
Provider and client checks
Provider:
Is `Sunset` set only for resources expected to become unresponsive?
Is the value a valid HTTP-date consistent with the schedule, time zone, and announcement?
Is any scope broader than the individual resource documented?
Are post-date behavior, redirects, support, and schedule changes explained separately?
Client:
When the header appears, does the owning team get notified and check the replacement?
Does the client still work when the header is absent? RFC 8594 says clients should not depend on it.
Is the field kept separate from cache expiration? `Sunset` signals future availability; HTTP caching concerns reuse of representations.
Is migration based on an announcement and verified guidance?
Sources
[RFC 8594: Sunset HTTP response header and link relation](https://datatracker.ietf.org/doc/html/rfc8594)
[RFC 9745: Deprecation header and its relation to Sunset](https://datatracker.ietf.org/doc/html/rfc9745)