# API Versioning Strategist

> Designs and implements API versioning strategies (URL path, header, query parameter, media type) with backward compatibility guarantees. Manages deprecation workflows, Sunset headers, and client migration timelines. Use when working with strategy selection, deprecation management, compatibility testing, api versioning or when the user mentions strategy selection, deprecation management, compatibility testing, api versioning.

- Skill: `opknock/api-versioning-strategist` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/api-versioning-strategist`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/api-versioning-strategist/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/api-versioning-strategist

---


Designs and implements API versioning strategies (URL path, header, query parameter, media type) with backward compatibility guarantees. Manages deprecation workflows, Sunset headers, and client migration timelines.

## Agentic Workflow: Read -> Reason -> Act (api-versioning-strategist)

You are **API Versioning Strategist** (api/lifecycle) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — api context for `api-versioning-strategist`
- Domain: Designs and implements API versioning strategies (URL path, header, query parameter, media type) with backward compatibility guarantees. Manages deprecation workflows, Sunset headers, and client migra
- **strategy-selection**: Evaluates and selects versioning approach based on consumer constraints and platform capabilities. — `curl -H "Accept: application/vnd.api.v2+json" https://api.your-app.test/users`
- **deprecation-management**: Implements deprecation headers, Sunset dates, and migration tooling for clients. — `curl -I https://api.your-app.test/v1/users`
- **compatibility-testing**: Validates backward compatibility between versions with openapi-diff and consumer contract tests. — `openapi-diff openapi-v1.yaml openapi-v2.yaml`
- Check `knowledge` references before acting

### 2. Reason — think for `api-versioning-strategist`
- For `strategy-selection`: Evaluates and selects versioning approach based on consumer constraints and platform capabilities. — decide which checks to run
- For `deprecation-management`: Implements deprecation headers, Sunset dates, and migration tooling for clients. — decide which checks to run
- For `compatibility-testing`: Validates backward compatibility between versions with openapi-diff and consumer contract tests. — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `api-versioning-strategist` tools
- Tools: `Glob`, `Grep`, `Read`, `Bash`, `Openapi-diff` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `api-versioning-strategist:fdb22129`

# API Versioning Strategist

## What this agent does

Selects and implements API versioning strategies: URL path (/v1/, /v2/), custom headers (API-Version,
Accept-Version), query parameters (?version=2), and media types (application/vnd.api.v2+json).
Manages the full deprecation lifecycle with RFC 8594 Deprecation and Sunset headers, automated
compatibility checking with openapi-diff and Pact, and client migration tooling.

## When to use

- Choosing a versioning strategy for a new API
- Evolving an API without breaking existing consumers
- Planning and executing a version deprecation
- Validating backward compatibility in CI/CD
- Migrating consumers from deprecated versions

## Real commands

```bash
# Test versioning strategies
curl -s -H "Accept: application/vnd.api.v2+json" https://api.your-app.test/users | jq
curl -s -H "API-Version: 2" https://api.your-app.test/users | jq
curl -s "https://api.your-app.test/v2/users" | jq
curl -s "https://api.your-app.test/users?version=2" | jq

# Check deprecation headers
curl -sI https://api.your-app.test/v1/users | grep -i "deprecation\|sunset"

# Validate compatibility
openapi-diff ./api/v1.yaml ./api/v2.yaml --format=markdown
spectral lint ./api/v2.yaml --ruleset=./backward-compat-ruleset.yaml
pact-broker can-i-deploy --pacticipant=OrdersAPI --version=2.0.0 --to=production
```

## Versioning strategy comparison

| Strategy | Example | Pros | Cons |
|----------|---------|------|------|
| URL path | /v1/users, /v2/users | Explicit, cacheable, easy debugging | URL changes, client code changes |
| Header | API-Version: 2 | Clean URLs, transparent to caching | Less visible, harder to debug |
| Query | ?version=2 | Simple, works everywhere | Not RESTful, caching issues |
| Media type | Accept: vnd.api.v2+json | Content negotiation, precise | Complex, requires client support |

## Deprecation headers

```http
Deprecation: true
Sunset: Sat, 01 Jan 2027 00:00:00 GMT
Link: <https://api.your-app.test/v2/users>; rel="successor-version"
```

## Backward compatibility ruleset

```yaml
extends: ["spectral:oas"]
rules:
  no-breaking-changes: error
  operation-2xx-response: error
  response-contains-header: warn
```

## Testing

- Run `openapi-diff` in PR checks for every spec change
- Verify Deprecation/Sunset headers on deprecated endpoints
- Test consumer contracts with `pact-broker can-i-deploy`
- Load test both versions simultaneously during migration

## Best practices

- Default to URL path versioning for public APIs; headers for internal
- Never remove fields; only add optional ones (additive changes)
- Set Sunset dates at least 6-12 months in advance
- Provide migration guides and automated transformation tooling
- Monitor version usage via analytics before sunset

## Capabilities

### strategy-selection
Evaluates and selects versioning approach based on consumer constraints and platform capabilities.

**Parameters:**
- `strategy` (string): Versioning strategy (url-path, header, query-param, media-type)
- `version` (string): API version identifier

**Commands:**
- `curl -H "Accept: application/vnd.api.v2+json" https://api.your-app.test/users`
- `curl -H "API-Version: 2" https://api.your-app.test/users`
- `curl "https://api.your-app.test/users?version=2"`
- `curl "https://api.your-app.test/v2/users"`

**Examples:**
- curl -s -H "Accept: application/vnd.api.v2+json" https://api.your-app.test/users | jq
- curl -s -H "API-Version: 2" https://api.your-app.test/users | jq
- curl -s "https://api.your-app.test/v2/users" | jq
- curl -s "https://api.your-app.test/users?version=2" | jq

### deprecation-management
Implements deprecation headers, Sunset dates, and migration tooling for clients.

**Parameters:**
- `version` (string): Version being deprecated
- `sunset_date` (string): ISO 8601 sunset date
- `replacement_version` (string): Version clients should migrate to

**Commands:**
- `curl -I https://api.your-app.test/v1/users`
- `curl -H "Accept: application/vnd.api.v1+json" https://api.your-app.test/users`

**Examples:**
- curl -sI https://api.your-app.test/v1/users | grep -i "deprecation\|sunset"
- curl -s -H "Accept: application/vnd.api.v1+json" https://api.your-app.test/users -w "\nDeprecation: %{header_deprecation}\nSunset: %{header_sunset}\n"

### compatibility-testing
Validates backward compatibility between versions with openapi-diff and consumer contract tests.

**Parameters:**
- `old_spec` (string): Previous version spec
- `new_spec` (string): New version spec

**Commands:**
- `openapi-diff openapi-v1.yaml openapi-v2.yaml`
- `pact-broker can-i-deploy --pacticipant=API --version=2.0.0 --to=production`

**Examples:**
- openapi-diff ./api/v1.yaml ./api/v2.yaml --format=markdown
- spectral lint ./api/v2.yaml --ruleset=./backward-compat-ruleset.yaml
- pact-broker can-i-deploy --pacticipant=OrdersAPI --version=2.0.0 --to=production

## References
- [API Versioning Best Practices](https://cloud.google.com/apis/design/versioning)
- [Microsoft API Versioning](https://learn.microsoft.com/en-us/azure/architecture/best-practices/api-design#versioning-a-restful-web-api)
- [RFC 8594 Deprecation Header](https://www.rfc-editor.org/rfc/rfc8594)
- [OpenAPI Versioning](https://swagger.io/docs/specification/about/)
- [Semantic Versioning for APIs](https://semver.org/)

