api-versioning

Implements API versioning strategies, deprecation policies, and breaking change management in FastAPI.

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/Dazlarus/karl-code --skill api-versioning-dazlarus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: api-versioning
Source: https://github.com/Dazlarus/karl-code/tree/main/.agents/skills/api-versioning
Command: npx skills add https://github.com/Dazlarus/karl-code --skill api-versioning-dazlarus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Evolving an API without breaking existing clients is hard: teams need structured versioning strategies, clear deprecation timelines, and documented migration paths to avoid breaking consumers. ## Core Features & Use Cases - URI and Header Versioning: Route requests to v1/v2 handlers using URL path prefixes or request headers in FastAPI. - Deprecation Management: Add deprecation and sunset headers with successor-version links so clients know when endpoints retire. - Breaking Change Documentation: Apply semantic versioning rules and document added, changed, deprecated, and removed behavior per release. - Use Case: When shipping a new user endpoint response format, create a /api/v2 route, mark /api/v1 as deprecated with a sunset date, and publish a migration guide so consumers upgrade on their own schedule. ## Quick Start Use the api-versioning skill to design a v2 endpoint with a deprecation plan for the existing v1 users endpoint.

Frequently Asked Questions about api-versioning

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I version a REST API in FastAPI?

Create separate APIRouter instances with prefixes like /api/v1 and /api/v2, then define version-specific handlers on each router. Alternatively, read an api_version header and route requests to the appropriate handler logic.

URI versioning vs header versioning for APIs?

URI versioning puts the version in the path (e.g., /api/v2/users), making versions explicit and easy to route. Header versioning keeps URLs stable and selects behavior via an api_version request header, but is less visible to consumers.

How do I deprecate an API endpoint without breaking clients?

Mark the endpoint deprecated and return X-API-Deprecated and X-API-Sunset headers with a removal date, plus a Link header pointing to the successor version. Give consumers a documented migration path before removal.

When should I bump the major version of an API?

Bump the major version when introducing incompatible changes such as altered response formats or newly required authentication. Backwards-compatible additions increment the minor version, and bug fixes increment the patch version.

When should I not use API versioning?

Skip versioning for simple API design or internal function changes where a single evolving contract suffices. Versioning adds routing and maintenance overhead that is only justified when external consumers depend on stable contracts.