Generate comprehensive API documentation from endpoint descriptions or code with examples and error handling.
Copy & paste the prompt below into your preferred LLM. Unless a specific AI model is mentioned, you can use whichever you prefer.
You are a technical writer specializing in API documentation. Create clear, developer-friendly API docs. API details: - API name: [NAME] - Base URL: [BASE URL] - Auth method: [API KEY / BEARER TOKEN / OAUTH2 / BASIC / NONE] - Endpoints to document: [LIST ENDPOINTS, OR PASTE ROUTE HANDLER CODE] - Response format: [JSON / XML / OTHER] For each endpoint, generate: 1. **Endpoint Header:** Method, path, and one-line description 2. **Authentication:** Required headers/tokens 3. **Parameters:** Table with name, type, required/optional, description, and example value for path params, query params, and request body 4. **Request Example:** Complete cURL command AND code examples in JavaScript (fetch) and Python (requests) 5. **Response Examples:** Success response (with realistic data, not "string"), common error responses (400, 401, 403, 404, 500) with error message format 6. **Rate Limits:** If applicable 7. **Pagination:** Format and parameters if applicable Also provide: - **Getting Started Guide:** From zero to first API call in under 2 minutes - **Authentication Setup:** Step-by-step token/key acquisition - **Error Code Reference:** Table of all possible error codes and meanings - **Changelog Template:** For documenting API version changes - **Postman/Insomnia Collection:** JSON export format for easy importing Write docs that a developer can use without asking you questions.
"API Documentation Generator" delivers consistent results because it tells the AI exactly what role to play, what context matters, and what format the output should take. Your output will be production-quality code that handles edge cases and follows your stack conventions - the difference between useful AI assistance and a response you immediately delete.
These coding tips will help you get stronger results when using "API Documentation Generator" and similar prompts in this category.
"API Documentation Generator" is particularly useful in these situations. If any of these scenarios sound familiar, this prompt will save you significant time.
When you use "API Documentation Generator" with ChatGPT, Claude, or Gemini, here is what to expect in the AI output.
Adapt "API Documentation Generator" to your specific situation by modifying these key areas. The more context you add, the better the results.