OpenAPI
OpenAPI versioning that avoids breaking changes
Version and deprecate APIs without surprising consumers. Learn semantic versioning, headers, and documentation patterns.
Published: February 3, 2026 • Author: APISAST
Set clear version strategy
Decide early whether to version by path (/v1/), header (Accept-Version), or media type (application/vnd.example.v1+json). Consistency matters more than the specific style. APISAST checks for missing or conflicting version declarations in your spec.
Use semantic versioning
Semantic versioning (MAJOR.MINOR.PATCH) helps clients understand impact. Breaking changes belong in MAJOR bumps; additive fields belong in MINOR; PATCH should be backward compatible. Document this in info.version and changelog sections of your OpenAPI file.
For guardrails, the static API security scanner flags version regressions and missing deprecation notices.
Communicate deprecations
- Add the Deprecation header and a sunset date.
- Mark deprecated operations and schemas in OpenAPI with a rationale.
- Provide migration guides and examples in docs and error messages.
APISAST ensures deprecated operations are labeled and still secured with auth so legacy consumers stay protected.
Prevent breaking changes
- Avoid removing fields; mark them nullable or deprecated first.
- Keep error formats stable and additive; don’t swap codes abruptly.
- Use feature flags and shadow deployments to test new shapes.
Pair static checks with consumer-driven contract tests to ensure clients still parse responses. See API security SAST tools for adding these checks to CI.
Document change logs
Include a changelog section within your docs and link to it from the API description. Each entry should specify the version, type of change, impact, and migration steps. APISAST highlights missing changelog references and inconsistent versioning.
Next steps
Run APISAST to check for versioning gaps, then visit the OpenAPI security scanner for more static analysis tips or the SAST testing for APIs guide to add automation.
Scan my spec