How to Manage API Versioning in GitHub
API versioning is one of the most consequential product decisions because the cost of getting it wrong is paid by your customers. A breaking change that slips into production without proper versioning forces every integration partner to scramble, erodes trust, and generates support tickets for months. The PM's role is not to implement the versioning strategy but to define the compatibility contract and ensure the workflow enforces it.
GitHub is where your API code lives, which makes it the natural place to manage the versioning workflow. This guide covers setting up a branching strategy for API versions, using tags and releases to mark stable versions, automating backward-compatibility checks, and maintaining documentation that stays in sync with the code. The result is a workflow where breaking changes are intentional, visible, and communicated before they affect anyone.
Step-by-step guide
Choose your API versioning strategy
Decide between URL path versioning (/api/v1/users), header versioning (Accept: application/vnd.myapi.v1+json), or query parameter versioning (/api/users?version=1). URL path versioning is the most explicit and the easiest for PMs and partners to understand, which is why it is the most common for external APIs. For internal APIs, header versioning keeps URLs clean. Document the chosen strategy in your API's README and create a GitHub Wiki page or docs site page explaining the contract.
- Evaluate URL path, header, and query parameter versioning
- Choose URL path versioning for external-facing APIs as the default
- Document the versioning strategy in the repo README and API docs
Set up a branching strategy for API versions
Create long-lived branches for each major API version: api/v1, api/v2, etc. The main branch always contains the latest version. When you need to maintain a previous version (bug fixes, security patches), cherry-pick or backport to the version branch. This structure keeps version-specific code isolated while allowing the latest version to evolve freely. Use branch protection rules on version branches to prevent accidental force pushes or unreviewed merges.
- Create a long-lived branch for each major API version
- Set branch protection rules on version branches
- Document the branching convention in CONTRIBUTING.md
Define what constitutes a breaking change
Create a BREAKING_CHANGES.md file in your repo that explicitly lists what your team considers a breaking change. Common breaking changes include: removing an endpoint, removing a field from a response, changing a field's type, adding a required request parameter, and changing error codes. Non-breaking changes include: adding a new endpoint, adding an optional field to a response, and adding an optional request parameter. This document is the contract that prevents debates during code review.
- Create BREAKING_CHANGES.md with explicit examples of breaking vs non-breaking changes
- Add the list to your PR template as a checklist
- Reference this document in your API design guidelines
Automate backward-compatibility checks in CI
Add a GitHub Actions workflow that runs on every PR to detect breaking changes. Tools like openapi-diff or optic compare the PR's OpenAPI spec against the baseline and flag removals, type changes, or new required fields. If a breaking change is detected, the CI check fails with a clear message explaining what broke and linking to your versioning policy. This is the enforcement mechanism that catches breaking changes before they reach production.
- Maintain an OpenAPI spec file in your repository
- Add a CI workflow that compares the spec against the base branch
- Configure the check to fail on breaking changes with a clear message
Use GitHub Releases for version documentation
When you ship a new API version, create a GitHub Release tagged with the version number (v2.0.0). The release notes should include: what changed (new endpoints, modified fields, deprecated items), migration guide (how to update from v1 to v2), deprecation timeline (when v1 will reach end-of-life), and links to the updated API documentation. Use GitHub's auto-generated release notes as a starting point and edit them to be partner-facing rather than developer-facing.
- Create a GitHub Release for each API version
- Include changelog, migration guide, and deprecation timeline
- Notify API partners via email or developer portal when a new version ships
Establish a deprecation and sunset workflow
When a new version launches, the old version enters deprecation. Add a deprecation notice to the old version's documentation with the sunset date (typically 6-12 months after the new version ships). Use GitHub Issues to track the deprecation timeline as a project: create issues for sending deprecation notices at 6 months, 3 months, 1 month, and 1 week before sunset. On the sunset date, update the old version to return a 410 Gone status with a migration link rather than silently breaking.
Common mistakes
Shipping breaking changes without a version bump
Every breaking change must be gated behind a new major version. If you make a field required in v1 without bumping to v2, every existing integration breaks without warning. The CI check for backward compatibility is your safety net, but the cultural expectation is equally important: breaking changes are always a new version.
Versioning too aggressively
Creating v3, v4, v5 in rapid succession forces partners to constantly migrate and signals instability. Each major version should last 12-24 months. If you are versioning more frequently, you may need better API design upfront or a more additive approach to evolving existing versions.
Not providing a migration guide between versions
Announcing a new version without a migration guide leaves partners guessing at what changed. The migration guide should be a step-by-step document: for each breaking change, explain the old behavior, the new behavior, and the code change required to migrate. Include code examples in the most common client languages.
Tips
Use GitHub's CODEOWNERS file to require PM approval on any PR that modifies the API spec, ensuring product awareness of every API change
Set up a GitHub Project board tracking every API endpoint's lifecycle status: Active, Deprecated, Sunset, so you have a dashboard of your API surface area
Use API versioning headers in your documentation to let partners test against both old and new versions simultaneously during migration
Create a #api-changes Slack channel that receives notifications from the GitHub Actions workflow whenever the API spec changes in a PR
How Vantage helps
Vantage connects to your GitHub repository and understands your API structure. When you generate a PRD for a feature that involves API changes, Vantage creates tickets that reference your versioning policy and flag when a proposed change would be breaking. This ensures that API compatibility is part of the specification process, not an afterthought discovered during code review.