# /build-api - API Endpoint & Route Generator

> Type-safe REST/GraphQL routes with Zod schema validation and error envelopes.

Canonical: https://www.agentickit.co/commands/build-api
Last updated: 2026-11-18

Generates robust backend API routes with strict request payload validation, database transactions, standardized JSON error envelopes, and rate limiting.

**Usage:** `Use when creating new backend endpoints, controller handlers, or webhook receivers.`

## Pipeline
1. Define request and response TypeScript interfaces and Zod validation schemas
2. Implement route handler with auth session verification and workspace permission check
3. Execute database transactions using Drizzle ORM / Prisma
4. Return standardized HTTP responses with appropriate status codes and error handles

## Output files
- `src/app/api/.../route.ts`
- `src/lib/validations/...`
- `src/types/...`

**Claude Code frontmatter:** `argument-hint: [resource or endpoint description]` · `model: inherit`

## Related
- [api-engineer](https://www.agentickit.co/agents/api-engineer)
- [backend-architect](https://www.agentickit.co/agents/backend-architect)
- [security-auditor](https://www.agentickit.co/agents/security-auditor)
- [api-patterns](https://www.agentickit.co/skills/api-patterns)
- [error-handling](https://www.agentickit.co/skills/error-handling)
- [auth-patterns](https://www.agentickit.co/skills/auth-patterns)
