api-versioning
Use when planning API versioning strategy, handling breaking changes, or managing API deprecation. Covers URL, header, and query parameter versioning approaches.
What this skill does
# API Versioning
Strategies for versioning APIs, managing breaking changes, and deprecating old versions gracefully.
## When to Use This Skill
- Choosing an API versioning strategy
- Planning for breaking changes
- Deprecating API versions
- Managing multiple API versions
- Designing for API evolution
## Why Version APIs?
```text
APIs are contracts with clients.
Breaking changes break clients.
Without versioning:
- Change field name → All clients break
- Remove endpoint → All clients break
- Change behavior → Unexpected client behavior
With versioning:
- Old clients use old version
- New clients use new version
- Gradual migration possible
```
## Versioning Strategies
### URL Path Versioning
```text
https://api.example.com/v1/users
https://api.example.com/v2/users
Pros:
- Clear and explicit
- Easy to understand
- Easy to route
- Easy to cache
Cons:
- Version embedded in client code
- Multiple URLs for same resource
- Not truly RESTful (URL should identify resource)
```
### Header Versioning
```text
GET /users
Accept: application/vnd.example.v1+json
or custom header:
GET /users
API-Version: 1
Pros:
- Clean URLs
- More RESTful
- Version separate from resource
Cons:
- Hidden from URL
- Harder to test in browser
- Requires header support
```
### Query Parameter Versioning
```text
GET /users?version=1
GET /users?api-version=2023-01-01
Pros:
- Easy to add
- Optional (can default)
- Easy to test
Cons:
- Can be forgotten
- Pollutes query string
- Caching complexity
```
### Content Negotiation
```text
Accept: application/vnd.example+json; version=1
Pros:
- Standard HTTP mechanism
- Flexible
Cons:
- Complex to implement
- Hard to discover
```
## Strategy Comparison
| Strategy | Visibility | Implementation | Caching | Recommendation |
| -------- | ---------- | -------------- | ------- | -------------- |
| URL Path | High | Easy | Easy | Best for public APIs |
| Header | Low | Medium | Medium | Good for internal APIs |
| Query Param | Medium | Easy | Complex | Good for simple cases |
| Content Neg | Low | Complex | Medium | Rarely used |
## Versioning Schemes
### Integer Versions
```text
v1, v2, v3
Pros: Simple, clear major changes
Cons: Coarse-grained
Best for: Public APIs with infrequent breaking changes
```
### Semantic Versioning
```text
v1.2.3 (major.minor.patch)
Major: Breaking changes
Minor: New features (backward compatible)
Patch: Bug fixes
Pros: Fine-grained, predictable
Cons: More complex
Best for: Libraries, SDKs
```
### Date-Based Versioning
```text
2023-01-15, 2023-06-01
Pros: Clear when version was current
Cons: Doesn't indicate change magnitude
Best for: Frequently changing APIs (Stripe, GitHub)
Example (Stripe):
Stripe-Version: 2023-10-16
```
## What Requires a New Version?
### Breaking Changes (New Major Version)
```text
Always breaking:
- Removing endpoint
- Removing field
- Changing field type
- Changing field meaning
- Renaming field
- Adding required field
- Changing authentication
- Changing error format
```
### Non-Breaking Changes (No Version Needed)
```text
Safe changes:
- Adding new endpoint
- Adding optional field
- Adding new enum value
- Adding optional parameter
- Relaxing validation
- Adding new error codes
```
## Version Management
### Running Multiple Versions
```text
Option 1: Separate codebases
/v1/* → v1 service
/v2/* → v2 service
Pros: Full isolation
Cons: Duplication, maintenance burden
Option 2: Shared codebase with branching
if (version == 1) {
return formatV1(data);
} else {
return formatV2(data);
}
Pros: Single codebase
Cons: Code complexity grows
Option 3: Transformation layer
Internal model → Version-specific transformer → Response
Pros: Clean separation
Cons: Requires transformation code
```
### Version Routing
```text
API Gateway pattern:
Client → Gateway → Route by version → Service
Gateway responsibilities:
- Parse version from URL/header
- Route to appropriate backend
- Transform if needed
- Handle defaults
```
## Deprecation Strategy
### Lifecycle Phases
```text
1. Current: Active development
2. Maintained: Bug fixes only
3. Deprecated: No changes, sunset announced
4. Sunset: Removed
Timeline example:
v1: Current (12 months)
v1: Maintained when v2 launches (6 months)
v1: Deprecated (6 months)
v1: Sunset
```
### Deprecation Communication
```text
Headers:
Deprecation: true
Sunset: Sat, 1 Jul 2024 00:00:00 GMT
Link: <https://api.example.com/v2/docs>; rel="successor-version"
Response body:
{
"data": {...},
"_deprecation": {
"message": "This API version is deprecated",
"sunset": "2024-07-01",
"successor": "https://api.example.com/v2"
}
}
```
### Migration Support
```text
Provide:
1. Migration guide documenting all changes
2. Mapping of old → new endpoints
3. Code examples for common operations
4. SDK updates with compatibility layer
5. Sandbox environment for testing
```
## Best Practices
### Default Version
```text
Options:
1. Require explicit version (recommended for public APIs)
2. Default to latest (dangerous for stability)
3. Default to oldest supported (conservative)
Recommendation: Require version, fail without it
```
### Version in Response
```text
Include version info in responses:
{
"data": {...},
"_meta": {
"api_version": "v2",
"deprecated": false
}
}
```
### Graceful Degradation
```text
When version unknown:
1. Return error with supported versions
2. Redirect to documentation
3. Return latest version with warning
HTTP 400 Bad Request
{
"error": "Unknown API version",
"supported_versions": ["v1", "v2"],
"documentation": "https://docs.example.com/api"
}
```
### Testing Multiple Versions
```text
Test matrix:
- All supported versions
- Breaking change boundaries
- Deprecation warnings
- Sunset behavior
Automated tests:
- Contract tests per version
- Backward compatibility tests
- Migration path tests
```
## Real-World Examples
### Stripe
```text
Date-based: 2023-10-16
Header: Stripe-Version
Default: Account's API version
Rollback: Can pin to older version
Upgrades: Preview in dashboard
```
### GitHub
```text
Date-based: 2022-11-28
Header: X-GitHub-Api-Version
Default: Latest
Preview features: Accept header
```
### Google
```text
URL path: /v1/, /v2/
Discovery document for each version
Long deprecation cycles (years)
```
### Twilio
```text
Date-based: 2010-04-01
URL path includes date
Very long support windows
```
## Anti-Patterns
```text
1. Too many versions
→ Consolidate, set deprecation schedule
2. Breaking changes in minor versions
→ Follow semantic versioning strictly
3. No deprecation warnings
→ Always communicate before breaking
4. Instant sunset
→ Give clients time to migrate (6-12 months minimum)
5. Version per endpoint
→ Keep all endpoints in sync per version
```
## Related Skills
- `api-design-fundamentals` - API design patterns
- `idempotency-patterns` - Safe API operations
- `quality-attributes-taxonomy` - Maintainability attributes
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.