Resources / Guides
API versioning best practices: URL, header or no versions at all
How to version a REST API — URL paths, headers, date-based versions — what counts as a breaking change, and how to evolve an API without breaking clients.
Once other people call your API, every change risks breaking them. Versioning is how you change it anyway — but the best versioning strategy is needing new versions rarely.
Breaking vs non-breaking changes
Usually safe (non-breaking):
- Adding an endpoint
- Adding an optional request field
- Adding a field to a response
- Adding a new value to a field clients only display
Breaking:
- Removing or renaming a field or endpoint
- Changing a field's type or format (a number becomes a string, a date format changes)
- Making an optional field required
- Changing what a status code or error means
- Tightening validation that used to pass
Clients should ignore fields they don't know. If you document that, you can add fields freely.
Three ways to version
### In the URL path
GET /v1/orders/1042
GET /v2/orders/1042
- Pros: obvious, easy to test in a browser, easy to route and cache.
- Cons: the version is in every URL; clients have to change URLs to upgrade.
### In a header
GET /orders/1042
Accept: application/vnd.example.v2+json
- Pros: clean URLs; one resource, several representations.
- Cons: harder to test and debug; caches must vary on the header.
### Date-based versions (pinned per client)
Each client is pinned to the API version from when they started (sent as a header like Api-Version: 2026-11-01); the server translates older requests and responses. Stripe popularised this.
- Pros: clients upgrade when they choose; you can ship small breaking changes often.
- Cons: you maintain translation layers for every old version.
Practices that matter more than the scheme
- Avoid breaking changes. Add instead of change; deprecate instead of remove.
- Version the whole API, not each endpoint — mixed versions confuse everyone.
- Announce deprecations with dates, in docs and with
DeprecationandSunsetheaders. - Support old versions for a defined period, and measure who still uses them before turning them off.
- Publish schemas (OpenAPI / JSON Schema) so clients — and AI agents — can see exactly what changed.
- Keep a changelog.
API versions vs deployment versions
These are different things. API versions are contracts with your callers. Deployment versions are releases of your code — you'll have many deployments per API version. Every deploy should be reversible regardless of your API versioning.
On Wisp
Every change in Wisp is a deployment version: a draft you test with ?test, publish when ready and roll back in one click — callers never see a half-deployed state. For API versions, use the path: a v2-orders endpoint next to orders, or a subpath like /orders/v2/... handled in code. Input and output schemas document each endpoint, so changes are visible before you publish.
Build it with Wisp — describe an API, get it live.