Menu
Back to Discussions

API Versioning: Header, Path, or Query Parameter?

Hao Chen
Hao Chen
·5419 views
Hey everyone, I'm starting a new API and trying to figure out the best way to handle versions. I've noticed a bunch of different methods people use. Some teams really like putting the version right in the path, like /v1/resource. Other folks prefer a special header, you know, X-API-Version: 1. And then there's the query parameter option, which looks like resource?api-version=1. They all seem to have good and bad points when it comes to things like how easy they are to find, how caching works, and what clients need to do. What have you all experienced with these? Is there one method that's usually better when you're really digging into API changes, or for handling growth as the API gets bigger? I'm kind of leaning towards path versioning because it seems simple, but I'm wondering if I'm overlooking any big drawbacks, especially since this system could grow pretty fast.
27 comments

Comments

Loading comments...