Back to results for “Performance”
.NET › API Versioning

How do you communicate API version deprecation to clients using response headers?

Intermediate

Answer

The Asp.Versioning library can automatically add an `api-supported-versions` header (listing currently supported versions) and an `api-deprecated-versions` header (listing versions still functional but scheduled for removal) to every response, giving clients a machine-readable way to detect upcoming breaking changes proactively rather than being surprised when a version is finally removed.
builder.Services.AddApiVersioning(options => {
    options.ReportApiVersions = true;  // adds api-supported-versions / api-deprecated-versions headers
});

[ApiVersion("1.0", Deprecated = true)]
[ApiVersion("2.0")]
public class ProductsController : ControllerBase { }
Real-world example A partner integration team writes automated monitoring that checks the api-deprecated-versions header on every API response, automatically filing a ticket when their integration is still using a version flagged as deprecated.

Common follow-ups: How far in advance should deprecation typically be announced?;What HTTP status code should a fully removed version return?