Skip to content

Generate an API reference from your codebase

Use Docs Agent to turn your source code into a complete, accurate API reference with parameters, response schemas, and examples.

This guide shows you how to generate an API reference directly from your source code. Docs Agent reads your function signatures, types, and comments, then produces reference documentation with parameters, response schemas, example requests, and error codes — no manual transcription from code to docs.

By the end, you have a review-ready API reference in a pull request.

You need:

  • An EkLine account with Docs Agent enabled.
  • A repository connected to EkLine that contains the API source code you want to document.
  • The path to the file or directory that defines your API — for example, src/api/auth.ts or src/routes/.

New to EkLine? Connect GitHub to EkLine first, then return here.

  1. Log in to your EkLine dashboard.
  2. Click Docs Agent in the left navigation.

Step 2: Point the agent at your API source

Section titled “Step 2: Point the agent at your API source”

Reference the exact file or directory that defines your endpoints. Naming the source keeps the agent focused and improves accuracy.

Document the endpoints in src/api/auth.ts. Include request
parameters, response schema, example requests, and error
codes.

For each endpoint, the agent extracts:

  • Endpoint URLs and HTTP methods
  • Request parameters with types and descriptions
  • Response schema with field descriptions
  • Example request and response bodies
  • Error responses and status codes

The agent writes the reference to the editor panel as it works. Read through the output and confirm it matches your code:

  • Endpoint paths and methods are correct.
  • Every parameter your code accepts appears in the reference.
  • Response fields match what your code returns.

Add detail or fix gaps by continuing the conversation. The agent keeps the context from your first prompt, so you can build on the reference incrementally.

Add a curl example and a JavaScript fetch example to each
endpoint.
  1. Enable View All Changes in the toolbar to see a diff of the generated reference.
  2. Make any final edits directly in the editor panel.
  3. Click Raise PR. The agent prefills a prompt in the chat — press Enter to send it, or edit the prompt first to add instructions.

The agent opens the pull request and replies in the chat with a link to continue the review on GitHub.

Before you merge, confirm the reference reflects your code:

  • Signatures match. Every parameter name, type, and required or optional flag matches the source.
  • Examples run. Copy an example request and run it against your API. The response matches the documented schema.
  • Errors are complete. Each documented status code corresponds to an error your code actually returns.
  • Nothing is missing. Every endpoint in the referenced file or directory appears in the output.
ProblemCauseFix
The agent misses endpointsThe prompt was too broad, or endpoints span several filesName each file explicitly, or reference the parent directory: "Document every route in src/routes/"
Parameter descriptions are vagueYour source code lacks comments or type annotations for those parametersAdd doc comments or types in the source, then regenerate — or supply the descriptions in a follow-up prompt
Example values look genericThe agent had no sample data to draw fromAsk for realistic values: "Use realistic example values based on the types in the code"
The reference mixes in conceptual contentThe prompt asked for explanation alongside referenceKeep the prompt reference-focused, and generate concepts separately with Create documentation