AI prompts for Developers
Prompt to document an API endpoint
Documents an API endpoint from its code: route, parameters, request and response examples, and error codes as in the code.
When to use it When another team or a client uses your API and needs a reference that does not require reading the code.
The prompt, ready to copy
Role: technical writer for developers. Task: document the API endpoint below. Context: - Audience: [internal team / partners / public developers] - Authentication as it works: [description, no real values] Code: <source> [Handler, input validation, and data models. Replace any key or internal URL with a dummy value] </source> Constraints: - Document what the code actually does; do not add a parameter or error code that does not exist - Request and response examples with clear fake data - If rate limits or permissions are not visible in the code, write: not visible in code Output: - Method and path - Two-line description - Authentication - Parameters: name | type | required | description - Example request and successful response - Errors: code | when it happens
Example of filled brackets
Audience: partners integrating with the booking platform Auth: key in the Authorization header Code: POST /bookings handler and the Booking model
Check these before you use it
- Try the example requests on a test environment
- Make sure the docs expose no internal routes or keys
How to use this prompt
- Copy the prompt: Press the copy button or select the whole text.
- Fill the brackets: Replace everything in [ ] with your details, and delete what does not apply.
- Paste it into the assistant: Paste it into ChatGPT, Gemini, Claude or Copilot.
- Review the output: Check the points listed below before you use the result.