Skip to content

Departments

Management of service departments. Departments organize agents and define call queues. Requires supervisor role or above.

Important

Departments that have associated recordings cannot be deleted. Use deactivation in that case.

Endpoints

MethodEndpointDescriptionMinimum Role
GET/api/v1/departmentsList departmentssupervisor
POST/api/v1/departmentsCreate departmentsupervisor
GET/api/v1/departments/:idGet departmentsupervisor
PUT/api/v1/departments/:idUpdate departmentsupervisor
DELETE/api/v1/departments/:idDelete departmentsupervisor
GET/api/v1/departments/:id/usersList department userssupervisor
POST/api/v1/departments/:id/usersAdd user to departmentsupervisor
DELETE/api/v1/departments/:id/users/:user_idRemove user from departmentsupervisor

List Departments

GET /api/v1/departments

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
page_sizeinteger20Items per page
sort_bystringnameSort field
sort_orderstringascSort direction

Request Example

bash
curl -X GET "https://voki.avanter.com.br/api/v1/departments?page=1&page_size=10" \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter"

Success Response (200)

json
{
  "data": [
    {
      "id": "e5f6a7b8-c9d0-1234-efgh-567890123456",
      "name": "Suporte Técnico",
      "identifier": "suporte-tecnico",
      "description": "Departamento de suporte técnico ao cliente",
      "active": true,
      "sector_id": "f6a7b8c9-d0e1-2345-fghi-678901234567",
      "max_queue_size": 20,
      "max_wait_time": 300,
      "user_count": 5,
      "inserted_at": "2026-01-10T09:00:00Z",
      "updated_at": "2026-02-01T10:00:00Z"
    }
  ],
  "meta": {
    "current_page": 1,
    "page_size": 10,
    "total_pages": 1,
    "total_count": 3
  }
}

Create Department

POST /api/v1/departments

Request Body

FieldTypeRequiredDescription
namestringYesDepartment name
identifierstringNoUnique identifier (slug, auto-generated if omitted)
descriptionstringNoDescription
sector_iduuidNoAssociated sector ID
max_queue_sizeintegerNoMaximum queue size (default: 20)
max_wait_timeintegerNoMaximum wait time in seconds (default: 300)

Request Example

bash
curl -X POST https://voki.avanter.com.br/api/v1/departments \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter" \
  -H "Content-Type: application/json" \
  -d '{
    "department": {
      "name": "Vendas",
      "description": "Departamento de vendas e consultoria",
      "sector_id": "f6a7b8c9-d0e1-2345-fghi-678901234567",
      "max_queue_size": 15,
      "max_wait_time": 180
    }
  }'

Success Response (201)

json
{
  "data": {
    "id": "a7b8c9d0-e1f2-3456-ghij-789012345678",
    "name": "Vendas",
    "identifier": "vendas",
    "description": "Departamento de vendas e consultoria",
    "active": true,
    "sector_id": "f6a7b8c9-d0e1-2345-fghi-678901234567",
    "max_queue_size": 15,
    "max_wait_time": 180,
    "user_count": 0,
    "inserted_at": "2026-02-18T12:00:00Z",
    "updated_at": "2026-02-18T12:00:00Z"
  }
}

Get Department

GET /api/v1/departments/:id

Request Example

bash
curl -X GET https://voki.avanter.com.br/api/v1/departments/e5f6a7b8-c9d0-1234-efgh-567890123456 \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter"

Update Department

PUT /api/v1/departments/:id

Request Example

bash
curl -X PUT https://voki.avanter.com.br/api/v1/departments/e5f6a7b8-c9d0-1234-efgh-567890123456 \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter" \
  -H "Content-Type: application/json" \
  -d '{
    "department": {
      "name": "Suporte Premium",
      "max_queue_size": 30
    }
  }'

Delete Department

DELETE /api/v1/departments/:id

Warning

Departments with associated recordings will return a 422 error. Deactivate the department instead of deleting it.

Request Example

bash
curl -X DELETE https://voki.avanter.com.br/api/v1/departments/e5f6a7b8-c9d0-1234-efgh-567890123456 \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter"

Success Response (204)

No response body.

Errors

CodeDescription
422Department has recordings and cannot be deleted
404Department not found

List Department Users

GET /api/v1/departments/:department_id/users

Request Example

bash
curl -X GET https://voki.avanter.com.br/api/v1/departments/e5f6a7b8-c9d0-1234-efgh-567890123456/users \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter"

Success Response (200)

json
{
  "data": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "name": "João Silva",
      "email": "joao@empresa.com",
      "role": "attendant",
      "active": true
    }
  ]
}

Add User to Department

POST /api/v1/departments/:department_id/users

Request Body

FieldTypeRequiredDescription
user_iduuidYesID of the user to add

Request Example

bash
curl -X POST https://voki.avanter.com.br/api/v1/departments/e5f6a7b8-c9d0-1234-efgh-567890123456/users \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
  }'

Success Response (201)

json
{
  "data": {
    "message": "User added to department"
  }
}

Remove User from Department

DELETE /api/v1/departments/:department_id/users/:user_id

Request Example

bash
curl -X DELETE https://voki.avanter.com.br/api/v1/departments/e5f6a7b8-c9d0-1234-efgh-567890123456/users/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter"

Success Response (204)

No response body.

Documentação da API Voki v4.0