API compatibility policy: set rules for deciding whether changes are safe
An API compatibility policy defines which changes are safe for existing consumers and which require a new version or transition period. It should cover response meaning, defaults, serialization, and generated clients—not just adding or removing fields. Do not assume that every additive change is safe or that incrementing a version number alone makes a change safe.
An API compatibility policy defines which changes are safe for existing consumers and which require a new version or transition period. It should cover response meaning, defaults, serialization, and generated clients—not just adding or removing fields. Do not assume that every additive change is safe or that incrementing a version number alone makes a change safe.
Review three dimensions
Google AIP-180 distinguishes three useful perspectives:
**Source compatibility:** does existing code compile and run with a newer client library?
**Wire compatibility:** can an old consumer communicate with a new server while serialization and interpretation of requests and responses still match?
**Semantic compatibility:** do consumers continue to receive the meaning and results they reasonably expect, even when names and types are unchanged?
For example, adding an enum value to a response may break a client that exhaustively handles known values. Adding an optional response field may be safe if clients are designed and documented to ignore unknown fields. The outcome depends on the actual consumer contract and implementation.
Publish a change-classification table
Use this as a starting point, then state your policy for the protocol, code-generation tools, and consumers' ability to coordinate updates.
| Proposed change | Common risk | Policy question |
|---|---|---|
| Add optional response field | Strict parsers or generated models may reject unknown fields. | Are extensible fields documented and tested? |
| Add request field | Existing requests fail if the new field is required. | Is there a defined server default in the existing version? |
| Remove, rename, or change type of response field | Existing code and stored representations break. | Is there a new version/path and transition window? |
| Add/remove response enum value | Consumers may not handle unknown or missing values. | Is unknown-value behavior defined and preserved by actual SDKs? |
| Change field meaning, default, or format | Parsing succeeds but business results may be wrong. | Is the behavior change documented and does it require a version boundary? |
| Change pagination, ordering, or error semantics | Results may be omitted, duplicated, or retried incorrectly. | Are ordering, boundaries, and errors covered by contract tests? |
Google AIP-180 is guidance for particular consumers and formats. It urges broad consumer consideration for public APIs whose clients update independently across languages; an internal API deployed by one coordinated team can define a different risk model. Do not treat the guidance as a universal rule for every HTTP API. Document whether consumers can be controlled.
Add release gates
**Define the public contract:** list supported versions, stability, optional and required fields, defaults, errors, pagination, ordering, and events/webhooks.
**Assess impact:** review source, wire, and semantic compatibility. Search repositories, gateway records, generated SDKs, and major consumers, while noting that observation may be incomplete.
**Verify automatically and behaviorally:** use specification diffs or compatibility tools to find shape-level risks, then use consumer contract tests and provider functional tests for behavior. A tool's “compatible” result does not settle semantic compatibility.
**Choose a release class:** decide whether the change is a safe addition, a conditional change requiring documentation/defaults, or a breaking change requiring a major/API version or parallel support. Announce dates, migration path, support end, and rollback together.
**Monitor and learn:** track errors and usage on the new contract and calls to old routes; review exceptions and incidents against the policy.
If you use SemVer for a library, apply SemVer 2.0.0 to that package's public API: MAJOR for incompatible changes, MINOR for compatible features or marking public API functionality deprecated, PATCH for compatible bug fixes. Do not automatically apply those package rules to a remote API with a separate version scheme. State the policies for remote API versions and SDK package versions independently.
Check whether the policy works
Document definitions of safe, conditional, and breaking changes; the consumer population; reviewers; automated and manual tests; exception approvers; and deprecation/shutdown timelines. Do not classify a field as safe merely because it is syntactically additive: test generated-client enum handling and parser behavior. If compatibility is uncertain, consult representative consumers before choosing the release class.
Sources
[Google AIP-180: Backwards compatibility](https://google.aip.dev/180)
[Semantic Versioning 2.0.0 specification](https://semver.org/spec/v2.0.0.html)
[GitHub REST API breaking changes and version migration guidance](https://docs.github.com/en/rest/about-the-rest-api/breaking-changes)