API versioning: a practical guide
It comes up on almost every project, usually later than it should. This guide covers what API versioning actually involves, where it usually goes wrong, and how to tell whether yours is in reasonable shape.
Architecture is the set of decisions that are expensive to reverse, which is the only reason they deserve the name. Nothing below assumes a large team or a large budget — most of it is a decision somebody has to make and then write down.
The reason this keeps coming up
Version before anyone external depends on you, not after. It is worth being explicit about, because assumptions differ quietly. If it only works because one person remembers to do something, it does not work yet.
For most businesses the question is not whether this matters but how much of it is worth doing right now. That depends on what you are trying to achieve in the next few months, not on best practice in the abstract. In practice this is a scheduling problem more than a technical one.
The practical version
Additive changes rarely need a new version. None of that requires a large budget, only a decision and someone to own it. Most teams find the first pass takes an afternoon and the maintenance takes minutes a month.
Most systems fail at the seams rather than inside any one component. The version that works in practice is usually less elaborate than the version described in the guides.
Publish a deprecation timeline and actually honour it. That sounds obvious written down. It is still the thing most often skipped. The teams that stay on top of it are the ones who put it on a calendar rather than a wish list.
A working checklist
If you want a quick read on where you stand, work through this. Anything you cannot answer confidently is where to start.
- Version before anyone external depends on you, not after
- Additive changes rarely need a new version
- Publish a deprecation timeline and actually honour it
- Someone is named as the owner, not just assumed to be
- There is a date in the calendar to review it again
- The decision and the reasoning behind it are written down somewhere findable
- You could explain the current setup to a new hire in five minutes
Common failure modes
The most common failure is not doing this badly. It is doing it once, during a launch, and never revisiting it. Circumstances move, the setup does not, and the gap widens quietly until something breaks or somebody notices the numbers.
- It was configured during a launch and has not been touched since
- Different people in the business believe different things are true about it
- There is no way to tell whether the last change helped or hurt
- The only person who understands it has left, or is about to
The right architecture for a team of three is the wrong one for a team of thirty, and vice versa. Getting it slightly wrong is survivable. Ignoring it entirely is not.
How we approach it
On our projects this gets handled during the build rather than added afterwards, because retrofitting it costs several times more than including it. We write down what was decided and why, so the next person to touch it is not guessing.
If you are working with someone else, the questions worth asking are simple: who owns this, how will we know it is working, and what happens when it needs to change?
Making it stick
Pick the single item from the checklist above that would cause the most trouble if it turned out to be wrong. Fix that one, confirm it worked, then move on. If you are not sure where your systems currently stand on this, it takes us about an hour to find out.