Workspaces & Teams

Workspaces

Workspaces provide isolated environments for managing multiple clients or projects. Each workspace has its own campaigns, leads, mailboxes, threads, settings, and analytics — completely separated at the database level.

How Workspaces Work

  • A default workspace is auto-created when the first user registers
  • All data (campaigns, leads, mailboxes, threads, webhooks, integrations) is scoped by workspace
  • API endpoints use the pattern /api/v1/workspaces/:wid/...
  • The workspace ID is validated on every request via middleware

Roles

RoleWorkspace AccessAdmin Panel
super_adminAll workspacesFull access + system updates + impersonation
adminAll workspacesEmployees, clients, assignments
employeeAssigned workspaces onlyNo access
clientOwn workspace onlyNo access

The first user to register automatically becomes super_admin.

Creating a 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"}'

Workspace Scoping in API

All workspace-scoped endpoints require the workspace ID in the URL:

bash
# List campaigns in workspace 1
GET /api/v1/workspaces/1/campaigns

# Create a lead in workspace 1
POST /api/v1/workspaces/1/leads/upload

# Get workspace stats
GET /api/v1/workspaces/1/stats

Admin Panel

Users with super_admin or admin role access the admin panel:

  • Dashboard — Aggregate stats (employee count, client count)
  • Employees — Create/delete employees (name, email, password)
  • Clients — Onboard clients (creates a workspace for them)
  • Assignments — Assign employees to client workspaces
  • Impersonate — Log in as any user (super_admin only)

Employee Management

bash
# Create an employee
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": "securepass"}'

# Assign employee to a workspace
curl -X POST https://YOUR_SERVER/api/v1/admin/assignments \
  -H "Content-Type: application/json" \
  -H "Cookie: auth_token=YOUR_JWT_TOKEN" \
  -d '{"user_id": "USER_UUID", "workspace_id": "WORKSPACE_UUID"}'
Workspace switcher

Employees see a workspace switcher in the dashboard sidebar showing only their assigned workspaces. Admins see all workspaces.

Public Report

Each workspace can generate a shareable public report page (no auth required). The report shows campaign stats and is accessible via a unique slug:

text
https://YOUR_SERVER/report/WORKSPACE_SLUG

The report auto-refreshes every 60 seconds and shows: hero stats, campaign performance table, lead lists with progress bars.

API Endpoints

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