Have Autohand Code add an API route that matches the repository style, validates input, handles errors, and includes focused tests.
Scaffold the endpoint, validation, tests, and docs
Code generation Build and change Implementation Code
autohand -p "Add a REST API for this resource using existing patterns"
A working endpoint with validation, storage calls, tests, and usage notes.
Build a REST API with Autohand Code is an implementation workflow that adds an API route using existing validation, auth, storage, error, test, and documentation patterns. ### At a glance | Question | Answer | | --- | --- | | Best for | new resources, internal tools, admin workflows, integration endpoints, and request-response features | | Primary inputs | Resource fields, required operations, and sample requests; Auth, permission, and rate-limit expectations; Expected responses, validation failures, and tests | | Autohand Code returns | A working endpoint with validation, storage calls, tests, and usage notes. | | Avoid when | the resource model, permissions, or error contract is still undefined | ### How Autohand Code handles this workflow 1. Inspects existing route handlers, schemas, data access, auth checks, and tests. 2. Adds endpoint behavior that matches local conventions. 3. Handles validation errors and bad inputs predictably. 4. Updates tests and usage notes so clients can call the API. ### Best inputs - Resource fields, required operations, and sample requests - Auth, permission, and rate-limit expectations - Expected responses, validation failures, and tests ### Strong prompt autohand -p "Add a REST API for this resource using existing patterns" ### Autohand Code CLI options - Run `autohand -p "Add a REST API for this resource using existing patterns"` for a scoped endpoint. - Use `/plan` first when permissions, validation, or storage contracts are still unclear. - Use MCP with `/mcp add` or `/mcp install` when the API depends on external docs, schemas, or internal service tools. ### Review before accepting Check auth, validation, idempotency, error responses, and whether examples match runnable behavior. ### 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 Build a REST API with Autohand Code? Build a REST API with Autohand Code is an implementation workflow that adds an API route using existing validation, auth, storage, error, test, and documentation patterns. ### When should a team use Build a REST API? Use it when a new API should feel native to the existing application. ### What evidence should reviewers check for Build a REST API? Check auth, validation, idempotency, error responses, and whether examples match runnable behavior.
Tutorial Scaffold a REST API from Scratch Add endpoint structure, validation, errors, and usage examples. /docs/tutorials/scaffold-rest-api.html Tutorial Add Integration Tests to an API Verify request behavior across happy paths and failures. /docs/tutorials/add-integration-tests.html Guide Recipes and Patterns Reuse common Autohand Code prompting patterns for implementation work. /docs/guides/recipes.html