Let an AI agent document every request in a collection

The AI assistant in the app can draft docs for one request. For a collection of 80 undocumented requests, a coding agent does better: it can read the route handlers in your repository, run each request, and write docs that say what the code actually does, not only what the response looks like.

The prompt

For each request in the "Orders" folder of the "Orders API" collection: 1. Find the route handler in src/api/orders/ that serves it. 2. Run it once against Local (GET requests only; ask me before others). 3. Write Markdown docs for the request: one sentence on what it does; side effects (emails, payments, events); required permissions; query parameters and body fields with types and whether they're required; error responses the handler can return and why. 4. Keep it under 25 lines. No example bodies longer than 15 lines. Show me the docs for the first two requests. If I approve, save all of them with update_request (docs field).

Why the code matters

From a response alone, a model can describe fields. From the handler, it can also tell you:

  • that POST /orders/{id}/cancel sends an email and publishes order.cancelled,
  • that it returns 409 when the order has shipped,
  • that only the support and admin roles may call it.

Those are the lines a reader actually needs.

Review like a pull request

  • Read two in full, skim the rest. If the first two are right, the pattern holds; look for outliers.
  • Watch for confident inventions. "Rate limited to 100 requests per minute" should be in the code or deleted.
  • Keep secrets out. The agent never sees environment values, and credentials in requests are masked, but a real customer's email from a response can end up in an example. Ask it to use made-up values.

Keep it fresh

Docs drift when endpoints change. Add a line to your agent's project instructions (see make your coding agent run the API tests): "When you change a route handler, update the matching request's docs too."

Publish

The docs now live on each request, in the app's Docs tab. To show them to people outside the workspace: