Document an API

Have Autohand Code read route handlers, schemas, examples, and tests before writing or updating API docs.

Keep docs aligned with actual behavior

Documentation Discovery and planning Review Docs

autohand -p "Document this API from the implementation and include examples"

Docs that reflect the implementation, with examples and caveats.

Document an API with Autohand Code is a documentation workflow that reads implementation, schemas, tests, auth checks, examples, and error paths before writing or updating API docs. ### At a glance | Question | Answer | | --- | --- | | Best for | new endpoints, drifting docs, partner integrations, and internal API handoffs | | Primary inputs | Route, endpoint group, or SDK method to document; Docs location and style to match; Real client examples, auth requirements, and known failure cases | | Autohand Code returns | Docs that reflect the implementation, with examples and caveats. | | Avoid when | the API behavior is still being designed and code does not exist yet | ### How Autohand Code handles this workflow 1. Reads route handlers, schemas, tests, examples, and auth code. 2. Documents parameters, responses, errors, pagination, and unsupported behavior. 3. Adds examples that match the implementation. 4. Flags behavior the code does not support instead of inventing it. ### Best inputs - Route, endpoint group, or SDK method to document - Docs location and style to match - Real client examples, auth requirements, and known failure cases ### Strong prompt autohand -p "Document this API from the implementation and include examples" ### Autohand Code CLI options - Run `autohand -p "Document this API from the implementation and include examples"` for docs that follow code. - Use `--patch` when the docs update should be reviewed as a standalone patch. - Use `/mcp` tools when the docs need current external API references or internal schema catalogs. ### Review before accepting Compare examples against tests or runnable requests so the docs do not drift from implementation. ### Source and validation signals Autohand AI maintains this workflow as first-party product guidance for Autohand Code. Use the [Autohand CLI Playbook](https://github.com/autohandai/code-cli/blob/main/docs/AUTOHAND_PLAYBOOK.md), [CLI reference](/docs/working-with-autohand-code/cli-reference.html), and [configuration reference](https://github.com/autohandai/code-cli/blob/main/docs/config-reference.md) when choosing between interactive mode, command mode, auto-mode, feature-enabled /goal, /settings, skills, MCP, and permission settings. The related resources below link to product docs and tutorials for the workflow, and the final answer should name repository-specific files, commands, outputs, or docs that a reviewer can verify. ### Frequently asked questions ### What is Document an API with Autohand Code? Document an API with Autohand Code is a documentation workflow that reads implementation, schemas, tests, auth checks, examples, and error paths before writing or updating API docs. ### When should a team use Document an API? Use it when documentation accuracy matters more than writing speed. ### What evidence should reviewers check for Document an API? Compare examples against tests or runnable requests so the docs do not drift from implementation.

Guide Maintaining Documentation at Scale Keep docs aligned with implementation as APIs change. /docs/guides/maintaining-documentation.html Tutorial Build a Documentation Generator Agent Generate docs from code, examples, and observed behavior. /docs/agent-sdk/tutorials/500-documentation-generator.html Tutorial Scaffold a REST API from Scratch Use API implementation context to write accurate endpoint docs. /docs/tutorials/scaffold-rest-api.html