← Back to Blog

API Versioning: URL Path, Header, and Query Parameter Approaches

April 25, 2026 3 min read By CodeTidy Team

The API Versioning Conundrum: Choosing the Right Strategy

We've all been there - stuck with a legacy API, struggling to make changes without breaking existing integrations. One of the most critical decisions in API design is versioning. A well-planned versioning strategy ensures that your API remains maintainable, scalable, and easy to evolve. But with multiple approaches to choose from, which one is right for your project?

Table of Contents

  • API Versioning: Why Bother?
  • URL Path Versioning: The Most Common Approach
  • Header-Based Versioning: Using the Accept Header
  • Query Parameter Versioning: A Flexible but Risky Approach
  • Stripe's Date-Based Versioning: A Real-World Example
  • Key Takeaways
  • FAQ

API Versioning: Why Bother?

API versioning is essential for several reasons. It allows you to:

  • Make backward-incompatible changes without breaking existing integrations
  • Introduce new features or endpoints without affecting older versions
  • Deprecate outdated endpoints or features without disrupting users

Without a proper versioning strategy, you'll be forced to make difficult choices between maintaining compatibility and moving forward with your API.

URL Path Versioning: The Most Common Approach

The most widely used approach is to include the version number in the URL path. This method is straightforward and easy to implement.

GET /v1/users
GET /v2/users

In this example, the v1 and v2 paths indicate different versions of the /users endpoint. This approach is easy to understand and works well for most use cases. However, it can lead to a proliferation of URLs and make it harder to manage your API.

Header-Based Versioning: Using the Accept Header

Another approach is to use the Accept header to specify the version. This method is more flexible than URL path versioning and allows for more fine-grained control.

GET /users
Accept: application/vnd.example.v1+json

In this example, the Accept header specifies the version of the API that the client expects. This approach is more elegant than URL path versioning but requires more effort from the client-side.

Query Parameter Versioning: A Flexible but Risky Approach

Query parameter versioning involves passing the version as a query parameter. This approach is flexible but can be error-prone.

GET /users?version=1
GET /users?version=2

While this method provides a lot of flexibility, it can lead to issues with caching and makes it harder to manage your API.

Stripe's Date-Based Versioning: A Real-World Example

Stripe, a popular payment gateway, uses a date-based versioning strategy. Instead of using a version number, they use a date to indicate the version of the API.

GET /users?version=2022-01-01

This approach allows Stripe to make changes to their API without breaking existing integrations. They can also easily deprecate older versions by removing support for older dates.

Key Takeaways

  • API versioning is essential for maintaining a scalable and maintainable API
  • URL path versioning is the most common approach but can lead to a proliferation of URLs
  • Header-based versioning is more flexible but requires more effort from the client-side
  • Query parameter versioning is flexible but error-prone
  • Stripe's date-based versioning is a real-world example of a scalable versioning strategy

FAQ

Q: What is the most common API versioning approach?

A: URL path versioning is the most widely used approach.

Q: What are the tradeoffs of using header-based versioning?

A: Header-based versioning requires more effort from the client-side but provides more fine-grained control.

Q: Is query parameter versioning a good approach?

A: Query parameter versioning is flexible but can lead to issues with caching and makes it harder to manage your API. We recommend avoiding this approach.

AI agent tools available. The CodeTidy MCP Server gives Claude, Cursor, and other AI agents access to 60+ developer tools. One command: npx @codetidy/mcp