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
| Role | Workspace Access | Admin Panel |
|---|---|---|
super_admin | All workspaces | Full access + system updates + impersonation |
admin | All workspaces | Employees, clients, assignments |
employee | Assigned workspaces only | No access |
client | Own workspace only | No access |
The first user to register automatically becomes super_admin.
Creating a Workspace
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:
# 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/statsAdmin 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
# 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"}'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:
https://YOUR_SERVER/report/WORKSPACE_SLUGThe report auto-refreshes every 60 seconds and shows: hero stats, campaign performance table, lead lists with progress bars.
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/workspaces | List workspaces (filtered by role) |
| POST | /api/v1/workspaces | Create workspace |
| GET | /api/v1/workspaces/:wid | Get workspace details |
| GET | /api/v1/workspaces/:wid/stats | Get workspace statistics |