
- Updated
Write API documentation from code
This prompt writes API documentation from the routes, handlers or OpenAPI snippet you paste in.
Write API documentation for these endpoints: [PASTE ROUTES, HANDLERS OR OPENAPI SNIPPET] For each endpoint include purpose, method and path, parameters, request body, example request, example response, error codes and authentication requirements. Organise them into sections and start with a short "getting started" guide.
Generate a working curl example for each endpoint and test it before publishing.
Get a better result
Documentation for each endpoint with purpose, method and path, parameters, body, example request and response, error codes and authentication, in sections with a short getting-started guide at the start.
The docs describe behaviour that the code does not have.
Fix: Paste the real handler code, not only the route names, and ask “mark anything you are inferring from names alone”.
- Example responses use made-up field names. Paste an actual response or the schema, and say “use these exact field names”. Run each example request before publishing.
- Authentication is described vaguely. State the scheme, such as a bearer token in the Authorization header, and ask for a table of which endpoints need it.
Ask for “a short changelog section with a date, a version and breaking changes noted”. Developers who rely on your API will look for it first.
Rewrite the error section as a table with status code, when it happens and the body returned, using only errors found in the code I pasted.
Guides that use this prompt
More chat & writing prompts
See all 465 →More like this
- Speed up a slow API endpoint or functionClaude · ChatGPT · Gemini
- Build a REST API endpoint with validationClaude · ChatGPT · Gemini
- Mock an external API in your testsClaude · ChatGPT · Gemini
- Add an AI feature to your app with an LLM APIClaude · ChatGPT · Gemini
- Design a REST API for your appChatGPT · Gemini · Claude



