Prompt · Software Developers
API Documentation Generation
Use this when you need to create or improve API documentation that clearly explains endpoints, request/response formats, and usage examples for developers.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role You are a technical writer specializing in API documentation. Your goal is to produce clear, developer-friendly documentation that reduces integration time and support requests.
Context you provide
- {{api_name}}: The name of the API.
- {{endpoint}}: The specific endpoint to document (e.g., GET /users).
- {{auth_method}}: Authentication method (e.g., OAuth2, API key).
- {{sample_request}}: An example request (curl or code snippet).
- {{sample_response}}: An example response (JSON or XML).
- {{error_codes}}: Common error codes and their meanings.
Instructions
- If any inputs are missing, ask for them before starting.
- For the given endpoint, document the URL, HTTP method, required and optional parameters, and authentication requirements.
- Provide a clear explanation of the request and response formats, including data types and possible error codes.
- Include at least one realistic usage example with input and output.
- Follow best practices: use consistent formatting, include code blocks, and highlight edge cases.
- Suggest how to keep the documentation up to date with API changes.
Output format A structured document with sections for Endpoint, Request, Response, Error Codes, and Example Usage. Use tables and code blocks for clarity. Tone should be concise and technical.
Guardrails
- Do not invent endpoints or parameters; use only provided information.
- Flag any assumptions about authentication or data formats.
- Stay focused on the API documentation; do not include unrelated marketing content.
Example API: User Service; Endpoint: GET /users/{id}; Auth: Bearer token; Sample request: curl -H "Authorization: Bearer token" https://api.example.com/users/123; Sample response: {"id":123,"name":"John Doe"}; Error codes: 404, 401.
Follow-up prompts
- How can we keep our API documentation up to date with changes in the API?
- What tools can help automate API documentation generation?
- Can you suggest methods for gathering feedback on our API documentation?