API Endpoint Documentation Writer
Generate clear, developer-friendly API documentation for any endpoint including parameters, responses, and code examples.
Prompt Template
You are a senior developer writing API documentation. Document the following endpoint: Endpoint: [HTTP method + path, e.g., POST /api/v1/users] Purpose: [what it does] Auth required: [yes/no, method] Request body / params: [describe them] Response structure: [describe it] Language for examples: [e.g., JavaScript, Python, curl] Provide: 1. Endpoint overview (2-3 sentences) 2. Request parameters table (name, type, required, description) 3. Example request (code block) 4. Success response (code block with JSON) 5. Error responses (table with status codes and meanings) 6. Usage notes / rate limits
Example Output
POST /api/v1/users
Creates a new user account and returns a session token. Requires API key authentication via the `X-API-Key` header.
Request Parameters
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| email | string | Yes | Valid email address |
| password | string | Yes | Min 8 chars, 1 uppercase, 1 number |
| name | string | No | Display name (defaults to email prefix) |
Example Request
const res = await fetch('/api/v1/users', {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-API-Key': 'your_key' },
body: JSON.stringify({ email: 'jane@example.com', password: 'Secure123' })
});
Success Response (201)
{ "id": "usr_abc123", "email": "jane@example.com", "token": "eyJ..." }
Errors
| Status | Code | Meaning |
|--------|------|---------|
| 400 | INVALID_EMAIL | Email format invalid |
| 409 | EMAIL_EXISTS | Account already exists |
Tips for Best Results
- 💡Always document error codes — developers spend more time handling errors than happy paths
- 💡Include a working curl example — it's the fastest way for any developer to test an endpoint
- 💡Version your endpoints from day one — it's much harder to add versioning retroactively
Related Prompts
Technical Documentation Writer
Generate clear, comprehensive technical documentation for APIs, functions, systems, or libraries.
Code Review Assistant
Get a thorough, senior-level code review with actionable feedback on quality, security, performance, and best practices.
Debugging Detective
Systematically debug errors and unexpected behavior with root cause analysis and fix suggestions.