API Versioning Best Practices: URL Path, Query Parameter, or Header?
Compare API versioning strategies: URI path (/v1/), Accept Header (content negotiation), and date-based headers. Keep your public APIs backward-compatible.
By Cometflow API Engineering Team • Updated 2026-10-06
Public APIs are long-lived contracts. Once mobile apps or third-party integrations depend on an endpoint, renaming a JSON field or changing a type from string to number is a breaking change that requires a clear versioning strategy.
1. Comparing the Three Versioning Patterns
- URI Path Versioning (
/v1/users): Easiest to route at the API Gateway level, immediately visible in browser URLs and curl snippets, and simple to cache on CDNs. - Header Versioning (
Notion-Version: 2026-03-01orStripe-Version): Keeps resource URLs permanent while allowing granular date-based schema pinning. - Additive Evolution (Non-Breaking): Adding new optional response fields does not require a version bump; only removing fields, renaming keys, or tightening required inputs requires a new major version.
Frequently Asked Questions (FAQ)
How should we communicate API deprecation to developers?
Include standard HTTP Deprecation and Sunset headers (RFC 8594) on responses from older API versions at least 6 months prior to retirement, pointing to migration documentation via a Link header.