HACKER Q&A
📣 _448

In REST APIs, should the version be at the start or end of the path?


Say I have this REST API path: /api/ca/cb/cc

Which of the following is a better way to include version string, e.g. v0, in the API?

/api/v0/ca/cb/cc

or

/api/ca/cb/cc/v0


  👤 buttheyare Accepted Answer ✓
Whatever works better for you. Generally I'd recommend the former, simply due to the fact the other one might imply everything from vX is a part of vY, which usually isn't the case in my experience. Though, you shouldn't really care about those kind of micro-optimizations at any point of (early) development, let alone post on hn asking about it.