📝

API Documentation from Code

Generate comprehensive API documentation from existing endpoint code

prompt template
Generate API documentation from this endpoint code:

```
[PASTE_API_ROUTE_CODE]
```

Generate documentation including:
1. **Endpoint overview** — method, path, one-line description
2. **Authentication** — required auth, scopes, API key header
3. **Request** — path params, query params, headers, body schema with types
4. **Response** — success response schema, status code, headers
5. **Error responses** — all possible error codes with example bodies
6. **Examples** — cURL, JavaScript fetch, and Python requests examples
7. **Rate limits** — applicable rate limits for this endpoint
8. **Changelog** — breaking changes and deprecation notices

Format as Markdown suitable for a docs site. Include a TypeScript type definition for the request and response.

How to Use This Prompt

  1. 1Copy the prompt template above
  2. 2Paste into Claude, ChatGPT, or Cursor
  3. 3Replace [bracketed placeholders] with your specific project details
  4. 4Iterate on the AI output to refine and customize the results