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/reference

This 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-docs

How it works

  1. Each controller exports an API doc configuration with the HTTP method, path, and Zod schemas for body/query/params.
  2. buildApiDocs() collects all route configurations and generates an OpenAPI 3.1.1 document using zod-openapi.
  3. 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:

SchemeHeaderDescription
API keyx-api-keyAPI key created from the API key management page
BearerAuthorizationSession 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

FileDescription
backend/src/features/apiDocs.tsOpenAPI document builder
backend/src/features/apiDocs/apiDocsApiRoutes.tsRoutes for JSON spec and Scalar UI
frontend/src/features/apiDocs/pages/ApiDocsPage.tsxIn-app docs page with tabs
backend/src/features/[entity]/[entity]ApiDocs.tsPer-feature route configurations