> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sell.ia.proativia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Criar Setor do Chat

> Cria um novo setor de chat para organização de atendimentos.

## Requisição

`POST https://crm.wavups.com/api/v1/chat-sector`

<ParamField header="Token" type="string" required>
  Seu token de autenticação.
</ParamField>

### Body Parameters

<ParamField body="name" type="string" required>
  Nome do setor (ex: `Suporte`, `Vendas`).
</ParamField>

<ParamField body="accountIntegration" type="string" required>
  ID da integração de conta vinculada ao setor.
</ParamField>

<ParamField body="description" type="string">
  Descrição do setor.
</ParamField>

<ParamField body="color" type="string">
  Cor de identificação do setor em formato hexadecimal (ex: `#3B82F6`).
</ParamField>

<ParamField body="membersCanViewAllConversations" type="boolean">
  Define se os membros do setor podem visualizar todas as conversas do setor (`true`) ou apenas as suas (`false`). Padrão: `true`.
</ParamField>

***

## Resposta

Retorna o objeto do setor criado.

<ResponseField name="id" type="string">
  Identificador único do setor.
</ResponseField>

<ResponseField name="name" type="string">
  Nome do setor.
</ResponseField>

<ResponseField name="accountIntegration" type="string">
  ID da integração de conta vinculada.
</ResponseField>

<ResponseField name="description" type="string | null">
  Descrição do setor.
</ResponseField>

<ResponseField name="color" type="string | null">
  Cor em hexadecimal.
</ResponseField>

<ResponseField name="membersCanViewAllConversations" type="boolean">
  Permissão de visualização de conversas.
</ResponseField>

<ResponseField name="createdAt" type="string">
  Data de criação (ISO 8601).
</ResponseField>

***

## Exemplos

<RequestExample>
  ```bash POST /api/v1/chat-sector theme={null}
  curl --request POST \
    --url 'https://crm.wavups.com/api/v1/chat-sector' \
    --header 'Token: SEU_TOKEN_DE_API' \
    --header 'Content-Type: application/json' \
    --data '{
      "name": "Suporte Técnico",
      "accountIntegration": "cintegration123",
      "description": "Setor responsável por suporte ao cliente",
      "color": "#3B82F6",
      "membersCanViewAllConversations": true
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": "csector001",
    "name": "Suporte Técnico",
    "accountIntegration": "cintegration123",
    "description": "Setor responsável por suporte ao cliente",
    "color": "#3B82F6",
    "membersCanViewAllConversations": true,
    "createdAt": "2025-08-10T09:00:00.000Z",
    "AccountIntegration": {
      "integrationAccountName": "+5511988887777"
    }
  }
  ```

  ```json 400 theme={null}
  {
    "error": "name and accountIntegration are required"
  }
  ```

  ```json 500 theme={null}
  {
    "error": "Error to create chat sector"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml POST /chat-sector
openapi: 3.0.3
info:
  title: WavUps CRM API
  description: >-
    API pública da plataforma WavUps CRM — gerencie leads, produtos, categorias,
    atendimentos, agendamentos, conversas e pipelines de CRM.
  version: 1.0.0
servers:
  - url: https://crm.wavups.com/api/v1
    description: Servidor de produção
security:
  - Token: []
paths:
  /chat-sector:
    post:
      tags:
        - Setores do Chat
      summary: Criar Setor do Chat
      description: Cria um novo setor de chat para organização de atendimentos.
      operationId: createChatSector
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - accountIntegration
              properties:
                name:
                  type: string
                accountIntegration:
                  type: string
                description:
                  type: string
                  nullable: true
                color:
                  type: string
                  nullable: true
                membersCanViewAllConversations:
                  type: boolean
                  default: true
      responses:
        '201':
          description: Setor criado com sucesso.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatSector'
        '400':
          $ref: f0d9652f-d415-482f-99a4-828a5560976c
        '500':
          $ref: '#/components/responses/Error500'
components:
  schemas:
    ChatSector:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        accountIntegration:
          type: string
        description:
          type: string
          nullable: true
        color:
          type: string
          nullable: true
        membersCanViewAllConversations:
          type: boolean
        createdAt:
          type: string
          format: date-time
    ErrorMessage:
      type: object
      properties:
        error:
          type: string
          example: Recurso não encontrado.
  responses:
    Error500:
      description: Erro interno no servidor.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorMessage'
  securitySchemes:
    Token:
      type: apiKey
      in: header
      name: Token
      description: Token de autenticacao gerado na plataforma WavUps CRM.

````