📚 Documentation in Minutes, Not Days
Writing API docs manually takes forever. AI reads your code and generates complete documentation with examples.
The Documentation Prompt
Generate comprehensive API documentation for this codebase: [Paste controllers/routes/API code] Include: 1. Endpoint descriptions (what each does) 2. HTTP methods and paths 3. Request parameters (query, body, headers) 4. Request body schemas with types 5. Response schemas (success and error) 6. Status codes (200, 400, 401, 404, 500) 7. Authentication requirements 8. Example requests (curl and JavaScript) 9. Example responses (JSON) 10. Rate limiting info if applicable Format as Markdown with clear sections. Make it ready for README.md or documentation site.
Example Output Quality
## Create User
**POST** `/api/users`
Creates a new user account.
### Authentication
Requires API key in header: `X-API-Key`
### Request Body
```json
{
"name": "string (required, 2-50 chars)",
"email": "string (required, valid email)",
"role": "string (optional, default: 'user')",
"age": "number (optional, 18+)"
}
```
### Response (201 Created)
```json
{
"id": "uuid",
"name": "John Doe",
"email": "john@example.com",
"role": "user",
"createdAt": "2024-03-19T10:30:00Z"
}
```
### Error Responses
- **400 Bad Request**: Invalid input
- **401 Unauthorized**: Missing/invalid API key
- **409 Conflict**: Email already exists
- **500 Server Error**: Internal error
### Example Request
```bash
curl -X POST https://api.example.com/api/users \
-H "Content-Type: application/json" \
-H "X-API-Key: your_key_here" \
-d '{"name":"John Doe","email":"john@example.com"}'
```
### Example JavaScript
```javascript
const response = await fetch('https://api.example.com/api/users', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your_key_here'
},
body: JSON.stringify({
name: 'John Doe',
email: 'john@example.com'
})
});
const data = await response.json();
```
Advanced: Generate OpenAPI Spec
Convert this API code to OpenAPI 3.0 specification: [Paste code] Generate complete openapi.yaml with: - All endpoints - Request/response schemas - Authentication schemes - Example values - Descriptions Make it importable to Swagger/Postman.
🎯 Documentation Types
- API Reference: Complete endpoint documentation
- Getting Started Guide: Quick start tutorial
- SDK Documentation: Client library usage
- Error Handling Guide: All error codes explained
- Webhooks Docs: Webhook payload examples
💡 Pro Tips
- Update regularly: Regenerate docs when API changes
- Add context: Include “This is a payment processing API” in prompt
- Request examples in multiple languages: curl, JavaScript, Python, etc.
- Ask for diagrams: “Include mermaid diagram of authentication flow”
“Had 47 API endpoints, zero documentation. Used AI to generate complete docs in 30 minutes. Added examples, error codes, everything. Partners can finally integrate without asking questions.”
