Evolve an API without breaking clients
Plan compatible changes, explicit deprecation, and measurable rollout.
Inventory the contract
A senior engineer starts by finding actual consumers and observing which request and response fields they use. Document status codes, validation behavior, pagination, and error shapes, not only the happy-path JSON. A code search cannot reveal every external client, so pair it with access logs and owner conversations. Mark assumptions that still need proof.
Expand before contracting
Add a new optional field or endpoint while keeping the old behavior available. Teach clients to accept the new shape, then move writers and readers deliberately. Remove the old contract only after usage has fallen to an agreed threshold and clients have had a documented migration window.
Phase 1: accept old and new input; emit old and new output.
Phase 2: migrate clients and observe usage.
Phase 3: reject old input after the published sunset date.
Test and observe the rollout
Keep consumer-contract examples for both old and new clients. A staged rollout should compare error rate and latency by contract version, with a rollback path that does not require restoring old data. Treat a spike in 4xx responses as possible breakage, even if server health remains green.
Check your understanding
Why is removing an apparently unused response field risky?
Show explanation
Unknown external clients may still depend on it. Measure usage, communicate deprecation, and remove it through a staged compatibility plan.
You can read for free. Create an account to save your progress.
Next lesson: Change a live schema safely →Try it at senior level
Plan a two-release API change from a required field to an optional one. List old-client behavior, telemetry, and the deprecation notice.
Check your work
Old clients keep working during rollout, new semantics are unambiguous, and removal depends on measured usage.
Self-guided practice. This does not record assessed mastery.
Put this lesson into practice
A related activity in this module at foundation level.
Try: Create a URL-safe slugFurther reading
Primary references for this module. Check the current version when behavior or framework guidance may have changed.