API-27Required
Make only additive changes
Change a live API only by adding optional inputs, response fields, endpoints or enum values. Never remove, rename or retype what clients use.
How to do it
Treat these as breaking. Removing or renaming a field, adding a required input, tightening validation, changing a default and changing a status code. A new value in a response enum is safe only once clients are told to accept unknown values, as in tolerant clients. Check every change against the released contract before it merges. Catch a removed or renamed field in CI with Check the contract between services.
Examples
Shell example
oasdiff breaking released/openapi.yaml openapi.yaml --fail-on ERR
How to check
A tool such as oasdiff compares the new OpenAPI file with the released one, and the build fails on any breaking change.
Sources
Related rules
- API-30 Tell clients to ignore what they don't know in API design
- TST-14 Check the contract between services in Testing
- API-82 Deprecate GraphQL fields before you remove them in API design
- API-87 Never reuse or change a protobuf field number in API design
- EVT-3 Version event payloads in Integration and events
- DEV-3 Offer JSON output with a stable shape in Developer tools, SDKs and CLIs
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/api-design/changes-over-time/additive-changes">Agent Wranglers API design playbook</a>. In code you write, add a comment next to it with the same link.