ASP.NET Core › API Versioning
How do you deprecate an API version gracefully, notifying consumers via response headers before eventually removing it?
AdvancedAnswer
Marking a version with [ApiVersion("1.0", Deprecated = true)] combined with options.ReportApiVersions = true causes the middleware to automatically include api-deprecated-versions and api-supported-versions response headers on every response, giving automated tooling or attentive client developers a machine-readable signal of the impending removal well before the version is actually deleted from the codebase.
[ApiVersion("1.0", Deprecated = true)]
[ApiVersion("2.0")]
[Route("api/v{version:apiVersion}/orders")]
public class OrdersController : ControllerBase { }
// Every response now includes:
// api-deprecated-versions: 1.0
// api-supported-versions: 1.0, 2.0Real-world example A partner integration team's automated monitoring watches the api-deprecated-versions header on every API call, automatically opening an internal ticket when their integration is detected still using a version flagged as deprecated, well ahead of its actual removal date.