Skip to main content

List Departments

Requires Admin or Owner role.
GET /backend/departments
Response (200):
{
  "data": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "tenant_id": "d6b10acc-2307-413f-a4de-4c2edf3f9a70",
      "name": "Sales",
      "description": "Sales team",
      "member_count": 5,
      "created_at": "2024-01-15T10:00:00Z",
      "updated_at": "2024-01-15T10:00:00Z"
    }
  ]
}

My Departments

Accessible by Operators. Returns only departments the user belongs to.
GET /backend/departments/my

Create Department

POST /backend/departments
Body:
{
  "name": "Support",
  "description": "Customer support team"
}
FieldTypeRequiredDescription
namestringYesDepartment name (max 100 chars, unique per tenant)
descriptionstringNoDepartment description
Response (201):
{
  "id": "uuid",
  "tenant_id": "uuid",
  "name": "Support",
  "description": "Customer support team",
  "member_count": 0,
  "created_at": "2024-01-15T10:00:00Z",
  "updated_at": "2024-01-15T10:00:00Z"
}

Update Department

PUT /backend/departments/{id}
Body:
{
  "name": "Premium Support",
  "description": "Priority support team"
}
All fields are optional. Returns 409 Conflict if the new name already exists.

Delete Department

DELETE /backend/departments/{id}
Response: 204 No Content
Deleting a department automatically clears all references in lead-channels and channels (set to NULL).