Turn an OpenAPI document or annotated endpoints into reference documentation with endpoint details, authentication, schemas, status codes and copyable curl examples, flagging gaps in the source.
Generate REST API reference documentation from the API definition below. Document only what the definition states; list missing or inconsistent information as gaps for the API owner instead of filling it in. ## Inputs API definition: OpenAPI (JSON or YAML) or code annotations: [API_DEFINITION] Base URL(s) and environments: [BASE_URLS] Authentication method and how to obtain credentials: [AUTH] Audience (internal developers, partners, public): [AUDIENCE] Output format (Markdown, HTML, or input for a docs tool such as Redocly or Swagger UI): [OUTPUT_FORMAT] Code sample languages wanted: [SAMPLE_LANGUAGES] ## Instructions 1. Parse paths, methods, parameters (path, query, header), request bodies, responses and components. Resolve every `$ref`; report references that do not resolve. 2. Write an overview: purpose, base URLs, authentication, common errors, pagination and versioning if defined. 3. For each endpoint document: - path and HTTP method, summary and description; - parameters with type, required flag, constraints and description; - request body schema and example; - responses for each status code with schema and example; - authentication and scopes required; - copyable `curl` example (plus [SAMPLE_LANGUAGES]) using placeholder credentials. 4. Generate examples that conform to the schemas; prefer `example`/`examples` values from the definition. 5. Group endpoints by tag and add a table of contents. 6. If the definition is large, document it tag by tag and keep anchors stable. ## Return 1. Documentation in [OUTPUT_FORMAT]. 2. A gaps report: endpoints without descriptions, undocumented error responses, missing auth requirements, schemas without examples, unresolved references. 3. Optionally, the normalized definition as JSON or YAML for other tools. ## Acceptance checks - Every documented parameter, field and status code exists in the definition. - Every example validates against its schema. - No real tokens or keys appear in examples. - Gaps are reported rather than invented.
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
API definition (OpenAPI 3.0 YAML):
paths:
/users:
get:
summary: Retrieve a list of users
description: Returns a list of all users in the system
responses:
'200': {description: A JSON array of user objects, content: {application/json: {schema: {type: array, items: {$ref: '#/components/schemas/User'}}}}}
'500': {description: Unexpected error, content: {application/json: {schema: {$ref: '#/components/schemas/Error'}}}}
components:
schemas:
User: {type: object, properties: {id: {type: integer}, name: {type: string}, email: {type: string}}}
Error: {type: object, properties: {code: {type: integer}, message: {type: string}}}
Base URL: https://api.example.com/v1
Auth: bearer token from the developer portal
Audience: partners
Output: Markdown
Samples: curl and JavaScript fetchMarkdown with an overview, a GET /users section listing no parameters, a 200 response as an array of User and a 500 response with Error, a curl example with Authorization: Bearer <TOKEN> against https://api.example.com/v1/users and a fetch equivalent, and a gaps report noting that the definition has no security scheme even though bearer auth was supplied, no pagination for a list of "all users", no 401/403 responses, and no examples (so generated examples are marked as synthesized). Illustrative expectation; resolution of both $ref targets in this YAML was checked locally (see report).
Ask questions or share concrete improvements.
No comments yet.
Sign in to join the discussion.
Guides for adapting and checking prompts: