API Versioning Explained (v1, v2 and Why It Matters)
APIs change over time โ versioning lets them evolve without breaking your app. Here's how v1/v2 works and how to stay on a stable version.
APIs change. Versioning is how a provider ships those changes without breaking the apps already using the old behaviour. As a consumer, your job is to know which version you are on and to move deliberately when you need to.
Where the version lives
| In the URL path | https://api.example.com/v1/users. The most common and most visible. Bumping to /v2/ is an explicit choice. |
| In a header | Accept: application/vnd.example.v2+json or a custom X-API-Version: 2. Keeps URLs clean. |
| As a date | Stripe-Version: 2024-06-20 or ?v=20240620 (Wit.ai). Your account is pinned to the version in force when you started; you upgrade explicitly. |
| Not at all | GraphQL APIs typically don’t version — they add fields and deprecate old ones instead. |
What counts as a breaking change
- Removing or renaming a field, endpoint or parameter.
- Changing a field’s type (
"42"→42) or its meaning. - Making an optional parameter required, or tightening validation.
- Changing default behaviour, pagination style, or error format.
- Changing auth requirements.
Non-breaking (usually shipped without a version bump): adding a new optional field, a new endpoint, a new optional parameter, or a new enum value — which is why your code should ignore unknown fields and handle unexpected enum values gracefully.
How providers deprecate a version
- Announce it (changelog, email, blog) with a sunset date.
- Often send a
Deprecationand/orSunsetresponse header, or a warning in the body. - Run old and new in parallel for months to years.
- Eventually return errors or redirect. (The Graph, balldontlie, PunkAPI and Yahoo Finance are recent examples of consumers getting caught out.)
What you should do
- Pin the version explicitly in your requests — don’t rely on the provider’s default, which can change.
- Subscribe to the changelog or status page for every API you depend on.
- Write your parser defensively: access fields by name, tolerate missing/extra fields, don’t assume enum exhaustiveness.
- Keep a contract test that hits the real API and checks the response shape, so a change surfaces in CI.
- When upgrading, read the migration guide, run old and new side by side, and diff the responses.
FAQ
Should I always use the latest API version?
Not automatically. Use a version you have tested against and pin it. Upgrade deliberately, following the migration guide, rather than letting the provider’s default shift under you.
What is a ‘breaking change’?
Any change that could make a correct existing integration start failing: removing or renaming fields, changing types or defaults, tightening validation, or changing auth.
Why don’t GraphQL APIs have versions?
Because clients request specific fields, the server can add new fields freely and mark old ones @deprecated without a version bump. Removal still happens, just gradually.
How will I know a version I use is being retired?
Watch for Deprecation/Sunset headers and body warnings, and subscribe to the provider’s changelog. Don’t rely on catching an email.
Keep going
Try it on a real API
๐ Explore free public APIs
Hundreds of free APIs, searchable by category, with auth & CORS at a glance.
Browse the directory โ