Dashboard API
Scope and auth
Section titled “Scope and auth”Dashboard API endpoints are under /dashboard/api/*.
For dashboard serving and same-origin deployment, see Dashboard UI.
Auth model:
- Session cookie auth from Better Auth (
/api/auth/*). - Project-scoped admin routes require
X-Project-Id.
Required header for project-scoped routes:
X-Project-Id: <project-id>Account bootstrap
Section titled “Account bootstrap”POST /dashboard/api/signup
Section titled “POST /dashboard/api/signup”Creates a dashboard user and bootstraps their first project.
Request body:
{ "name": "Jane Doe", "email": "jane@example.com", "password": "super-secret-password", "projectName": "My Project"}Response:
201:{ "success": true }400: invalid JSON or missing required fields (name,email,password,projectName)
Projects
Section titled “Projects”GET /dashboard/api/projects
Section titled “GET /dashboard/api/projects”Returns projects for the authenticated user.
Response:
200:{ "projects": [{ "id": "...", "name": "...", "createdAt": "...", "role": "admin|user" }] }
POST /dashboard/api/projects
Section titled “POST /dashboard/api/projects”Creates a project for the authenticated user.
Request body:
{ "name": "New Project"}Response:
201:{ "projectId": "...", "apiKey": "pulse_sk_...", "name": "New Project" }400: missing/emptyname
API keys (project admin)
Section titled “API keys (project admin)”These routes require session auth + X-Project-Id + project admin role.
GET /dashboard/api/api-keys
Section titled “GET /dashboard/api/api-keys”Lists API keys for the selected project.
Response:
200:{ "keys": [{ "id": "...", "projectId": "...", "projectName": "...", "key": "pulse_sk_...", "name": "...", "lastUsedAt": "...", "createdAt": "..." }] }
POST /dashboard/api/api-keys
Section titled “POST /dashboard/api/api-keys”Creates an API key for the selected project.
Request body:
{ "name": "CI Key"}name is optional. If omitted, default is "API Key".
Response:
201:{ "apiKey": "pulse_sk_..." }400: invalid request body
PATCH /dashboard/api/api-keys/:id
Section titled “PATCH /dashboard/api/api-keys/:id”Renames an API key.
Request body:
{ "name": "New Key Name"}Response:
200:{ "success": true }400: missing/invalidname404: API key not found
DELETE /dashboard/api/api-keys/:id
Section titled “DELETE /dashboard/api/api-keys/:id”Deletes an API key.
Response:
200:{ "success": true }404: API key not found
Project users (project admin)
Section titled “Project users (project admin)”These routes require session auth + X-Project-Id + project admin role.
GET /dashboard/api/users
Section titled “GET /dashboard/api/users”Lists project members.
Response:
200:{ "users": [{ "userId": "...", "name": "...", "email": "...", "role": "admin|user", "createdAt": "..." }] }
POST /dashboard/api/users
Section titled “POST /dashboard/api/users”Adds a user to the selected project.
For an existing account, email is sufficient.
For a new account, provide name, email, and password.
Request body examples:
{ "email": "existing-user@example.com", "role": "user"}{ "name": "New User", "email": "new-user@example.com", "password": "super-secret-password", "role": "admin"}Response:
201:{ "user": { "userId": "...", "name": "...", "email": "...", "role": "admin|user", "createdAt": "..." } }400: invalid JSON or missing required fields409: user already belongs to the project
Related Better Auth routes
Section titled “Related Better Auth routes”Session/account endpoints are exposed under /api/auth/* (for example sign-in, sign-out, session).