API versioning and deprecation
The contract
The runtime API you integrate against is described by one machine-readable document:
GET /openapi/runtime-v1.jsonon the runtime API host (OpenAPI 3).
It lists every /api/v1/runtime endpoint. Properties that are never null are marked required, enums are strings, and a deprecated endpoint is marked deprecated with its sunset date in x-sunset. Generate your client models from this file rather than hand-writing them.
The version is in the path (/api/v1/...). Within v1 we only make additive changes.
What counts as breaking
Never done within a version:
- Removing or renaming an endpoint, a response property, or an enum value.
- Making an optional request field required, or adding a required request field.
- Changing a property's type or turning a never-null property into a nullable one.
- Tightening validation so a previously accepted request is rejected.
Done freely within a version (write your client to tolerate them):
- New endpoints, new optional request fields, new response properties, new enum values, new error codes.
Deprecation and sunset
When an endpoint is going away we announce it three ways at once:
- Every response from it carries
Deprecation: true,Sunset: <HTTP date>(RFC 8594) andLink: <replacement>; rel="successor-version". - The OpenAPI document marks the operation
deprecated. - It is listed in the API changelog with the date and the replacement.
The minimum notice between the first Deprecation header and the sunset date is 180 days. Security fixes can shorten this and are announced in the changelog the same day.
Watch for the header in your own logs: any response with a Deprecation header is an endpoint you should migrate.
How we enforce it
scripts/openapi-breaking-diff.mjs compares the document the code generates with the committed baseline (docs/api/openapi/runtime-v1.baseline.json) and fails on any change listed under "never done" above. A deliberate breaking change needs a new version, not a baseline edit.
The check runs as the unit test RuntimeV1OpenApiBaselineTests. After an additive change, refresh the baseline with TE_UPDATE_OPENAPI_BASELINE=1 dotnet test --filter RuntimeV1OpenApiBaselineTests and commit the file; reviewers see exactly which endpoints and fields were added.