🔌

API Versioning Strategy

Design and implement an API versioning strategy for backward compatibility

prompt template
Design an API versioning strategy for:

**API type:** [TYPE — e.g., "REST API with 50+ endpoints"]
**Consumers:** [CONSUMERS — e.g., "mobile app, web app, third-party integrations"]
**Change frequency:** [FREQUENCY — e.g., "breaking changes every 3-6 months"]

Compare and recommend between:
1. **URL versioning** (/v1/users, /v2/users)
2. **Header versioning** (Accept: application/vnd.api+json;version=2)
3. **Query parameter** (?version=2)

Then generate:
1. **Version routing** — middleware that routes to correct handler version
2. **Deprecation policy** — sunset headers, deprecation timeline, migration guides
3. **Backward compatibility** — additive changes that don't need a new version
4. **Version negotiation** — how clients specify preferred version
5. **Documentation** — OpenAPI spec with multiple version support
6. **Migration tooling** — automated client-side migration helpers

Include the routing middleware and deprecation header implementation.

How to Use This Prompt

  1. 1Copy the prompt template above
  2. 2Paste into Claude, ChatGPT, or Cursor
  3. 3Replace [bracketed placeholders] with your specific project details
  4. 4Iterate on the AI output to refine and customize the results