API version

View as Markdown

Fern supports two complementary ways to express the version of your API. info.version records a single version string that flows through to your generated docs and downloadable spec. x-fern-version defines a header-based version scheme for APIs that dispatch behavior based on a version header (similar to Stripe’s Stripe-Version).

info.version

Fern preserves the info.version field from your OpenAPI specification. Any format is supported, including SemVer (1.2.3), CalVer (2026-06-23), or custom strings.

openapi.yml
1openapi: 3.1.0
2info:
3 title: My API
4 version: "2026-06-23"
5paths: ...

The value carries through to the downloadable OpenAPI spec served from your docs site and to Markdown output on API Reference pages.

x-fern-version

To define a header-based API version scheme, use x-fern-version:

openapi.yml
1x-fern-version:
2 header: X-API-Version
3 default: "2.0.0"
4 values:
5 - "1.0.0"
6 - "2.0.0"
7 - "latest"
8paths: ...

This generates a version selector dropdown in the API Reference and attaches the chosen version as a request header on each call.