| name | add-api-endpoint |
| description | Add or modify a website API endpoint with the repository's auth, validation, and OpenAPI patterns. Use this for import, export, or organization-scoped APIs. |
Use this workflow when creating or changing an API endpoint:
- Read
docs/technical-notes/README.md.
- Read
docs/technical-notes/authentication.md.
- Read the API note that matches the feature:
docs/technical-notes/export-api.md
docs/technical-notes/import-system.md
- Read
docs/technical-notes/openapi-documentation.md.
Implementation checklist:
- Put the route in the correct protected API layout under
apps/website/app/routes.ts.
- Reuse middleware-resolved organization context for organization-scoped endpoints.
- Define or update the shared Zod schema in
apps/website/app/lib/api-doc/schemas/.
- Validate request input with that schema in the handler.
- Register the endpoint in
apps/website/app/lib/api-doc/openapi.server.ts.
- Reuse existing format, import, and export services instead of duplicating parsing logic in the route.
- If the endpoint is externally consumed, update user or developer documentation when the contract changes.
Validation checklist:
- Run the repository type-check command.
- Run endpoint-specific tests when available, otherwise run the main test suite.