API documentation
Your project includes auto-generated OpenAPI 3.1.1 documentation for the REST API. The docs are built from Zod schemas and served via an interactive Scalar reference UI.
Accessing the docs
In-app page
Navigate to /api-docs in your application. The page has two tabs:
- Features API: Documentation for all entity CRUD operations, API keys, audit logs, members, organizations, subscriptions, and users.
- Auth API: Documentation for Better Auth endpoints (sign in, sign up, password reset, etc.).
Direct URL
The interactive reference is also available at:
GET /api/api-docs/referenceThis serves a standalone HTML page with the Scalar API reference viewer.
Raw OpenAPI spec
To get the raw OpenAPI JSON spec (useful for code generation tools):
GET /api/api-docsHow it works
- Each controller exports an API doc configuration with the HTTP method, path, and Zod schemas for body/query/params.
buildApiDocs()collects all route configurations and generates an OpenAPI 3.1.1 document usingzod-openapi.- The Scalar reference UI renders the spec with an interactive "try it" feature.
Authentication schemes
The API supports two authentication methods, both documented in the OpenAPI spec:
| Scheme | Header | Description |
|---|---|---|
| API key | x-api-key | API key created from the API key management page |
| Bearer | Authorization | Session token from Better Auth |
Permissions
The API docs page requires the apiDocs:read permission. Both admin and member roles have this permission by default.
Key files
| File | Description |
|---|---|
backend/src/features/apiDocs.ts | OpenAPI document builder |
backend/src/features/apiDocs/apiDocsApiRoutes.ts | Routes for JSON spec and Scalar UI |
frontend/src/features/apiDocs/pages/ApiDocsPage.tsx | In-app docs page with tabs |
backend/src/features/[entity]/[entity]ApiDocs.ts | Per-feature route configurations |