Jonas Weber·
Pointed it at my Express routes and walked away with full OpenAPI 3.0 docs in minutes
Generates comprehensive OpenAPI/Swagger-style documentation from code or API route definitions with examples and error schemas.
Auto-Generate API Documentation
You are a technical writer specializing in API documentation. Generate comprehensive API documentation for the following endpoints.
## API Code / Route Definitions
```{{programming_language}}
{{api_code}}
```
## Documentation Requirements
- Format: {{doc_format}} (e.g., OpenAPI 3.0, Markdown, Postman collection)
- Base URL: {{base_url}}
- Authentication: {{auth_method}}
- Generate for each endpoint:
* Endpoint path with HTTP method
* Clear description of what it does
* Complete request schema with types, required/optional, validation rules
* 2-3 example request bodies (typical case, edge case, error case)
* Response schema with status codes (200, 400, 401, 403, 404, 500)
* Example response bodies for each status code
* Query parameters and headers with descriptions
* Rate limiting notes if applicable
Include a table of contents at the top. Ensure all schemas are valid {{doc_format}}. Add 'Changelog' and 'Error Codes Reference' sections.
Ergebnisse
# Orders API Documentation
## Table of Contents
- [Authentication](#authentication)
- [POST /orders](#post-orders)
- [Error Codes Reference](#error-codes-reference)
- [Changelog](#changelog)
**Base URL:** `https://api.shopflow.io/v1`
**Authentication:** Bearer token in `Authorization` header.
## POST /orders
Creates a new order for the authenticated customer.
**Request body**
| Field | Type | Required | Validation |
|-------|------|----------|------------|
| `items` | array | yes | min 1 item |
| `items[].sku` | string | yes | matches `^SKU-\d{6}$` |
| `items[].qty` | integer | yes | 1–99 |
| `couponCode` | string | no | max 24 chars |
**Example (typical)**
```json
{ "items": [{ "sku": "SKU-004521", "qty": 2 }], "couponCode": "LAUNCH10" }
```
**Responses**
| Status | Meaning | Body |
|--------|---------|------|
| 201 | Created | `{ "id": "ord_8f2", "total": 4198 }` |
| 400 | Validation failed | `{ "error": "qty out of range" }` |
| 401 | Missing/expired token | `{ "error": "unauthorized" }` |
| 409 | Duplicate idempotency key | `{ "error": "order exists" }` |
## Error Codes Reference
`E_SKU_NOT_FOUND`, `E_OUT_OF_STOCK`, `E_COUPON_EXPIRED`.
## Changelog
- **v1.2** — added `couponCode`. **v1.1** — idempotency keys.
Modell: Claude Sonnet 4
89 Likes35 SavesScore: 46
6 Kommentare
Emily Chen·
The error handling is the part most examples skip. Nice to see it done right.
Ahmed Hassan·
Great structure, though I'd add a retry cap. Still, super useful.
Ryan Mitchell·
How does this hold up under concurrency? Looks thread-safe to me but curious.
Lena Fischer·
Been looking for a solid code generation prompt for ages, this is it.
Luca Brunner·
Bookmarked. The migration steps are exactly the safe order I'd want.
Daniel Cohen·
This made my PR review 20 minutes shorter. Appreciate it.