API versioning allows evolving an API while maintaining backward compatibility for existing clients. Breaking changes require a new version: removing fields, changing field types, renaming endpoints. Non-breaking changes do not require a new version: adding optional fields, adding new endpoints. URI versioning (/v1/, /v2/) is most discoverable but clutters base URLs. Header versioning is cleaner but harder to test. Deprecation policy (sunset date) gives clients time to migrate.
What requires a new version vs what can be added safely.
Adding new optional response fields is a non-breaking change — old clients ignore unknown fields. Removing fields breaks all clients using that field. When you must remove, deprecate with a sunset date.
Add Sunset: <date> and Deprecation: true response headers from day one of deprecation. API clients that monitor these headers can auto-alert their teams. Much better than clients missing an email.
Supporting v1, v2, v3, v4 simultaneously quadruples maintenance burden. Aggressively deprecate. Target: current version + one previous (in sunset period). Everything older is gone.
Sign in to share your feedback and join the discussion.