API (Application Programming Interface) versioning helps to evolve interfaces and ensure backward compatibility when changes are made, so that external and internal clients are not broken with each update.
Main versioning schemes:
/api/v1/resource.Accept: application/vnd.company.v1+json./api/resource?version=2.The URL versioning approach is usually used as it is clear and transparent for all clients.
Example in Node.js (Express):
// Version 1 app.get('/api/v1/orders', ordersV1Handler); // Version 2 app.get('/api/v2/orders', ordersV2Handler);
Key features:
Is it enough to only support the latest API version?
No, users of old applications may not be able to urgently switch to the new interface, so several active versions are often maintained.
Can incompatible changes be added back in a minor API version?
No, minor versions must be strictly compatible with previous ones. Breaking changes require a major version change.
Does the versioning method (URL, headers, parameters) affect the security or performance of the API?
No, the storage location of the version does not affect technical characteristics, but URL versioning is easier to analyze with monitoring and support tools.