API Documentation from Code
Generate complete API docs from your route handler — with realistic examples and a working curl command.
documentationapidevelopmentchatgpt
Prompt
Generate API documentation for this endpoint:
```
{{paste your route handler code}}
```
Format as a markdown section with:
1. **Endpoint:** METHOD /path
2. **Description:** One sentence explaining what it does
3. **Authentication:** Required / Optional / None
4. **Request:**
- Headers (if any)
- URL parameters
- Query parameters
- Request body (JSON schema with types and examples)
5. **Response:**
- Success response (status code + JSON example with realistic data)
- Error responses (each possible error code with example)
6. **Example:** Complete curl command that works
Use realistic data in examples (not "string" or "example"). For a user endpoint, use "jane.doe@company.com", not "user@example.com".Variables to customize
{{paste your route handler code}}
Why this prompt works
'Realistic data, not placeholder strings' produces documentation that developers can actually test with. The curl example makes the endpoint immediately testable.
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Code Review Assistant
Get thorough code reviews with actionable feedback tailored to your language, framework, and standards.
Code Review with Specific CriteriaGet focused code review feedback with numbered criteria that works on both ChatGPT and Claude.
Explain Complex CodeGet a clear, leveled explanation of any code snippet — calibrated to your experience level.
Debug with ContextSystematic debugging prompt that includes context, error details, and what you've already tried.