Advertisement
Beginner ASP.NET Core, API Versioning

What does the ReportApiVersions option do, and what response headers does it add?

Short answer

Setting options.ReportApiVersions = true causes the versioning middleware to automatically add api-supported-versions (listing every currently active version) and, if applicable, api-deprecated-versions headers to every API response, giving clients and monitoring tools…

Save ASP.NET Core mock interview
Advertisement
AModel answer
Setting options.ReportApiVersions = true causes the versioning middleware to automatically add api-supported-versions (listing every currently active version) and, if applicable, api-deprecated-versions headers to every API response, giving clients and monitoring tools visibility into the full version landscape without needing separate documentation lookups.
builder.Services.AddApiVersioning(options => {
    options.ReportApiVersions = true;
});

// Every response now includes, e.g.:
// api-supported-versions: 1.0, 2.0, 3.0
Real-world example
An API gateway's monitoring dashboard automatically tracks which API versions are still actively in use by parsing the api-supported-versions header from live traffic, informing decisions about when it's finally safe to remove an old version.
Likely follow-ups
  • Does this header appear on every response or only versioned endpoints?
  • How would client-side tooling consume this header automatically?
Related topics