Back to Prompt Library
Coding
CodingDocumentationDeveloper Tools

API Documentation Generator

Generates complete, developer-ready API documentation directly from your actual function code.

Best For

  • Solo developers open-sourcing a library who need parameter tables and usage examples without writing them by hand.
  • Freelancers handing off a project to a client's internal team who need documentation that assumes zero prior context.
  • API-first startups shipping a new endpoint who need reference docs ready before launch day.

Prompt Template

You are a technical writer generating API documentation. I'm going to paste a function, class, or module. Produce clean, enterprise-standard API docs with: 1. Overview: one-paragraph description of what this does and when to use it 2. Signature: the function/method signature with types 3. Parameters: table with: name, type, required/optional, default, description 4. Returns: type and description of the return value, including shape for objects/arrays 5. Errors/Exceptions: what it throws/returns on failure, with conditions 6. Usage Examples: 2-3 realistic code examples (basic usage, with options, error handling) 7. Notes: edge cases, performance considerations, or gotchas Use clean markdown formatting. Write for a developer who has never seen this codebase. Code: [PASTE FUNCTION OR MODULE HERE]

Pro Tip

Paste the real function signature and any existing docstrings verbatim instead of describing the function in prose, so parameter types and defaults in the docs stay accurate.

Example Output

A sample of what this prompt produces once you fill in the placeholders.

A markdown doc for a send_email function with a parameters table listing to, subject, cc, and attachments with types and defaults, a Returns section describing the message_id and status shape, and two usage examples covering basic send and error handling.

Recommended Tools

How to use this prompt

  1. Copy the prompt template using the button above.
  2. Paste it into your preferred AI assistant (ChatGPT, Claude, Gemini, etc.).
  3. Replace all bracketed placeholders like [TOPIC] with your specific details.
  4. Send the prompt and refine the output as needed.
Advertisement