Workspaces & Teams
Team Management
Manage employees and clients from the admin panel. Only super_admin and admin roles have access.
Roles
| Role | Permissions |
|---|---|
super_admin | Full access — all workspaces, admin panel, system updates, impersonation |
admin | Admin panel, all workspaces, employee/client management |
employee | Only assigned workspaces — campaigns, leads, mailboxes, threads |
client | Read-only access to their own workspace |
Adding an 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 Smith", "email": "john@company.com", "password": "securepass123"}'Onboarding a Client
bash
curl -X POST https://YOUR_SERVER/api/v1/admin/clients \
-H "Content-Type: application/json" \
-H "Cookie: auth_token=YOUR_JWT_TOKEN" \
-d '{"name": "Client Corp", "company": "Client Corp", "email": "owner@clientcorp.com", "phone": "+1234567890"}'This creates a new workspace for the client and gives them client role access.
Assigning Employees to Workspaces
bash
# Create assignment
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": "EMPLOYEE_UUID", "workspace_id": "WORKSPACE_UUID"}'
# Remove assignment
curl -X DELETE https://YOUR_SERVER/api/v1/admin/assignments/ASSIGNMENT_ID \
-H "Cookie: auth_token=YOUR_JWT_TOKEN"Multiple assignments
An employee can be assigned to multiple workspaces. They'll see a workspace switcher in the dashboard showing only their assigned workspaces.
Impersonation (super_admin only)
Super admins can log in as any user to debug issues or manage their workspace:
bash
curl -X POST https://YOUR_SERVER/api/v1/admin/impersonate/USER_UUID \
-H "Cookie: auth_token=YOUR_JWT_TOKEN"Returns a new JWT token for the target user's session.
Admin Panel API
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/admin/dashboard | Aggregate stats |
| GET | /api/v1/admin/employees | List employees |
| POST | /api/v1/admin/employees | Create employee |
| DELETE | /api/v1/admin/employees/:id | Delete employee |
| GET | /api/v1/admin/clients | List clients |
| POST | /api/v1/admin/clients | Onboard client |
| DELETE | /api/v1/admin/clients/:wid | Delete client |
| GET | /api/v1/admin/assignments | List assignments |
| POST | /api/v1/admin/assignments | Create assignment |
| DELETE | /api/v1/admin/assignments/:id | Delete assignment |
| POST | /api/v1/admin/impersonate/:uid | Impersonate user |