API Reference

Workspace & Admin Endpoints

API endpoints for managing workspaces, the admin panel, and system operations.

Workspaces

MethodEndpointDescription
GET/api/v1/workspacesList all workspaces (scoped by role)
POST/api/v1/workspacesCreate workspace
GET/api/v1/workspaces/:widGet workspace details
GET/api/v1/workspaces/:wid/statsGet workspace statistics

Setup / Onboarding (Public)

These endpoints are used during initial setup before any user exists:

MethodEndpointDescription
GET/api/v1/setup/statusCheck if setup is complete
GET/api/v1/setup/brandingGet branding settings
POST/api/v1/setup/verify-licenseVerify license key
POST/api/v1/setup/brandingSave branding (logo, name)
POST/api/v1/setup/completeComplete onboarding (creates admin)

Admin Panel (super_admin / admin only)

MethodEndpointDescription
GET/api/v1/admin/dashboardAdmin dashboard stats
GET/api/v1/admin/employeesList all employees
POST/api/v1/admin/employeesCreate employee
DELETE/api/v1/admin/employees/:idDelete employee
GET/api/v1/admin/clientsList all clients
POST/api/v1/admin/clientsCreate (onboard) a client
DELETE/api/v1/admin/clients/:widDelete client
GET/api/v1/admin/assignmentsList employee-client assignments
POST/api/v1/admin/assignmentsCreate assignment
DELETE/api/v1/admin/assignments/:idDelete assignment
POST/api/v1/admin/impersonate/:uidImpersonate a user

System Updates (super_admin only)

MethodEndpointDescription
GET/api/v1/admin/system/check-updateCheck for available updates
POST/api/v1/admin/system/updateTrigger self-update
GET/api/v1/admin/system/versionGet current version

MCP (Model Context Protocol)

MethodEndpointDescription
POST/api/v1/mcpMCP JSON-RPC endpoint (authenticated)

Public Report

MethodEndpointDescription
GET/api/v1/report/:slug/statsPublic report statistics (no auth)
GET/api/v1/report/:slug/campaignsPublic report campaigns (no auth)

Example: Create Workspace

bash
curl -X POST https://YOUR_SERVER/api/v1/workspaces \
  -H "Content-Type: application/json" \
  -H "Cookie: auth_token=YOUR_JWT_TOKEN" \
  -d '{"name": "Client Corp", "slug": "client-corp"}'

Example: Create Employee

bash
curl -X POST https://YOUR_SERVER/api/v1/admin/employees \
  -H "Content-Type: application/json" \
  -H "Cookie: auth_token=YOUR_JWT_TOKEN" \
  -d '{"name": "John Doe", "email": "john@company.com", "password": "securepass123"}'