Skip to content

Sectors

Sectors logically group departments (e.g., "Sales", "Support"). Requires supervisor role or above.

Endpoints

MethodEndpointDescriptionMinimum Role
GET/api/v1/sectorsList sectorssupervisor
POST/api/v1/sectorsCreate sectorsupervisor
GET/api/v1/sectors/:idGet sectorsupervisor
PUT/api/v1/sectors/:idUpdate sectorsupervisor
DELETE/api/v1/sectors/:idDelete sectorsupervisor

List Sectors

GET /api/v1/sectors

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/sectors" \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter"

Success Response (200)

json
{
  "data": [
    {
      "id": "f6a7b8c9-d0e1-2345-fghi-678901234567",
      "name": "Comercial",
      "description": "Setor comercial e vendas",
      "active": true,
      "department_count": 3,
      "inserted_at": "2026-01-05T08:00:00Z",
      "updated_at": "2026-01-05T08:00:00Z"
    },
    {
      "id": "a7b8c9d0-e1f2-3456-ghij-789012345678",
      "name": "Suporte",
      "description": "Setor de suporte técnico",
      "active": true,
      "department_count": 2,
      "inserted_at": "2026-01-05T08:30:00Z",
      "updated_at": "2026-01-05T08:30:00Z"
    }
  ],
  "meta": {
    "current_page": 1,
    "page_size": 20,
    "total_pages": 1,
    "total_count": 2
  }
}

Create Sector

POST /api/v1/sectors

Request Body

FieldTypeRequiredDescription
namestringYesSector name
descriptionstringNoDescription

Request Example

bash
curl -X POST https://voki.avanter.com.br/api/v1/sectors \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter" \
  -H "Content-Type: application/json" \
  -d '{
    "sector": {
      "name": "Financeiro",
      "description": "Setor financeiro e cobrança"
    }
  }'

Success Response (201)

json
{
  "data": {
    "id": "b8c9d0e1-f2a3-4567-hijk-890123456789",
    "name": "Financeiro",
    "description": "Setor financeiro e cobrança",
    "active": true,
    "department_count": 0,
    "inserted_at": "2026-02-18T12:00:00Z",
    "updated_at": "2026-02-18T12:00:00Z"
  }
}

Get Sector

GET /api/v1/sectors/:id

Request Example

bash
curl -X GET https://voki.avanter.com.br/api/v1/sectors/f6a7b8c9-d0e1-2345-fghi-678901234567 \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter"

Update Sector

PUT /api/v1/sectors/:id

Request Example

bash
curl -X PUT https://voki.avanter.com.br/api/v1/sectors/f6a7b8c9-d0e1-2345-fghi-678901234567 \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter" \
  -H "Content-Type: application/json" \
  -d '{
    "sector": {
      "name": "Comercial & Marketing"
    }
  }'

Success Response (200)

json
{
  "data": {
    "id": "f6a7b8c9-d0e1-2345-fghi-678901234567",
    "name": "Comercial & Marketing",
    "description": "Setor comercial e vendas",
    "active": true,
    "department_count": 3,
    "inserted_at": "2026-01-05T08:00:00Z",
    "updated_at": "2026-02-18T13:00:00Z"
  }
}

Delete Sector

DELETE /api/v1/sectors/:id

Note

Sectors with associated departments cannot be deleted. Remove the departments first.

Request Example

bash
curl -X DELETE https://voki.avanter.com.br/api/v1/sectors/b8c9d0e1-f2a3-4567-hijk-890123456789 \
  -H "Authorization: Bearer eyJhbGci..." \
  -H "X-Tenant: avanter"

Success Response (204)

No response body.

Documentação da API Voki v4.0