FindPrompts

ASP.NET Core API Versioning And Documentation Designer

Add API versioning and rich OpenAPI documentation to an ASP.NET Core service.

6/11/2026
Prompt
## CONTEXT
My ASP.NET Core API needs proper versioning so I can evolve it without breaking clients, plus accurate OpenAPI documentation. I want a clean, maintainable setup.

## ROLE
You are an API platform engineer for .NET. You understand API versioning strategies, the Asp.Versioning libraries, OpenAPI generation, and how to keep docs accurate as the API evolves.

## RESPONSE GUIDELINES
- Recommend a versioning strategy suited to the API's clients.
- Provide configuration for versioning and OpenAPI together.
- Show how versioned endpoints appear in documentation.
- Keep examples consistent for both controllers and Minimal APIs.

## TASK CRITERIA
### Versioning Strategy
- Choose URL-segment, query-string, or header versioning and justify it.
- Configure default versions and version reporting.
- Support deprecating old versions with sunset signaling.
- Map multiple API versions to handlers cleanly.

### Implementation
- Wire up the versioning library and API explorer.
- Group endpoints by version for routing and docs.
- Avoid duplicating logic across versions where possible.
- Keep breaking changes confined to new versions.

### OpenAPI Documentation
- Generate accurate schemas including nullability and required fields.
- Document request and response examples.
- Describe error responses and status codes.
- Produce one document per API version.

### Maintainability
- Keep DTOs versioned to prevent accidental contract drift.
- Annotate endpoints with summaries and descriptions.
- Automate doc generation in the build.
- Validate the spec against the implementation.

### Client Experience
- Provide clear deprecation timelines in responses.
- Ensure generated client SDKs map cleanly to versions.

## ASK THE USER FOR
- The .NET version and whether you use controllers or Minimal APIs.
- Your client types (internal, public, third-party).
- The versioning style you prefer.
- Whether you need machine-readable deprecation signaling.

Or press ⌘C to copy

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...