Skip to content
hostcomplex 25 years of hosting

APIs & Web Services

API Versioning Explained

Maarten Soetens

4 min read

Why APIs need versions and breaking changes

You might run into "API versioning" if you work with integrations. This just means every version of the API has its own flag (something simple like v1, v2, or an explicit number). When a provider steps up to fix or redesign the API, existing apps don't fall over. Your current script or tool sticks with the style and responses it knows from its chosen version; nobody's code breaks overnight because something invisible changed out from under it.

The need for a new version comes up when a change will break stuff rather than add new options. Let's say a new field gets added or a new API endpoint appears. Most well-built clients just skip anything unfamiliar, no big deal. Not every program is that relaxed, though, so even "just added" fields can cause drama for older software. Now, yank away a field, rename one, swap an integer for a string, or flip an optional param into a must-have? That's a breaking change. Those break expectations. Suddenly, the API doesn't do what the old client thinks it does.

Real example: suppose you use a hosting API that spits out the disk quota as the number 10240, and you change it so that next week it returns '10 GB' instead. Software that does math on that number, say, to alert a user they're running low, might crash. Versioning lets you fix or upgrade the API while leaving existing programs alone, at least for a while, so nobody scrambles at midnight because all updates hit everyone at once.

Ways to state the API version: path, header and parameter

There are a few common tricks for telling the API which version you're talking to. Providers pick what fits their needs (sometimes more than one way is supported), and no single move fits all situations.

  • Path versioning drops v1, v2 or any number in the URL itself: /v1/accounts. It shows up in browser and logs, and routing requests is dead simple. The catch? Each version gets its own set of endpoint addresses forever, so clutter builds up unless you clean it out.
  • Header versioning puts the version in a custom or media-type header in the HTTP request. The URL stays tidy, which some folks like or even require, but you can't check or test the version in a browser as easily.
  • Query parameter versioning tacks something like ?version=2 onto calls. Fast to add, but there's a risk of forgetting it, and caching is trickier.

Sometimes, there's no version marker at all. Some APIs decide to keep things backward compatible by changing only in ways clients won't notice, plus marking old features as deprecated. This works when all clients are internal, or the API is small and still evolving, a special case, really.

What happens when a provider deprecates or removes an old version

If you see something labeled deprecated, it still works but is on its way out. Most providers warn customers when this is coming, explain what to use instead, and set a date for when the old style will stop responding. The length of that window depends on a lot of things, how many people use that version, how hard it is for customers to move to the new one, and sometimes how much support noise the provider wants to avoid.

Making the change clear is often as important as giving enough time. So announcements might turn up in changelogs, in a warning banner in the developer portal, even in API responses. Sometimes the provider adds deprecation details to their machine-readable OpenAPI documentation, or drops a custom warning header into each API call. The goal is to make migration obvious, even if the client is automated and nobody reads docs each day.

If you ignore a deprecation for too long, though, apps relying on that version will break when it finally gets yanked. That can leave orders stuck or billing halted, depending on what you're automating. The only way to avoid those surprises is to monitor documentation and check for updates regularly.

Frequently asked questions

What is the difference between a breaking and a non-breaking API change?

A non-breaking change doesn't interrupt working clients, you can add a read-only field, or publish a fresh endpoint, and old tools won't complain. But a breaking change can pull the rug out: delete a field, move one around, require more data than before, or switch the meaning of a status. That's what usually pushes providers to create a new API version at all.

Should every API put the version number in the URL?

No. A version in the URL works for a lot of teams and is simple to spot, but some APIs prefer headers or query parameters. You might even see no version marker if backwards compatibility can be handled another way. The method depends on how clients connect, how much caching matters, and how the provider expects the API to change over time.

  • What Is a REST API?

    What is a REST API? Learn the principles of REST and RESTful architecture, including resources, statelessness and caching, and how they shape web APIs.

  • What Is API Rate Limiting?

    API rate limiting caps how many requests a client can send in a set time. Learn the common algorithms, 429 responses and safe retry handling.

  • HTTP Methods Explained

    HTTP methods tell an API what to do: GET reads, POST creates, PUT and PATCH update, DELETE removes. Learn which methods are safe and how they map to CRUD.