Prompt

How do I create versioned API docs for v1 and v2?

Technology / Documentation Tools1 observationLast seen Oct 16, 2026

Latest observation

Oct 16, 2026OpenAI APIWeb search: off

A common way to create versioned API docs is to expose separate documentation endpoints or sections for each API version, then keep the specs in sync with the corresponding code.

Good options

1) Separate OpenAPI specs per version

Create one OpenAPI document for v1 and another for v2:

  • /openapi/v1.json
  • /openapi/v2.json

Then serve docs UI for each:

  • /docs/v1
  • /docs/v2

This is the simplest and cleanest approach.

2) Version in the API path

If your API routes are versioned like:

  • /api/v1/users
  • /api/v2/users

then your docs should match that structure and show only the endpoints for that version.

3) Tag or group by version

If you use a single docs UI, group endpoints by version:

  • v1 Users
  • v2 Users

This works, but it can get messy if the versions diverge a lot.


Recommended structure

For OpenAPI

Maintain two specs:

# openapi-v1.yaml
openapi: 3.0.3
info:
  title: My API
  version: 1.0.0
paths:
  /api/v1/users:
    get:
      summary: List users
# openapi-v2.yaml
openapi: 3.0.3
info:
  title: My API
  version: 2.0.0
paths:
  /api/v2/users:
    get:
      summary: List users

Best practices

  • Keep v1 docs frozen except for critical corrections.
  • Add a deprecation notice to old versions.
  • Document breaking changes in v2.
  • Include changelogs or migration notes between versions.
  • Make sure examples match the actual request/response shapes for each version.

If you use Swagger UI

You can configure Swagger UI with a version selector, or run two instances:

  • swagger-ui?url=/openapi/v1.json
  • swagger-ui?url=/openapi/v2.json

If you want a single docs site

You can create a landing page like:

  • API Docs
    • v1 Documentation
    • v2 Documentation
    • Migration Guide

That’s often the nicest UX for developers.

If you tell me what stack you’re using (FastAPI, Express, NestJS, Spring, Django, etc.), I can show you the exact setup.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.