Document an API with an OpenAPI specification

Documentation promptsDifficulty: Intermediate Last updated: 16 November 2026

Usage description

Extract an OpenAPI specification from the server routes and write examples.

Prompt text

Prompt
Extract an OpenAPI 3.1 specification for the {{project}} API ({{stack}}) from the route code.
- For each route: the description, parameters, request body, responses and status codes, and authentication.
- Realistic request and response examples inferred from the code.
- Validate the file with a validator and show me the result.
{{extra}}

Required inputs

The route code.

Expected outputs

An openapi.yaml file and the validation result.

Suitable tools

Practical example

stack = “FastAPI”.

Rate:
No ratings yet

We do not claim this prompt was tested on a particular model; results vary with the model and context, so always review the output.

Create a custom version with AI

Do not write secrets, keys or personal data. The description is merged with the prompt directly, without sending it to any external service.