Prompt

API Documentation Generator

documentationapiopenapi

API Documentation Generator: Professional Docs in Minutes

Good API documentation is the difference between a developer-friendly API and a frustrating one. This tool generates comprehensive, professional documentation for any API endpoint.

Full Prompt
Generate production-quality API endpoint documentation that is complete enough for a developer to integrate without reading source code.

DOCUMENTATION STANDARDS:

1. Endpoint Overview
   - Write a concise description of what the endpoint does and when to use it
   - State the authentication requirement (Bearer token, API key, none, etc.)
   - Note the rate limit if relevant
   - Specify the API version or base URL context if applicable

2. Request Specification
   - Document every parameter: path params, query params, headers, and request body fields
   - For each parameter: name, type, required/optional, constraints (min/max, regex, enum values), and a human-readable description
   - Mark default values explicitly
   - Provide a complete, realistic example request (cURL and/or language-specific) with all headers

3. Response Specification
   - Document the success response with full schema: field names, types, descriptions, and nesting
   - Include a realistic example response body with plausible data (not "string" or "123")
   - Document pagination structure if the endpoint returns a list

4. Error Documentation
   - List every possible error status code this endpoint can return
   - For each: HTTP status, error code/slug, human-readable message, and when/why it occurs
   - Include an example error response body
   - Document validation error format for 400 responses

5. Usage Notes
   - Call out any non-obvious behavior, side effects, or idempotency guarantees
   - Document related endpoints that are commonly used together
   - Note any fields that may be deprecated or will change

OUTPUT CONSTRAINTS:
- Use consistent, scannable formatting throughout
- Every field in request and response schemas must be documented (no "and other fields")
- Example values must be realistic and internally consistent (e.g., IDs in request should match response)
- If information is missing from MY INFO, make reasonable assumptions and mark them clearly with [ASSUMED]

FORMAT:
# [METHOD] [PATH]
[Description]

## Authentication
[Auth details]

## Request
### Path Parameters
| Parameter | Type | Required | Description |
### Query Parameters
| Parameter | Type | Default | Description |
### Request Body
```json
[schema with comments]
```

## Response
### Success (200/201)
```json
[example response]
```

### Field Descriptions
| Field | Type | Description |

## Errors
| Status | Code | Description | When |

## Example
```bash
curl ...
```

## Notes
[Behavioral notes, side effects, related endpoints]

---

MY INFO:

Method (GET/POST/PUT/DELETE): (required)

Path (/api/...): (required)

Request Body Schema: (required for POST/PUT, optional for GET/DELETE)

Response Schema: (required)

Authentication Type: (optional)

Endpoint Description: (optional)

Error Scenarios to Document: (optional)

Documentation Components

Endpoint Description: Clear explanation of what the endpoint does Parameters: Path, query, and header parameters with types Request Body: Schema with examples Response Body: Success and error response formats Error Codes: HTTP status codes with explanations

Output Formats

  • Markdown (for GitHub, GitBook)
  • OpenAPI/Swagger specification
  • HTML documentation
  • Postman collection compatible

Best Practices

  1. Be specific: Document exact data types and constraints
  2. Include examples: Real-world request/response samples
  3. Document errors: All possible error responses
  4. Version your docs: Keep docs in sync with API versions

Create documentation your developers will actually want to read.