API versioning strategies covering URL path, header, content negotiation, backward compatibility, deprecation policies, and migration guides
Load this skill when designing APIs that will evolve over time, planning breaking changes, or establishing deprecation policies. Every public API will change — a versioning strategy decides whether those changes break your consumers or not.
| Strategy | Example | Pros | Cons |
|---|---|---|---|
| URL path | /api/v2/users | Simple, visible, cacheable | Clients must update every URL |
| Query parameter | /api/users?version=2 | Easy to default to latest | Easy to forget, poor caching |
| Custom header | X-API-Version: 2 | Clean URLs | Hidden from browser, harder to test |
| Content negotiation | Accept: application/vnd.api.v2+json |
| REST-purist, flexible |
| Complex, poor tooling support |
| No versioning (evolve) | Always backward compatible | No version management | Constrains design evolution |
Recommendation: URL path versioning for public APIs (simple, explicit, discoverable). Evolutionary approach for internal APIs with coordinated consumers.
Deprecation: true, Sunset: <date>), and changelogs## Migrating from v1 to v2
### Breaking Changes
1. `GET /v1/users/:id` → `GET /v2/users/:id`
- Response field `name` split into `firstName` and `lastName`
- Before: { "name": "Jane Doe" }
- After: { "firstName": "Jane", "lastName": "Doe" }
### New Features
- Added `GET /v2/users/:id/preferences` endpoint
### Deprecated (will be removed in v3)
- `GET /v2/users/:id?include=prefs` — use the new preferences endpoint
### Timeline
- v2 available: 2025-01-15
- v1 deprecated: 2025-01-15
- v1 sunset: 2025-07-15
Sunset and Deprecation headers on deprecated versions in every responseDeprecation and Sunset headers