openapi: 3.1.0
info:
  title: SiteUp API
  version: 1.0.0
  description: |
    API completa da plataforma SiteUp.

    ## Recursos

    - **Atendimento**: contatos, conversas, mensagens, caixas multi-canal
    - **Kanban**: funnels, stages, items, atribuição de agentes
    - **Automação**: regras, webhooks, integrações
    - **Analytics**: relatórios, métricas
    - **Equipe**: agentes, times, perfis

    ## Autenticação

    Header `api_access_token: <seu-token>` na maioria dos endpoints. Endpoints `/public/api/v1/*` usam identificadores públicos.
  contact:
    name: Time SiteUp
    email: contato@siteup.com.br
    url: https://siteup.com.br
  license:
    name: Proprietary
servers:
  - url: https://app.siteup.com.br
    description: Produção
paths:
  /platform/api/v1/accounts:
    post:
      tags:
        - Contas
      operationId: create-an-account
      summary: Create an Account
      description: Create an Account
      security:
        - platformAppApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/account_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/platform_account"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /platform/api/v1/accounts/{account_id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Contas
      operationId: get-details-of-an-account
      summary: Get an account details
      description: Get the details of an account
      security:
        - platformAppApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/platform_account"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given account does not exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Contas
      operationId: update-an-account
      summary: Update an account
      description: Update an account's attributes
      security:
        - platformAppApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/account_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/platform_account"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Contas
      operationId: delete-an-account
      summary: Delete an Account
      description: Delete an Account
      security:
        - platformAppApiKey: []
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The account does not exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /platform/api/v1/accounts/{account_id}/account_users:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Usuários da Conta
      operationId: list-all-account-users
      summary: List all Account Users
      description: List all account users
      security:
        - platformAppApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/account_user"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Usuários da Conta
      operationId: create-an-account-user
      summary: Create an Account User
      description: Create an Account User
      security:
        - platformAppApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/account_user_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  account_id:
                    type: integer
                    description: The ID of the account
                  user_id:
                    type: integer
                    description: The ID of the user
                  role:
                    type: string
                    description: whether user is an administrator or agent
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Usuários da Conta
      operationId: delete-an-account-user
      summary: Delete an Account User
      description: Delete an Account User
      security:
        - platformAppApiKey: []
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The account does not exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /platform/api/v1/agent_bots:
    get:
      tags:
        - Bots
      operationId: list-all-agent-bots
      summary: List all AgentBots
      description: List all agent bots available
      security:
        - platformAppApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of agent bots
                items:
                  $ref: "#/components/schemas/agent_bot"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Bots
      operationId: create-an-agent-bot
      summary: Create an Agent Bot
      description: Create an agent bot
      security:
        - platformAppApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/platform_agent_bot_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/agent_bot"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /platform/api/v1/agent_bots/{id}:
    parameters:
      - $ref: "#/components/parameters/agent_bot_id"
    get:
      tags:
        - Bots
      operationId: get-details-of-a-single-agent-bot
      summary: Get an agent bot details
      description: Get the details of an agent bot
      security:
        - platformAppApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/agent_bot"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given agent bot ID does not exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Bots
      operationId: update-an-agent-bot
      summary: Update an agent bot
      description: Update an agent bot's attributes
      security:
        - platformAppApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/platform_agent_bot_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/agent_bot"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Bots
      operationId: delete-an-agent-bot
      summary: Delete an AgentBot
      description: Delete an AgentBot
      security:
        - platformAppApiKey: []
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The agent bot does not exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /platform/api/v1/users:
    post:
      tags:
        - Usuários
      operationId: create-a-user
      summary: Create a User
      description: Create a User
      security:
        - platformAppApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/user_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/user"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /platform/api/v1/users/{id}:
    parameters:
      - $ref: "#/components/parameters/platform_user_id"
    get:
      tags:
        - Usuários
      operationId: get-details-of-a-user
      summary: Get an user details
      description: Get the details of an user
      security:
        - platformAppApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/user"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given user does not exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Usuários
      operationId: update-a-user
      summary: Update a user
      description: Update a user's attributes
      security:
        - platformAppApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/user_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/user"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Usuários
      operationId: delete-a-user
      summary: Delete a User
      description: Delete a User
      security:
        - platformAppApiKey: []
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The user does not exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /platform/api/v1/users/{id}/login:
    parameters:
      - $ref: "#/components/parameters/platform_user_id"
    get:
      tags:
        - Usuários
      operationId: get-sso-url-of-a-user
      summary: Get User SSO Link
      description: Get the sso link of a user
      security:
        - platformAppApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    description: SSO url to autenticate the user
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given user does not exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /public/api/v1/inboxes/{inbox_identifier}:
    parameters:
      - $ref: "#/components/parameters/public_inbox_identifier"
    get:
      tags:
        - Inbox API
      operationId: get-details-of-a-inbox
      summary: Inbox details
      description: Get the details of an inbox
      security: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/public_inbox"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given inbox does not exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /public/api/v1/inboxes/{inbox_identifier}/contacts:
    parameters:
      - $ref: "#/components/parameters/public_inbox_identifier"
    post:
      tags:
        - API Pública - Contatos
      operationId: create-a-contact
      summary: Create a contact
      description: Create a contact
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/public_contact_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/public_contact"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}:
    parameters:
      - $ref: "#/components/parameters/public_inbox_identifier"
      - $ref: "#/components/parameters/public_contact_identifier"
    get:
      tags:
        - API Pública - Contatos
      operationId: get-details-of-a-contact
      summary: Get a contact
      description: Get the details of a contact
      security: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/public_contact"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given contact does not exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - API Pública - Contatos
      operationId: update-a-contact
      summary: Update a contact
      description: Update a contact's attributes
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/public_contact_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/public_contact_record"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations:
    parameters:
      - $ref: "#/components/parameters/public_inbox_identifier"
      - $ref: "#/components/parameters/public_contact_identifier"
    post:
      tags:
        - API Pública - Conversas
      operationId: create-a-conversation
      summary: Create a conversation
      description: Create a conversation
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/public_conversation_create_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/public_conversation"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    get:
      tags:
        - API Pública - Conversas
      operationId: list-all-contact-conversations
      summary: List all conversations
      description: List all conversations for the contact
      security: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of conversations
                items:
                  $ref: "#/components/schemas/public_conversation"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}:
    parameters:
      - $ref: "#/components/parameters/public_inbox_identifier"
      - $ref: "#/components/parameters/public_contact_identifier"
      - $ref: "#/components/parameters/conversation_id"
    get:
      tags:
        - API Pública - Conversas
      operationId: get-single-conversation
      summary: Get a single conversation
      description: Retrieves the details of a specific conversation
      security: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/public_conversation"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/toggle_status:
    parameters:
      - $ref: "#/components/parameters/public_inbox_identifier"
      - $ref: "#/components/parameters/public_contact_identifier"
      - $ref: "#/components/parameters/conversation_id"
    post:
      tags:
        - API Pública - Conversas
      operationId: resolve-conversation
      summary: Resolve a conversation
      description: Marks a conversation as resolved
      security: []
      responses:
        "200":
          description: Conversation resolved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/public_conversation"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/toggle_typing:
    parameters:
      - $ref: "#/components/parameters/public_inbox_identifier"
      - $ref: "#/components/parameters/public_contact_identifier"
      - $ref: "#/components/parameters/conversation_id"
    post:
      tags:
        - API Pública - Conversas
      operationId: toggle-typing-status
      summary: Toggle typing status
      description: Toggles the typing status in a conversation
      security: []
      parameters:
        - name: typing_status
          in: query
          required: true
          schema:
            type: string
          description: Typing status, either 'on' or 'off'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                typing_status:
                  type: string
                  enum:
                    - on
                    - off
                  description: The typing status to set
                  example: on
      responses:
        "200":
          description: Typing status toggled successfully
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/update_last_seen:
    parameters:
      - $ref: "#/components/parameters/public_inbox_identifier"
      - $ref: "#/components/parameters/public_contact_identifier"
      - $ref: "#/components/parameters/conversation_id"
    post:
      tags:
        - API Pública - Conversas
      operationId: update-last-seen
      summary: Update last seen
      description: Updates the last seen time of the contact in a conversation
      security: []
      responses:
        "200":
          description: Last seen updated successfully
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages:
    parameters:
      - $ref: "#/components/parameters/public_inbox_identifier"
      - $ref: "#/components/parameters/public_contact_identifier"
      - $ref: "#/components/parameters/conversation_id"
    post:
      tags:
        - API Pública - Mensagens
      operationId: create-a-message
      summary: Create a message
      description: Create a message
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/public_message_create_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/public_message"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    get:
      tags:
        - API Pública - Mensagens
      operationId: list-all-conversation-messages
      summary: List all messages
      description: List all messages in the conversation
      security: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of messages
                items:
                  $ref: "#/components/schemas/public_message"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations/{conversation_id}/messages/{message_id}:
    parameters:
      - $ref: "#/components/parameters/public_inbox_identifier"
      - $ref: "#/components/parameters/public_contact_identifier"
      - $ref: "#/components/parameters/conversation_id"
      - $ref: "#/components/parameters/message_id"
    patch:
      tags:
        - API Pública - Mensagens
      operationId: update-a-message
      summary: Update a message
      description: Update a message
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/public_message_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/public_message"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /survey/responses/{conversation_uuid}:
    parameters:
      - $ref: "#/components/parameters/conversation_uuid"
    get:
      tags:
        - Pesquisa CSAT
      operationId: get-csat-survey-page
      summary: Get CSAT survey page
      description: You can redirect the client to this URL, instead of implementing the CSAT survey component yourself.
      security: []
      responses:
        "200":
          description: Success
  /api/v1/accounts/{account_id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Account
      operationId: get-account-details
      summary: Get account details
      description: Get the details of the current account
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/account_show_response"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Account not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Account
      operationId: update-account
      summary: Update account
      description: Update account details, settings, and custom attributes
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/account_update_payload"
          application/x-www-form-urlencoded:
            schema:
              $ref: "#/components/schemas/account_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/account_detail"
        "401":
          description: Unauthorized (requires administrator role)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Account not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "422":
          description: Validation error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/audit_logs:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Audit Logs
      operationId: get-account-audit-logs
      summary: List Audit Logs in Account
      description: Get Details of Audit Log entries for an Account. This endpoint is only available in Enterprise editions and requires the audit_logs feature to be enabled.
      security:
        - userApiKey: []
      parameters:
        - name: page
          in: query
          description: Page number for pagination
          required: false
          schema:
            type: integer
            default: 1
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  per_page:
                    type: integer
                    description: Number of items per page
                    example: 15
                  total_entries:
                    type: integer
                    description: Total number of audit log entries
                    example: 150
                  current_page:
                    type: integer
                    description: Current page number
                    example: 1
                  audit_logs:
                    type: array
                    description: Array of audit log entries
                    items:
                      $ref: "#/components/schemas/audit_log"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "422":
          description: Feature not enabled or not available in current plan
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/agent_bots:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Bots da Conta
      operationId: list-all-account-agent-bots
      summary: List all AgentBots
      description: List all agent bots available for the current account
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of agent bots
                items:
                  $ref: "#/components/schemas/agent_bot"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Bots da Conta
      operationId: create-an-account-agent-bot
      summary: Create an Agent Bot
      description: Create an agent bot in the account
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/agent_bot_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/agent_bot"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/agent_bots/{id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/agent_bot_id"
    get:
      tags:
        - Bots da Conta
      operationId: get-details-of-a-single-account-agent-bot
      summary: Get an agent bot details
      description: Get the details of an agent bot in the account
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/agent_bot"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given agent bot ID does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Bots da Conta
      operationId: update-an-account-agent-bot
      summary: Update an agent bot
      description: Update an agent bot's attributes
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/agent_bot_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/agent_bot"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Bots da Conta
      operationId: delete-an-account-agent-bot
      summary: Delete an AgentBot
      description: Delete an AgentBot from the account
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The agent bot does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/agents:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Agentes
      operationId: get-account-agents
      summary: List Agents in Account
      description: Get Details of Agents in an Account
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of all active agents
                items:
                  $ref: "#/components/schemas/agent"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Agentes
      operationId: add-new-agent-to-account
      summary: Add a New Agent
      description: Add a new Agent to Account
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/agent_create_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/agent"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/agents/{id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
    patch:
      tags:
        - Agentes
      operationId: update-agent-in-account
      summary: Update Agent in Account
      description: Update an Agent in Account
      security:
        - userApiKey: []
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The ID of the agent to be updated.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/agent_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/agent"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Agent not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Agentes
      operationId: delete-agent-from-account
      summary: Remove an Agent from Account
      description: Remove an Agent from Account
      security:
        - userApiKey: []
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The ID of the agent to be deleted.
      responses:
        "200":
          description: Success
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Agent not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/canned_responses:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Respostas Prontas
      operationId: get-account-canned-response
      summary: List all Canned Responses in an Account
      description: Get Details of Canned Responses in an Account
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of all canned responses
                items:
                  $ref: "#/components/schemas/canned_response"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Respostas Prontas
      operationId: add-new-canned-response-to-account
      summary: Add a New Canned Response
      description: Add a new Canned Response to Account
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/canned_response_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/canned_response"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/canned_responses/{id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
    patch:
      tags:
        - Respostas Prontas
      operationId: update-canned-response-in-account
      summary: Update Canned Response in Account
      description: Update a Canned Response in Account
      security:
        - userApiKey: []
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The ID of the canned response to be updated.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/canned_response_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/canned_response"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Agent not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Respostas Prontas
      operationId: delete-canned-response-from-account
      summary: Remove a Canned Response from Account
      description: Remove a Canned Response from Account
      security:
        - userApiKey: []
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The ID of the canned response to be deleted
      responses:
        "200":
          description: Success
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Canned Response not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/custom_attribute_definitions:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Atributos Personalizados
      operationId: get-account-custom-attribute
      summary: List all custom attributes in an account
      parameters:
        - name: attribute_model
          in: query
          schema:
            type: string
            enum:
              - "0"
              - "1"
          description: conversation_attribute(0)/contact_attribute(1)
          required: true
      description: Get details of custom attributes in an Account
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of all custom attributes
                items:
                  $ref: "#/components/schemas/custom_attribute"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Atributos Personalizados
      operationId: add-new-custom-attribute-to-account
      summary: Add a new custom attribute
      description: Add a new custom attribute to account
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/custom_attribute_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/custom_attribute"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/custom_attribute_definitions/{id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - name: id
        in: path
        schema:
          type: number
        description: ID of the custom attribute
        required: true
    get:
      tags:
        - Atributos Personalizados
      operationId: get-details-of-a-single-custom-attribute
      summary: Get a custom attribute details
      security:
        - userApiKey: []
      description: Get the details of a custom attribute in the account
      parameters:
        - $ref: "#/components/parameters/account_id"
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The ID of the custom attribute to be updated.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/custom_attribute"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given attribute ID does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Atributos Personalizados
      operationId: update-custom-attribute-in-account
      summary: Update custom attribute in Account
      description: Update a custom attribute in account
      security:
        - userApiKey: []
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The ID of the custom attribute to be updated.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/custom_attribute_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/custom_attribute"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Agent not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Atributos Personalizados
      operationId: delete-custom-attribute-from-account
      summary: Remove a custom attribute from account
      description: Remove a custom attribute from account
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The ID of the custom attribute to be deleted
      responses:
        "200":
          description: Success
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Custom attribute not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/contacts:
    get:
      tags:
        - Contatos
      operationId: contactList
      description: Listing all the resolved contacts with pagination (Page size = 15). Resolved contacts are the ones with a value for identifier, email or phone number
      summary: List Contacts
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
        - $ref: "#/components/parameters/contact_sort_param"
        - $ref: "#/components/parameters/page"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contacts_list_response"
        "400":
          description: Bad Request Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Contatos
      operationId: contactCreate
      description: Create a new Contact
      summary: Create Contact
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/contact_create_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/extended_contact"
        "400":
          description: Bad Request Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/contacts/{id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - name: id
        in: path
        required: true
        schema:
          type: number
        description: ID of the contact
    get:
      tags:
        - Contatos
      operationId: contactDetails
      summary: Show Contact
      security:
        - userApiKey: []
      description: Get a contact belonging to the account using ID
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contact_show_response"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Contact not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    put:
      tags:
        - Contatos
      operationId: contactUpdate
      summary: Update Contact
      security:
        - userApiKey: []
      description: Update a contact belonging to the account using ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/contact_update_payload"
      responses:
        "204":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contact_base"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Contact not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Contatos
      operationId: contactDelete
      summary: Delete Contact
      security:
        - userApiKey: []
      description: Delete a contact belonging to the account using ID
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Contact not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/contacts/{id}/conversations:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - name: id
        in: path
        required: true
        schema:
          type: number
        description: ID of the contact
    get:
      tags:
        - Contatos
      operationId: contactConversations
      summary: Contact Conversations
      description: Get conversations associated with that contact
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: number
          description: ID of the contact
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contact_conversations_response"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Contact not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/contacts/{id}/labels:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - name: id
        in: path
        required: true
        schema:
          type: number
        description: ID of the contact
    get:
      tags:
        - Etiquetas de Contato
      operationId: list-all-labels-of-a-contact
      summary: List Labels
      description: Lists all the labels of a contact
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contact_labels"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Contact not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Etiquetas de Contato
      operationId: contact-add-labels
      summary: Add Labels
      description: Add labels to a contact. Note that this API would overwrite the existing list of labels associated to the conversation.
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - labels
              properties:
                labels:
                  type: array
                  description: Array of labels (comma-separated strings)
                  items:
                    type: string
                  example:
                    - support
                    - billing
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contact_labels"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Contact not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/contacts/search:
    get:
      tags:
        - Contatos
      operationId: contactSearch
      description: Search the resolved contacts using a search key, currently supports email search (Page size = 15). Resolved contacts are the ones with a value for identifier, email or phone number
      summary: Search Contacts
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
        - name: q
          in: query
          schema:
            type: string
          description: Search using contact `name`, `identifier`, `email` or `phone number`
        - $ref: "#/components/parameters/contact_sort_param"
        - $ref: "#/components/parameters/page"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contacts_list_response"
        "401":
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/contacts/filter:
    post:
      tags:
        - Contatos
      operationId: contactFilter
      description: Filter contacts with custom filter options and pagination
      summary: Contact Filter
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
        - name: page
          in: query
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                payload:
                  type: array
                  items:
                    type: object
                    properties:
                      attribute_key:
                        type: string
                        description: filter attribute name
                      filter_operator:
                        type: string
                        description: filter operator name
                        enum:
                          - equal_to
                          - not_equal_to
                          - contains
                          - does_not_contain
                      values:
                        type: array
                        items:
                          type: string
                        description: array of the attribute values to filter
                      query_operator:
                        type: string
                        description: query operator name
                        enum:
                          - AND
                          - OR
                  example:
                    - attribute_key: name
                      filter_operator: equal_to
                      values:
                        - en
                      query_operator: AND
                    - attribute_key: country_code
                      filter_operator: equal_to
                      values:
                        - us
                      query_operator: null
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contacts_list_response"
        "400":
          description: Bad Request Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/contacts/{id}/contact_inboxes:
    post:
      tags:
        - Contatos
      operationId: contactInboxCreation
      description: Create a contact inbox record for an inbox
      summary: Create contact inbox
      parameters:
        - $ref: "#/components/parameters/account_id"
        - name: id
          in: path
          schema:
            type: number
          description: ID of the contact
          required: true
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - inbox_id
              properties:
                inbox_id:
                  type: number
                  description: The ID of the inbox
                  example: 1
                source_id:
                  type: string
                  description: Contact Inbox Source Id
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contact_inboxes"
        "401":
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "422":
          description: Incorrect payload
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/contacts/{id}/contactable_inboxes:
    get:
      tags:
        - Contatos
      operationId: contactableInboxesGet
      description: Get List of contactable Inboxes
      summary: Get Contactable Inboxes
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
        - name: id
          in: path
          schema:
            type: number
          description: ID of the contact
          required: true
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contactable_inboxes_response"
        "401":
          description: Authentication error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "422":
          description: Incorrect payload
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/actions/contact_merge:
    parameters:
      - $ref: "#/components/parameters/account_id"
    post:
      tags:
        - Contatos
      operationId: contactMerge
      summary: Merge Contacts
      security:
        - userApiKey: []
      description: |
        Merge two contacts into a single contact. The base contact remains and receives all
        data from the mergee contact. After the merge, the mergee contact is permanently deleted.

        This action is irreversible. All conversations, labels, and custom attributes from the
        mergee contact will be moved to the base contact.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - base_contact_id
                - mergee_contact_id
              properties:
                base_contact_id:
                  type: integer
                  description: ID of the contact that will remain after the merge and receive all data
                  example: 1
                mergee_contact_id:
                  type: integer
                  description: ID of the contact that will be merged into the base contact and deleted
                  example: 2
      responses:
        "200":
          description: Contacts merged successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/contact_base"
        "400":
          description: Bad request - invalid contact IDs or contacts cannot be merged
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: One or both contacts not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/automation_rules:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Regras de Automação
      operationId: get-account-automation-rule
      summary: List all automation rules in an account
      parameters:
        - $ref: "#/components/parameters/account_id"
        - $ref: "#/components/parameters/page"
      description: Get details of automation rules in an Account
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/automation_rule"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Regras de Automação
      operationId: add-new-automation-rule-to-account
      summary: Add a new automation rule
      description: Add a new automation rule to account
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/automation_rule_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/automation_rule"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/automation_rules/{id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - name: id
        in: path
        schema:
          type: number
        description: ID of the Automation Rule
        required: true
    get:
      tags:
        - Regras de Automação
      operationId: get-details-of-a-single-automation-rule
      summary: Get a automation rule details
      description: Get the details of a automation rule in the account
      security:
        - userApiKey: []
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The ID of the automation rule to be updated.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/automation_rule"
              example:
                payload:
                  id: 90
                  account_id: 1
                  name: add-label-bug-if-message-contains-bug
                  description: add-label-bug-if-message-contains-bug
                  event_name: message_created
                  conditions:
                    - values:
                        - incoming
                      attribute_key: message_type
                      query_operator: and
                      filter_operator: equal_to
                    - values:
                        - bug
                      attribute_key: content
                      filter_operator: contains
                  actions:
                    - action_name: add_label
                      action_params:
                        - bugs
                        - support-query
                  created_on: 1650555440
                  active: true
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given rule ID does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Regras de Automação
      operationId: update-automation-rule-in-account
      summary: Update automation rule in Account
      description: Update a automation rule in account
      security:
        - userApiKey: []
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The ID of the automation rule to be updated.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/automation_rule_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/automation_rule"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Rule not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Regras de Automação
      operationId: delete-automation-rule-from-account
      summary: Remove a automation rule from account
      description: Remove a automation rule from account
      security:
        - userApiKey: []
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The ID of the automation rule to be deleted
      responses:
        "200":
          description: Success
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: automation rule not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/portals:
    parameters:
      - $ref: "#/components/parameters/account_id"
    post:
      tags:
        - Central de Ajuda
      operationId: add-new-portal-to-account
      summary: Add a new portal
      description: Add a new portal to account
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/portal_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/portal"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    get:
      tags:
        - Central de Ajuda
      operationId: get-portal
      summary: List all portals in an account
      parameters:
        - $ref: "#/components/parameters/account_id"
      description: Get details of portals in an Account
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/portal"
              example:
                payload:
                  - id: 4
                    color: "#1F93FF"
                    custom_domain: siteup.help
                    header_text: Handbook
                    homepage_link: https://siteup.com.br
                    name: Handbook
                    page_title: Handbook
                    slug: handbook
                    archived: false
                    account_id: 1
                    config:
                      allowed_locales:
                        - code: en
                          articles_count: 32
                          categories_count: 9
                    inbox:
                      id: 37
                      avatar_url: https://example.com/avatar.png
                      channel_id: 1
                      name: SiteUp
                      channel_type: Channel::WebWidget
                      greeting_enabled: true
                      widget_color: "#1F93FF"
                      website_url: SiteUp.com
                    logo:
                      id: 19399916
                      portal_id: 4
                      file_type: image/png
                      account_id: 1
                      file_url: https://example.com/logo.png
                      blob_id: 21239614
                      filename: square.png
                    meta:
                      all_articles_count: 0
                      categories_count: 9
                      default_locale: en
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/portals/{id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/portal_id"
    patch:
      tags:
        - Central de Ajuda
      operationId: update-portal-to-account
      summary: Update a portal
      description: Update a portal to account
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
        - $ref: "#/components/parameters/portal_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/portal_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/portal_single"
              example:
                payload:
                  id: 123
                  archived: false
                  color: "#1F93FF"
                  config:
                    allowed_locales:
                      - code: en
                        articles_count: 32
                        categories_count: 9
                  custom_domain: siteup.help
                  header_text: Handbook
                  homepage_link: https://siteup.com.br
                  name: Handbook
                  slug: handbook
                  page_title: Handbook
                  account_id: 123
                  inbox:
                    id: 123
                    name: SiteUp
                    website_url: SiteUp.com
                    channel_type: Channel::WebWidget
                    avatar_url: https://example.com/avatar.png
                    widget_color: "#1F93FF"
                    website_token: 4cWzuf9i9jxN9tbnv8K9STKU
                    enable_auto_assignment: true
                    web_widget_script: <script>...</script>
                    welcome_title: Hi there ! 🙌🏼
                    welcome_tagline: We make it simple to connect with us.
                    greeting_enabled: true
                    greeting_message: Hey there 👋, Thank you for reaching out to us.
                    channel_id: 123
                    working_hours_enabled: true
                    enable_email_collect: true
                    csat_survey_enabled: true
                    timezone: America/Los_Angeles
                    business_name: SiteUp
                    hmac_mandatory: true
                  logo:
                    id: 123
                    portal_id: 123
                    file_type: image/png
                    account_id: 123
                    file_url: https://example.com/logo.png
                    blob_id: 123
                    filename: square.png
                  meta:
                    all_articles_count: 32
                    categories_count: 9
                    default_locale: en
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Portal not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/portals/{id}/categories:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/portal_id"
    post:
      tags:
        - Central de Ajuda
      operationId: add-new-category-to-account
      summary: Add a new category
      description: Add a new category to portal
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/category_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/category"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/portals/{id}/articles:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/portal_id"
    post:
      tags:
        - Central de Ajuda
      operationId: add-new-article-to-account
      summary: Add a new article
      description: Add a new article to portal
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/article_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/article"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/meta:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Conversas
      operationId: conversationListMeta
      description: Get open, unassigned and all Conversation counts
      summary: Get Conversation Counts
      security:
        - userApiKey: []
      parameters:
        - name: status
          in: query
          schema:
            type: string
            enum:
              - all
              - open
              - resolved
              - pending
              - snoozed
            default: open
          description: Filter by conversation status.
        - name: q
          in: query
          schema:
            type: string
          description: Filters conversations with messages containing the search term
        - name: inbox_id
          in: query
          schema:
            type: integer
        - name: team_id
          in: query
          schema:
            type: integer
        - name: labels
          in: query
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    type: object
                    properties:
                      mine_count:
                        type: number
                      unassigned_count:
                        type: number
                      assigned_count:
                        type: number
                      all_count:
                        type: number
        "400":
          description: Bad Request Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Conversas
      operationId: conversationList
      description: List all the conversations with pagination
      summary: Conversations List
      security:
        - userApiKey: []
      parameters:
        - name: assignee_type
          in: query
          schema:
            type: string
            enum:
              - me
              - unassigned
              - all
              - assigned
            default: all
          description: Filter conversations by assignee type.
        - name: status
          in: query
          schema:
            type: string
            enum:
              - all
              - open
              - resolved
              - pending
              - snoozed
            default: open
          description: Filter by conversation status.
        - name: q
          in: query
          schema:
            type: string
          description: Filters conversations with messages containing the search term
        - name: inbox_id
          in: query
          schema:
            type: integer
        - name: team_id
          in: query
          schema:
            type: integer
        - name: labels
          in: query
          schema:
            type: array
            items:
              type: string
        - name: page
          in: query
          schema:
            type: integer
            default: 1
          description: paginate through conversations
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/conversation_list"
        "400":
          description: Bad Request Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Conversas
      operationId: newConversation
      summary: Create New Conversation
      description: |-
        Creating a conversation in SiteUp requires a source id.

         Learn more about source_id: https://siteup.com.br
      security:
        - userApiKey: []
        - agentBotApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/conversation_create_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: number
                    description: ID of the conversation
                  account_id:
                    type: number
                    description: Account Id
                  inbox_id:
                    type: number
                    description: ID of the inbox
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/filter:
    parameters:
      - $ref: "#/components/parameters/account_id"
    post:
      tags:
        - Conversas
      operationId: conversationFilter
      description: Filter conversations with custom filter options and pagination
      summary: Conversations Filter
      security:
        - userApiKey: []
      parameters:
        - name: page
          in: query
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                payload:
                  type: array
                  items:
                    type: object
                    properties:
                      attribute_key:
                        type: string
                        description: filter attribute name
                      filter_operator:
                        type: string
                        description: filter operator name
                        enum:
                          - equal_to
                          - not_equal_to
                          - contains
                          - does_not_contain
                      values:
                        type: array
                        items:
                          type: string
                        description: array of the attribute values to filter
                      query_operator:
                        type: string
                        description: query operator name
                        enum:
                          - AND
                          - OR
                  example:
                    - attribute_key: browser_language
                      filter_operator: not_equal_to
                      values:
                        - en
                      query_operator: AND
                    - attribute_key: status
                      filter_operator: equal_to
                      values:
                        - pending
                      query_operator: null
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/conversation_list"
        "400":
          description: Bad Request Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/conversation_id"
    get:
      tags:
        - Conversas
      operationId: get-details-of-a-conversation
      summary: Conversation Details
      security:
        - userApiKey: []
      description: Get all details regarding a conversation with all messages in the conversation
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/conversation_show"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Conversas
      operationId: update-conversation
      summary: Update Conversation
      description: Update Conversation Attributes
      security:
        - userApiKey: []
        - agentBotApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                priority:
                  type: string
                  enum:
                    - urgent
                    - high
                    - medium
                    - low
                    - none
                  description: The priority of the conversation
                  example: high
                sla_policy_id:
                  type: number
                  description: The ID of the SLA policy (Available only in Enterprise edition)
                  example: 1
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/conversation"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/toggle_status:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/conversation_id"
    post:
      tags:
        - Conversas
      operationId: toggle-status-of-a-conversation
      summary: Toggle Status
      description: |-
        Toggle the status of a conversation. Pass `status` to explicitly set the
        conversation state. Use `snoozed` along with `snoozed_until` to snooze a
        conversation until a specific time. If `snoozed_until` is omitted, the
        conversation is snoozed until the next reply from the contact. Regardless
        of the value provided, snoozed conversations always reopen on the next
        reply from the contact.
      security:
        - userApiKey: []
        - agentBotApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - status
              properties:
                status:
                  type: string
                  enum:
                    - open
                    - resolved
                    - pending
                    - snoozed
                  description: The status of the conversation
                  example: open
                snoozed_until:
                  type: number
                  description: When status is `snoozed`, schedule the reopen time as a Unix timestamp in seconds. If not provided, the conversation is snoozed until the next customer reply. The conversation always reopens when the customer replies.
                  example: 1757506877
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    type: object
                  payload:
                    type: object
                    properties:
                      success:
                        type: boolean
                      current_status:
                        type: string
                        enum:
                          - open
                          - resolved
                          - pending
                          - snoozed
                      conversation_id:
                        type: number
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/toggle_priority:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/conversation_id"
    post:
      tags:
        - Conversas
      operationId: toggle-priority-of-a-conversation
      summary: Toggle Priority
      description: Toggles the priority of conversation
      security:
        - userApiKey: []
        - agentBotApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - priority
              properties:
                priority:
                  type: string
                  enum:
                    - urgent
                    - high
                    - medium
                    - low
                    - none
                  description: The priority of the conversation
                  example: high
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/toggle_typing_status:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/conversation_id"
    post:
      tags:
        - Conversas
      operationId: toggle-typing-status-of-a-conversation
      summary: Toggle Typing Status
      description: Toggles the typing status for a conversation.
      security:
        - userApiKey: []
        - agentBotApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - typing_status
              properties:
                typing_status:
                  type: string
                  enum:
                    - on
                    - off
                  description: Typing status to set.
                  example: on
                is_private:
                  type: boolean
                  description: Whether the typing event is for private notes.
                  example: false
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/custom_attributes:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/conversation_id"
    post:
      tags:
        - Conversas
      operationId: update-custom-attributes-of-a-conversation
      summary: Update Custom Attributes
      description: Updates the custom attributes of a conversation
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - custom_attributes
              properties:
                custom_attributes:
                  type: object
                  description: The custom attributes to be set for the conversation
                  example:
                    order_id: "12345"
                    previous_conversation: "67890"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  custom_attributes:
                    type: object
                    description: The custom attributes of the conversation
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/assignments:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/conversation_id"
    post:
      tags:
        - Atribuição de Conversas
      operationId: assign-a-conversation
      summary: Assign Conversation
      description: Assign a conversation to an agent or a team
      security:
        - userApiKey: []
        - agentBotApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                assignee_id:
                  type: number
                  description: Id of the assignee user
                  example: 1
                team_id:
                  type: number
                  description: Id of the team. If the assignee_id is present, this param would be ignored
                  example: 1
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/user"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/labels:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/conversation_id"
    get:
      tags:
        - Conversas
      operationId: list-all-labels-of-a-conversation
      summary: List Labels
      security:
        - userApiKey: []
      description: Lists all the labels of a conversation
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/conversation_labels"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Conversas
      operationId: conversation-add-labels
      summary: Add Labels
      security:
        - userApiKey: []
      description: Add labels to a conversation. Note that this API would overwrite the existing list of labels associated to the conversation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - labels
              properties:
                labels:
                  type: array
                  description: Array of labels (comma-separated strings)
                  items:
                    type: string
                  example:
                    - support
                    - billing
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/conversation_labels"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/reporting_events:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/conversation_id"
    get:
      tags:
        - Conversas
      operationId: get-conversation-reporting-events
      summary: Conversation Reporting Events
      security:
        - userApiKey: []
      description: Get reporting events for a specific conversation. This endpoint returns events such as first response time, resolution time, and other metrics for the conversation, sorted by creation time in ascending order.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/reporting_event"
                description: Array of reporting events for the conversation
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/inboxes:
    get:
      tags:
        - Caixas de Entrada
      operationId: listAllInboxes
      summary: List all inboxes
      description: List all inboxes available in the current account
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  payload:
                    type: array
                    description: Array of inboxes
                    items:
                      $ref: "#/components/schemas/inbox"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Inbox not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Caixas de Entrada
      operationId: inboxCreation
      summary: Create an inbox
      description: You can create more than one website inbox in each account
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/inbox_create_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/inbox"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Inbox not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/inboxes/{id}:
    get:
      tags:
        - Caixas de Entrada
      operationId: GetInbox
      summary: Get an inbox
      security:
        - userApiKey: []
      description: Get an inbox available in the current account
      parameters:
        - $ref: "#/components/parameters/account_id"
        - name: id
          in: path
          schema:
            type: number
          description: ID of the inbox
          required: true
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/inbox"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Inbox not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Caixas de Entrada
      operationId: updateInbox
      summary: Update Inbox
      security:
        - userApiKey: []
      description: Update an existing inbox
      parameters:
        - $ref: "#/components/parameters/account_id"
        - name: id
          in: path
          schema:
            type: number
          description: ID of the inbox
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/inbox_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/inbox"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Inbox not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/inboxes/{id}/agent_bot:
    get:
      tags:
        - Caixas de Entrada
      operationId: getInboxAgentBot
      summary: Show Inbox Agent Bot
      description: See if an agent bot is associated to the Inbox
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
        - name: id
          in: path
          schema:
            type: number
          description: ID of the inbox
          required: true
      responses:
        "204":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/agent_bot"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Inbox not found, Agent bot not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/inboxes/{id}/set_agent_bot:
    post:
      tags:
        - Caixas de Entrada
      operationId: updateAgentBot
      summary: Add or remove agent bot
      security:
        - userApiKey: []
      description: To add an agent bot pass agent_bot id, to remove agent bot from an inbox pass null
      parameters:
        - $ref: "#/components/parameters/account_id"
        - name: id
          in: path
          schema:
            type: number
          description: ID of the inbox
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - agent_bot
              properties:
                agent_bot:
                  type: number
                  description: Agent bot ID
                  example: 1
      responses:
        "204":
          description: Success
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Inbox not found, Agent bot not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/inbox_members/{inbox_id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/inbox_id"
    get:
      tags:
        - Caixas de Entrada
      operationId: get-inbox-members
      summary: List Agents in Inbox
      description: Get Details of Agents in an Inbox
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/inbox_id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  payload:
                    type: array
                    description: Array of all active agents
                    items:
                      $ref: "#/components/schemas/agent"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Inbox not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/inbox_members:
    parameters:
      - $ref: "#/components/parameters/account_id"
    post:
      tags:
        - Caixas de Entrada
      operationId: add-new-agent-to-inbox
      summary: Add a New Agent
      description: Add a new Agent to Inbox
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - inbox_id
                - user_ids
              properties:
                inbox_id:
                  type: integer
                  description: The ID of the inbox
                  example: 1
                user_ids:
                  type: array
                  items:
                    type: integer
                  description: IDs of users to be added to the inbox
                  example:
                    - 1
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  payload:
                    type: array
                    description: Array of all active agents
                    items:
                      $ref: "#/components/schemas/agent"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Inbox not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "422":
          description: User must exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Caixas de Entrada
      operationId: update-agents-in-inbox
      summary: Update Agents in Inbox
      description: All agents except the one passed in params will be removed
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - inbox_id
                - user_ids
              properties:
                inbox_id:
                  type: string
                  description: The ID of the inbox
                  example: 1
                user_ids:
                  type: array
                  items:
                    type: integer
                  description: IDs of users to be added to the inbox
                  example:
                    - 1
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  payload:
                    type: array
                    description: Array of all active agents
                    items:
                      $ref: "#/components/schemas/agent"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Inbox not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "422":
          description: User must exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Caixas de Entrada
      operationId: delete-agent-in-inbox
      summary: Remove an Agent from Inbox
      description: Remove an Agent from Inbox
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - inbox_id
                - user_ids
              properties:
                inbox_id:
                  type: string
                  description: The ID of the inbox
                user_ids:
                  type: array
                  items:
                    type: integer
                  description: IDs of users to be deleted from the inbox
      responses:
        "200":
          description: Success
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Inbox not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "422":
          description: User must exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/labels:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Etiquetas
      operationId: list-all-labels
      summary: List all labels
      security:
        - userApiKey: []
      description: List all labels available in the current account
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  payload:
                    type: array
                    description: Array of labels
                    items:
                      $ref: "#/components/schemas/label"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Etiquetas
      operationId: create-a-label
      summary: Create a label
      security:
        - userApiKey: []
      description: Create a label in the account
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/label_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/label"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/labels/{id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - name: id
        in: path
        required: true
        schema:
          type: number
        description: ID of the label
    get:
      tags:
        - Etiquetas
      operationId: get-details-of-a-single-label
      summary: Get a label
      security:
        - userApiKey: []
      description: Get the details of a label in the account
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/label"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given label ID does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Etiquetas
      operationId: update-a-label
      summary: Update a label
      security:
        - userApiKey: []
      description: Update a label's attributes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/label_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/label"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Etiquetas
      operationId: delete-a-label
      summary: Delete a label
      security:
        - userApiKey: []
      description: Delete a label from the account
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The label does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/messages:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/conversation_id"
    get:
      tags:
        - Mensagens
      operationId: list-all-messages
      summary: Get messages
      security:
        - userApiKey: []
      description: List all messages of a conversation
      parameters:
        - name: after
          in: query
          schema:
            type: integer
          description: Fetch messages after the message with this ID. Returns up to 100 messages in ascending order.
        - name: before
          in: query
          schema:
            type: integer
          description: Fetch messages before the message with this ID. Returns up to 20 messages in ascending order.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    type: object
                    properties:
                      labels:
                        type: array
                        items:
                          type: string
                      additional_attributes:
                        type: object
                      contact:
                        $ref: "#/components/schemas/contact"
                      assignee:
                        $ref: "#/components/schemas/agent"
                      agent_last_seen_at:
                        type:
                          - string
                          - "null"
                        format: date-time
                      assignee_last_seen_at:
                        type:
                          - string
                          - "null"
                        format: date-time
                  payload:
                    type: array
                    description: Array of messages
                    items:
                      $ref: "#/components/schemas/message"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Mensagens
      operationId: create-a-new-message-in-a-conversation
      summary: Create New Message
      description: |
        Create a new message in the conversation.

        ## WhatsApp Template Messages

        For WhatsApp channels, you can send structured template messages using the `template_params` field.
        Templates must be pre-approved in WhatsApp Business Manager.

        ### Example Templates

        **Text with Image Header:**
        ```json
        {
          "content": "Hi your order 121212 is confirmed. Please wait for further updates",
          "template_params": {
            "name": "order_confirmation",
            "category": "MARKETING",
            "language": "en",
            "processed_params": {
              "body": {
                "1": "121212"
              },
              "header": {
                "media_url": "https://picsum.photos/200/300",
                "media_type": "image"
              }
            }
          }
        }
        ```

        **Text with Copy Code Button:**
        ```json
        {
          "content": "Special offer! Get 30% off your next purchase. Use the code below",
          "template_params": {
            "name": "discount_coupon",
            "category": "MARKETING",
            "language": "en",
            "processed_params": {
              "body": {
                "discount_percentage": "30"
              },
              "buttons": [{
                "type": "copy_code",
                "parameter": "SAVE20"
              }]
            }
          }
        }
        ```
      security:
        - userApiKey: []
        - agentBotApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/conversation_message_create_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/generic_id"
                  - $ref: "#/components/schemas/message"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Conversation not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/messages/{message_id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/conversation_id"
      - $ref: "#/components/parameters/message_id"
    delete:
      tags:
        - Mensagens
      operationId: delete-a-message
      summary: Delete a message
      security:
        - userApiKey: []
      description: Delete a message and it's attachments from the conversation.
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The message or conversation does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/integrations/apps:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Integrações
      operationId: get-details-of-all-integrations
      summary: List all the Integrations
      security:
        - userApiKey: []
      description: Get the details of all Integrations available for the account
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  payload:
                    type: array
                    description: Array of Integration apps
                    items:
                      $ref: "#/components/schemas/integrations_app"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Url not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/integrations/hooks:
    post:
      tags:
        - Integrações
      operationId: create-an-integration-hook
      summary: Create an integration hook
      description: Create an integration hook
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/integrations_hook_create_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/integrations_hook"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/integrations/hooks/{hook_id}:
    patch:
      tags:
        - Integrações
      operationId: update-an-integrations-hook
      summary: Update an Integration Hook
      description: Update an Integration Hook
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
        - $ref: "#/components/parameters/hook_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/integrations_hook_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/integrations_hook"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Integrações
      operationId: delete-an-integration-hook
      summary: Delete an Integration Hook
      description: Delete an Integration Hook
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
        - $ref: "#/components/parameters/hook_id"
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The hook does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/profile:
    get:
      tags:
        - Perfil
      operationId: fetchProfile
      summary: Fetch user profile
      description: Get the user profile details
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/user"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    put:
      tags:
        - Perfil
      operationId: updateProfile
      summary: Update user profile
      description: Update the user profile details
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - profile
              properties:
                profile:
                  type: object
                  properties:
                    name:
                      type: string
                    email:
                      type: string
                    display_name:
                      type: string
                    message_signature:
                      type: string
                    phone_number:
                      type: string
                    current_password:
                      type: string
                    password:
                      type: string
                    password_confirmation:
                      type: string
                    ui_settings:
                      type: object
          multipart/form-data:
            schema:
              type: object
              required:
                - profile
              properties:
                profile:
                  type: object
                  properties:
                    name:
                      type: string
                    email:
                      type: string
                    display_name:
                      type: string
                    message_signature:
                      type: string
                    phone_number:
                      type: string
                    current_password:
                      type: string
                    password:
                      type: string
                    password_confirmation:
                      type: string
                    avatar:
                      type: string
                      format: binary
                    ui_settings:
                      type: object
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/user"
        "401":
          description: Unauthorized
  /api/v1/accounts/{account_id}/teams:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Times
      operationId: list-all-teams
      summary: List all teams
      security:
        - userApiKey: []
      description: List all teams available in the current account
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of teams
                items:
                  $ref: "#/components/schemas/team"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Times
      operationId: create-a-team
      summary: Create a team
      security:
        - userApiKey: []
      description: Create a team in the account
      parameters:
        - $ref: "#/components/parameters/account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/team_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/team"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/teams/{team_id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/team_id"
    get:
      tags:
        - Times
      operationId: get-details-of-a-single-team
      summary: Get a team details
      security:
        - userApiKey: []
      description: Get the details of a team in the account
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/team"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given team ID does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Times
      operationId: update-a-team
      summary: Update a team
      security:
        - userApiKey: []
      description: Update a team's attributes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/team_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/team"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Times
      operationId: delete-a-team
      summary: Delete a team
      security:
        - userApiKey: []
      description: Delete a team from the account
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The team does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/teams/{team_id}/team_members:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/team_id"
    get:
      tags:
        - Times
      operationId: get-team-members
      summary: List Agents in Team
      description: Get Details of Agents in an Team
      security:
        - userApiKey: []
      parameters:
        - $ref: "#/components/parameters/account_id"
        - $ref: "#/components/parameters/team_id"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of all agents in the team
                items:
                  $ref: "#/components/schemas/agent"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Team not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Times
      operationId: add-new-agent-to-team
      summary: Add a New Agent
      description: Add a new Agent to Team
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user_ids
              properties:
                user_ids:
                  type: array
                  items:
                    type: integer
                  description: IDs of users to be added to the team
                  example:
                    - 1
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of all active agents
                items:
                  $ref: "#/components/schemas/agent"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Team not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "422":
          description: User must exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Times
      operationId: update-agents-in-team
      summary: Update Agents in Team
      description: All agents except the one passed in params will be removed
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user_ids
              properties:
                user_ids:
                  type: array
                  items:
                    type: integer
                  description: IDs of users to be added to the team
                  example:
                    - 1
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of all agents in the team
                items:
                  $ref: "#/components/schemas/agent"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Team not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "422":
          description: User must exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Times
      operationId: delete-agent-in-team
      summary: Remove an Agent from Team
      description: Remove an Agent from Team
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user_ids
              properties:
                user_ids:
                  type: array
                  items:
                    type: integer
                  description: IDs of users to be deleted from the team
      responses:
        "200":
          description: Success
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: Team not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "422":
          description: User must exist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/custom_filters:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - in: query
        name: filter_type
        schema:
          type: string
          enum:
            - conversation
            - contact
            - report
        required: false
        description: The type of custom filter
    get:
      tags:
        - Filtros Personalizados
      operationId: list-all-filters
      summary: List all custom filters
      description: List all custom filters in a category of a user
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of custom filters
                items:
                  $ref: "#/components/schemas/custom_filter"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Filtros Personalizados
      operationId: create-a-custom-filter
      summary: Create a custom filter
      description: Create a custom filter in the account
      parameters:
        - $ref: "#/components/parameters/account_id"
      security:
        - userApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/custom_filter_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/custom_filter"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/custom_filters/{custom_filter_id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/custom_filter_id"
    get:
      tags:
        - Filtros Personalizados
      operationId: get-details-of-a-single-custom-filter
      summary: Get a custom filter details
      description: Get the details of a custom filter in the account
      security:
        - userApiKey: []
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/custom_filter"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The given team ID does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    patch:
      tags:
        - Filtros Personalizados
      operationId: update-a-custom-filter
      summary: Update a custom filter
      security:
        - userApiKey: []
      description: Update a custom filter's attributes
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/custom_filter_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/custom_filter"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Filtros Personalizados
      operationId: delete-a-custom-filter
      summary: Delete a custom filter
      security:
        - userApiKey: []
      description: Delete a custom filter from the account
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: The custom filter does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/webhooks:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Webhooks
      operationId: list-all-webhooks
      summary: List all webhooks
      security:
        - userApiKey: []
      description: List all webhooks in the account
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of webhook objects
                items:
                  $ref: "#/components/schemas/webhook"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    post:
      tags:
        - Webhooks
      operationId: create-a-webhook
      summary: Add a webhook
      security:
        - userApiKey: []
      description: Add a webhook subscription to the account
      parameters:
        - $ref: "#/components/parameters/account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/webhook_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/webhook"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/webhooks/{webhook_id}:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/webhook_id"
    patch:
      tags:
        - Webhooks
      operationId: update-a-webhook
      summary: Update a webhook object
      security:
        - userApiKey: []
      description: Update a webhook object in the account
      parameters:
        - $ref: "#/components/parameters/account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/webhook_create_update_payload"
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/webhook"
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
    delete:
      tags:
        - Webhooks
      operationId: delete-a-webhook
      summary: Delete a webhook
      security:
        - userApiKey: []
      description: Delete a webhook from the account
      responses:
        "200":
          description: Success
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
        "404":
          description: The webhook does not exist in the account
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/reporting_events:
    parameters:
      - $ref: "#/components/parameters/account_id"
    get:
      tags:
        - Relatórios
      operationId: get-account-reporting-events
      summary: Account Reporting Events
      security:
        - userApiKey: []
      description: Get paginated reporting events for the account. This endpoint returns reporting events such as first response time, resolution time, and other metrics. Only administrators can access this endpoint. Results are paginated with 25 items per page.
      parameters:
        - $ref: "#/components/parameters/page"
        - in: query
          name: since
          schema:
            type: string
          description: The timestamp from where events should start (Unix timestamp in seconds)
        - in: query
          name: until
          schema:
            type: string
          description: The timestamp from where events should stop (Unix timestamp in seconds)
        - in: query
          name: inbox_id
          schema:
            type: number
          description: Filter events by inbox ID
        - in: query
          name: user_id
          schema:
            type: number
          description: Filter events by user/agent ID
        - in: query
          name: name
          schema:
            type: string
          description: Filter events by event name (e.g., first_response, resolution, reply_time)
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/reporting_events_list_response"
        "403":
          description: Access denied - Only administrators can access this endpoint
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/reports:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/report_metric"
      - $ref: "#/components/parameters/report_type"
      - in: query
        name: id
        schema:
          type: string
        description: The Id of specific object in case of agent/inbox/label
      - in: query
        name: since
        schema:
          type: string
        description: The timestamp from where report should start.
      - in: query
        name: until
        schema:
          type: string
        description: The timestamp from where report should stop.
    get:
      tags:
        - Relatórios
      operationId: list-all-conversation-statistics
      summary: Get Account reports
      security:
        - userApiKey: []
      description: Get Account reports for a specific type, metric and date range
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of date based conversation statistics
                items:
                  type: object
                  properties:
                    value:
                      type: string
                    timestamp:
                      type: number
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: reports not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/reports/summary:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - $ref: "#/components/parameters/report_type"
      - in: query
        name: id
        schema:
          type: string
        description: The Id of specific object in case of agent/inbox/label
      - in: query
        name: since
        schema:
          type: string
        description: The timestamp from where report should start.
      - in: query
        name: until
        schema:
          type: string
        description: The timestamp from where report should stop.
    get:
      tags:
        - Relatórios
      operationId: list-all-conversation-statistics-summary
      summary: Get Account reports summary
      security:
        - userApiKey: []
      description: Get Account reports summary for a specific type and date range
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/account_summary"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: reports not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/reports/conversations:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - in: query
        name: type
        schema:
          type: string
          enum:
            - account
        required: true
        description: Type of report
    get:
      tags:
        - Relatórios
      operationId: get-account-conversation-metrics
      summary: Account Conversation Metrics
      security:
        - userApiKey: []
      description: Get conversation metrics for Account
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: object
                description: Object of account conversation metrics
                properties:
                  open:
                    type: number
                  unattended:
                    type: number
                  unassigned:
                    type: number
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: reports not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/reports/conversations/:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - in: query
        name: type
        schema:
          type: string
          enum:
            - agent
        required: true
        description: Type of report
      - in: query
        name: user_id
        schema:
          type: string
        description: The numeric ID of the user
    get:
      tags:
        - Relatórios
      operationId: get-agent-conversation-metrics
      summary: Agent Conversation Metrics
      security:
        - userApiKey: []
      description: Get conversation metrics for Agent
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                type: array
                description: Array of agent based conversation metrics
                items:
                  $ref: "#/components/schemas/agent_conversation_metrics"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "404":
          description: reports not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/summary_reports/channel:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - in: query
        name: since
        schema:
          type: string
        description: The timestamp from where report should start (Unix timestamp).
      - in: query
        name: until
        schema:
          type: string
        description: The timestamp from where report should stop (Unix timestamp).
    get:
      tags:
        - Relatórios
      operationId: get-channel-summary-report
      summary: Get conversation statistics grouped by channel type
      security:
        - userApiKey: []
      description: |
        Get conversation counts grouped by channel type and status for a given date range.
        Returns statistics for each channel type including open, resolved, pending, snoozed, and total conversation counts.

        **Note:** This API endpoint is available only in SiteUp version 4.10.0 and above. The date range is limited to a maximum of 6 months.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/channel_summary"
        "400":
          description: Date range exceeds 6 months limit
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/summary_reports/inbox:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - in: query
        name: since
        schema:
          type: string
        description: The timestamp from where report should start (Unix timestamp).
      - in: query
        name: until
        schema:
          type: string
        description: The timestamp from where report should stop (Unix timestamp).
      - in: query
        name: business_hours
        schema:
          type: boolean
        description: Whether to calculate metrics using business hours only.
    get:
      tags:
        - Relatórios
      operationId: get-inbox-summary-report
      summary: Get conversation statistics grouped by inbox
      security:
        - userApiKey: []
      description: |
        Get conversation statistics grouped by inbox for a given date range.
        Returns metrics for each inbox including conversation counts, resolution counts,
        average first response time, average resolution time, and average reply time.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/inbox_summary"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/summary_reports/agent:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - in: query
        name: since
        schema:
          type: string
        description: The timestamp from where report should start (Unix timestamp).
      - in: query
        name: until
        schema:
          type: string
        description: The timestamp from where report should stop (Unix timestamp).
      - in: query
        name: business_hours
        schema:
          type: boolean
        description: Whether to calculate metrics using business hours only.
    get:
      tags:
        - Relatórios
      operationId: get-agent-summary-report
      summary: Get conversation statistics grouped by agent
      security:
        - userApiKey: []
      description: |
        Get conversation statistics grouped by agent for a given date range.
        Returns metrics for each agent including conversation counts, resolution counts,
        average first response time, average resolution time, and average reply time.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/agent_summary"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/summary_reports/team:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - in: query
        name: since
        schema:
          type: string
        description: The timestamp from where report should start (Unix timestamp).
      - in: query
        name: until
        schema:
          type: string
        description: The timestamp from where report should stop (Unix timestamp).
      - in: query
        name: business_hours
        schema:
          type: boolean
        description: Whether to calculate metrics using business hours only.
    get:
      tags:
        - Relatórios
      operationId: get-team-summary-report
      summary: Get conversation statistics grouped by team
      security:
        - userApiKey: []
      description: |
        Get conversation statistics grouped by team for a given date range.
        Returns metrics for each team including conversation counts, resolution counts,
        average first response time, average resolution time, and average reply time.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/team_summary"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/reports/first_response_time_distribution:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - in: query
        name: since
        schema:
          type: string
        description: The timestamp from where report should start (Unix timestamp).
      - in: query
        name: until
        schema:
          type: string
        description: The timestamp from where report should stop (Unix timestamp).
    get:
      tags:
        - Relatórios
      operationId: get-first-response-time-distribution
      summary: Get first response time distribution by channel
      security:
        - userApiKey: []
      description: |
        Get the distribution of first response times grouped by channel type.
        Returns conversation counts in different time buckets (0-1h, 1-4h, 4-8h, 8-24h, 24h+) for each channel type.

        **Note:** This API endpoint is available only in SiteUp version 4.11.0 and above.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/first_response_time_distribution"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/reports/inbox_label_matrix:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - in: query
        name: since
        schema:
          type: string
        description: The timestamp from where report should start (Unix timestamp).
      - in: query
        name: until
        schema:
          type: string
        description: The timestamp from where report should stop (Unix timestamp).
      - in: query
        name: inbox_ids
        schema:
          type: array
          items:
            type: integer
        description: Filter by specific inbox IDs.
      - in: query
        name: label_ids
        schema:
          type: array
          items:
            type: integer
        description: Filter by specific label IDs.
    get:
      tags:
        - Relatórios
      operationId: get-inbox-label-matrix
      summary: Get inbox-label matrix report
      security:
        - userApiKey: []
      description: |
        Get a matrix showing the count of conversations for each inbox-label combination.
        Returns a list of inboxes, labels, and a 2D matrix where each cell contains the count of conversations
        in a specific inbox that have a specific label applied.

        **Note:** This API endpoint is available only in SiteUp version 4.11.0 and above.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/inbox_label_matrix"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v2/accounts/{account_id}/reports/outgoing_messages_count:
    parameters:
      - $ref: "#/components/parameters/account_id"
      - in: query
        name: since
        schema:
          type: string
        description: The timestamp from where report should start (Unix timestamp).
      - in: query
        name: until
        schema:
          type: string
        description: The timestamp from where report should stop (Unix timestamp).
    get:
      tags:
        - Relatórios
      operationId: get-outgoing-messages-count
      summary: Get outgoing messages count grouped by entity
      security:
        - userApiKey: []
      description: |
        Get the count of outgoing messages grouped by a specified entity (agent, team, inbox, or label).
        When grouped by agent, messages sent by bots (AgentBot, Captain::Assistant) are excluded.

        **Note:** This API endpoint is available only in SiteUp version 4.11.0 and above.
      parameters:
        - in: query
          name: group_by
          required: true
          schema:
            type: string
            enum:
              - agent
              - team
              - inbox
              - label
          description: The entity to group outgoing message counts by.
      responses:
        "200":
          description: Success
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/outgoing_messages_count"
        "403":
          description: Access denied
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/bad_request_error"
  /api/v1/accounts/{account_id}/funnels:
    get:
      tags:
        - Funis
      summary: Listar funnels
      description: Retorna todos os funis de vendas da conta ordenados por nome
      operationId: listFunnels
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: Lista de funnels retornada com sucesso
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/Funnel"
              example:
                - id: 1
                  name: Funnel de Vendas
                  description: Funnel principal de vendas
                  active: true
                  account_id: 1
                  created_at: 2024-01-15T10:00:00Z
                  updated_at: 2024-01-15T10:00:00Z
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
    post:
      tags:
        - Funis
      summary: Criar funnel
      description: Cria um novo funil de vendas com validação de IDs únicos de etapas
      operationId: createFunnel
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados do funil a ser criado
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FunnelCreate"
            example:
              funnel:
                name: Novo Funnel
                description: Descrição do funil
                active: true
                stages:
                  lead:
                    name: Lead
                    color: "#3b82f6"
                    id: lead_1
                  prospect:
                    name: Prospecto
                    color: "#f59e0b"
                    id: prospect_1
                  customer:
                    name: Cliente
                    color: "#10b981"
                    id: customer_1
      responses:
        "201":
          description: Funnel criado com sucesso
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Funnel"
        "400":
          $ref: "#/components/responses/BadRequest"
        "403":
          description: Limite de funnels atingido
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FunnelLimitError"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/funnels/{id}:
    get:
      tags:
        - Funis
      summary: Obter funnel
      description: Retorna detalhes de um funil específico
      operationId: getFunnel
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do funil
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: Funnel encontrado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Funnel"
        "404":
          $ref: "#/components/responses/NotFound"
    put:
      tags:
        - Funis
      summary: Atualizar funnel
      description: Atualiza um funil de vendas existente
      operationId: updateFunnel
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do funil
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados do funil a ser atualizado
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FunnelUpdate"
            example:
              funnel:
                name: Funnel Atualizado
                description: Nova descrição
                active: true
      responses:
        "200":
          description: Funnel atualizado com sucesso
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Funnel"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
    delete:
      tags:
        - Funis
      summary: Excluir funnel
      description: Exclui um funil de vendas
      operationId: deleteFunnel
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do funil
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: Funnel excluído com sucesso
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/funnels/{id}/stage_stats:
    get:
      tags:
        - Funis
      summary: Estatísticas por etapa
      description: |
        Retorna estatísticas dos itens por etapa do funil (name, color, description, count, total_value).
        Aceita filtros opcionais: prioridades, agente, valor, datas e exibição de won/lost.
      operationId: getFunnelStageStats
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do funil
          schema:
            type: integer
          example: 1
        - name: priorities
          in: query
          description: Filtrar por prioridades (array)
          schema:
            type: array
            items:
              type: string
          example:
            - high
            - medium
        - name: agent_id
          in: query
          description: ID do agente; use -1 para itens não atribuídos
          schema:
            type: string
          example: "1"
        - name: value_min
          in: query
          description: Valor mínimo do item
          schema:
            type: number
        - name: value_max
          in: query
          description: Valor máximo do item
          schema:
            type: number
        - name: date_start
          in: query
          description: Filtrar itens criados a partir desta data
          schema:
            type: string
            format: date-time
        - name: date_end
          in: query
          description: Filtrar itens criados até esta data
          schema:
            type: string
            format: date-time
        - name: show_won
          in: query
          description: Incluir itens com status won (default true)
          schema:
            type: string
            enum:
              - "true"
              - "false"
            default: "true"
        - name: show_lost
          in: query
          description: Incluir itens com status lost (default true)
          schema:
            type: string
            enum:
              - "true"
              - "false"
            default: "true"
      responses:
        "200":
          description: Estatísticas das etapas (stages com name, color, description, count, total_value; total_items)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StageStats"
              example:
                stages:
                  lead:
                    name: Lead
                    color: "#3b82f6"
                    description: null
                    count: 5
                    total_value: 5000
                  prospect:
                    name: Prospecto
                    color: "#f59e0b"
                    description: null
                    count: 3
                    total_value: 3000
                  customer:
                    name: Cliente
                    color: "#10b981"
                    description: null
                    count: 2
                    total_value: 2000
                total_items: 10
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/offers:
    get:
      tags:
        - Ofertas
      summary: Listar ofertas
      description: Retorna todas as ofertas da conta
      operationId: listOffers
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: Lista de ofertas retornada com sucesso
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
              example:
                - id: 123
                  title: Oferta Black Friday
                  value: "99.9"
                  currency: BRL
                  type: main
                  product_link: https://exemplo.com/produto
                  offer_group_id: 10
                  offer_group_name: Grupo Principal
                  additional_data:
                    orderbump_offer_ids:
                      - 2
                      - 3
                  created_at: 2026-04-07T10:11:12.000Z
                  updated_at: 2026-04-07T10:11:12.000Z
                  image_url: null
                  usage_items_count: 4
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
    post:
      tags:
        - Ofertas
      summary: Criar oferta
      description: Cria uma nova oferta para a conta
      operationId: createOffer
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados da oferta a ser criada
        content:
          application/json:
            schema:
              type: object
              required:
                - offer
              properties:
                offer:
                  type: object
                  properties:
                    title:
                      type: string
                    value:
                      type: number
                    currency:
                      type: string
                    type:
                      type: string
                    product_link:
                      type: string
                      format: uri
                    offer_group_id:
                      type:
                        - integer
                        - "null"
                    additional_data:
                      type: object
                      additionalProperties: true
            example:
              offer:
                title: Oferta Black Friday
                value: 99.9
                currency: BRL
                type: main
                product_link: https://exemplo.com/produto
                offer_group_id: 10
                additional_data:
                  orderbump_offer_ids:
                    - 2
                    - 3
      responses:
        "201":
          description: Oferta criada com sucesso
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                id: 124
                title: Nova Oferta
                value: "129.9"
                currency: BRL
                type: main
                product_link: https://exemplo.com/nova-oferta
                offer_group_id: 10
                offer_group_name: Grupo Principal
                additional_data:
                  orderbump_offer_ids:
                    - 2
                created_at: 2026-04-07T10:20:00.000Z
                updated_at: 2026-04-07T10:20:00.000Z
                image_url: null
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/offers/search:
    get:
      tags:
        - Ofertas
      summary: Buscar ofertas por texto
      description: Retorna ofertas que correspondem ao texto pesquisado
      operationId: searchOffers
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: query
          in: query
          required: true
          description: Texto para busca
          schema:
            type: string
          example: black
      responses:
        "200":
          description: Lista de ofertas filtradas retornada com sucesso
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
              example:
                - id: 123
                  title: Oferta Black Friday
                  value: "99.9"
                  currency: BRL
                  type: main
                  product_link: https://exemplo.com/produto
                  offer_group_id: 10
                  offer_group_name: Grupo Principal
                  additional_data:
                    orderbump_offer_ids:
                      - 2
                      - 3
                  created_at: 2026-04-07T10:11:12.000Z
                  updated_at: 2026-04-07T10:11:12.000Z
                  image_url: null
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
  /api/v1/accounts/{account_id}/offers/{id}:
    get:
      tags:
        - Ofertas
      summary: Buscar oferta por ID
      description: Retorna os dados de uma oferta específica
      operationId: getOffer
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID da oferta
          schema:
            type: integer
          example: 123
      responses:
        "200":
          description: Oferta encontrada
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                id: 123
                title: Oferta Black Friday
                value: "99.9"
                currency: BRL
                type: main
                product_link: https://exemplo.com/produto
                offer_group_id: 10
                offer_group_name: Grupo Principal
                additional_data:
                  orderbump_offer_ids:
                    - 2
                    - 3
                created_at: 2026-04-07T10:11:12.000Z
                updated_at: 2026-04-07T10:11:12.000Z
                image_url: null
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
    patch:
      tags:
        - Ofertas
      summary: Atualizar oferta
      description: Atualiza os dados de uma oferta existente
      operationId: updateOffer
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID da oferta
          schema:
            type: integer
          example: 123
      requestBody:
        required: true
        description: Dados da oferta a ser atualizada
        content:
          application/json:
            schema:
              type: object
              required:
                - offer
              properties:
                offer:
                  type: object
                  properties:
                    title:
                      type: string
                    value:
                      type: number
                    currency:
                      type: string
                    type:
                      type: string
                    product_link:
                      type: string
                      format: uri
                    offer_group_id:
                      type:
                        - integer
                        - "null"
                    additional_data:
                      type: object
                      additionalProperties: true
            example:
              offer:
                title: Oferta atualizada
                value: 129.9
                offer_group_id: null
      responses:
        "200":
          description: Oferta atualizada com sucesso
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
              example:
                id: 123
                title: Oferta atualizada
                value: "149.9"
                currency: BRL
                type: main
                product_link: https://exemplo.com/oferta-atualizada
                offer_group_id: null
                offer_group_name: null
                additional_data:
                  orderbump_offer_ids:
                    - 3
                    - 4
                created_at: 2026-04-07T10:11:12.000Z
                updated_at: 2026-04-07T10:25:00.000Z
                image_url: null
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
    delete:
      tags:
        - Ofertas
      summary: Deletar oferta
      description: Exclui uma oferta existente
      operationId: deleteOffer
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID da oferta
          schema:
            type: integer
          example: 123
      responses:
        "200":
          description: Oferta deletada com sucesso
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items:
    get:
      tags:
        - Itens Kanban
      summary: Listar kanban items
      description: Retorna todos os itens do Kanban com paginação e filtros
      operationId: listKanbanItems
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: funnel_id
          in: query
          required: true
          description: ID do funil
          schema:
            type: integer
          example: 1
        - name: stage_id
          in: query
          description: ID da etapa para filtrar
          schema:
            type: string
          example: lead
        - name: agent_id
          in: query
          description: ID do agente para filtrar
          schema:
            type: integer
          example: 1
        - name: conversation
          in: query
          description: ID da conversa (display_id) para filtrar itens vinculados a essa conversa
          schema:
            type: integer
          example: 123
        - name: page
          in: query
          description: "Número da página (padrão: 1)"
          schema:
            type: integer
            default: 1
          example: 1
      responses:
        "200":
          description: Lista de kanban items com paginação
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItemsResponse"
              example:
                items:
                  - id: 1
                    funnel_id: 1
                    funnel_stage: lead
                    position: 1
                    item_details:
                      title: Novo Lead
                      description: Descrição do lead
                      priority: high
                      value: 1000
                pagination:
                  current_page: 1
                  total_count: 50
                  has_more: true
                  items_per_page: 50
        "400":
          $ref: "#/components/responses/BadRequest"
    post:
      tags:
        - Itens Kanban
      summary: Criar kanban item
      description: Cria um novo item no Kanban
      operationId: createKanbanItem
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados do item a ser criado
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/KanbanItemCreate"
            example:
              kanban_item:
                funnel_id: 1
                funnel_stage: lead
                position: 1
                conversation_display_id: 123
                item_details:
                  title: Novo Lead
                  description: Descrição do lead
                  status: open
                  priority: high
                  value: 1000
                  conversation_id: 123
      responses:
        "201":
          description: Kanban item criado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/kanban_items/reorder:
    post:
      tags:
        - Itens Kanban
      summary: Reordenar kanban items
      description: Reordena os itens do Kanban em suas respectivas etapas
      operationId: reorderKanbanItems
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados de reordenação
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ReorderRequest"
            example:
              positions:
                - id: 1
                  position: 1
                  funnel_stage: lead
                - id: 2
                  position: 2
                  funnel_stage: lead
                - id: 3
                  position: 1
                  funnel_stage: prospect
      responses:
        "200":
          description: Items reordenados com sucesso
        "400":
          $ref: "#/components/responses/BadRequest"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/kanban_items/{id}:
    get:
      tags:
        - Itens Kanban
      summary: Obter kanban item
      description: Retorna detalhes de um item específico com cache
      operationId: getKanbanItem
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: Kanban item encontrado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "404":
          $ref: "#/components/responses/NotFound"
    put:
      tags:
        - Itens Kanban
      summary: Atualizar kanban item
      description: Atualiza um item do Kanban
      operationId: updateKanbanItem
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados do item a ser atualizado
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/KanbanItemUpdate"
            example:
              kanban_item:
                funnel_stage: prospect
                position: 2
                item_details:
                  title: Lead Atualizado
                  priority: medium
      responses:
        "200":
          description: Kanban item atualizado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
    delete:
      tags:
        - Itens Kanban
      summary: Excluir kanban item
      description: Exclui um item do Kanban
      operationId: deleteKanbanItem
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: Kanban item excluído com sucesso
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/move_to_stage:
    post:
      tags:
        - Itens Kanban
      summary: Mover item para etapa
      description: Move um item do Kanban para uma etapa específica
      operationId: moveKanbanItemToStage
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
        - name: funnel_stage
          in: query
          required: true
          description: Nova etapa do item
          schema:
            type: string
          example: prospect
        - name: funnel_id
          in: query
          description: ID do funil
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: Item movido para etapa com sucesso
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/move:
    post:
      tags:
        - Itens Kanban
      summary: Mover item
      description: Move um item do Kanban para outro funil/etapa
      operationId: moveKanbanItem
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
        - name: funnel_id
          in: query
          required: true
          description: ID do funil de destino
          schema:
            type: integer
          example: 1
        - name: funnel_stage
          in: query
          required: true
          description: Etapa de destino
          schema:
            type: string
          example: prospect
      responses:
        "200":
          description: Item movido com sucesso
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/create_checklist_item:
    post:
      tags:
        - Checklist
      summary: Criar item do checklist
      description: Adiciona um novo item ao checklist do kanban item
      operationId: createChecklistItem
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados do item do checklist
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Texto do item do checklist
                  example: Fazer follow-up com o cliente
              required:
                - text
            example:
              text: Fazer follow-up com o cliente
      responses:
        "200":
          description: Item do checklist criado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/create_note:
    post:
      tags:
        - Notas
      summary: Criar nota
      description: Adiciona uma nova nota ao kanban item
      operationId: createNote
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados da nota
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: Texto da nota
                  example: Cliente interessado no produto premium
              required:
                - text
            example:
              text: Cliente interessado no produto premium
      responses:
        "200":
          description: Nota criada
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/assign_agent:
    post:
      tags:
        - Agentes (Kanban)
      summary: Atribuir agente
      description: Atribui um agente ao kanban item
      operationId: assignAgent
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados da atribuição
        content:
          application/json:
            schema:
              type: object
              properties:
                agent_id:
                  type: integer
                  description: ID do agente
                  example: 1
              required:
                - agent_id
            example:
              agent_id: 1
      responses:
        "200":
          description: Agente atribuído
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/kanban_items/{id}/remove_agent:
    delete:
      tags:
        - Agentes (Kanban)
      summary: Remover agente
      description: Remove um agente do kanban item
      operationId: removeAgent
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados da remoção
        content:
          application/json:
            schema:
              type: object
              properties:
                agent_id:
                  type: integer
                  description: ID do agente
                  example: 1
              required:
                - agent_id
            example:
              agent_id: 1
      responses:
        "200":
          description: Agente removido
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/kanban_items/{id}/assigned_agents:
    get:
      tags:
        - Agentes (Kanban)
      summary: Listar agentes atribuídos
      description: Retorna os agentes atribuídos ao kanban item
      operationId: getAssignedAgents
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: Agentes atribuídos
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AssignedAgentsResponse"
              example:
                assigned_agents:
                  - id: 1
                    name: João Silva
                    email: joao@example.com
                    avatar_url: https://example.com/avatar.jpg
                    availability_status: online
                primary_agent:
                  id: 1
                  name: João Silva
                  email: joao@example.com
                  avatar_url: https://example.com/avatar.jpg
                  availability_status: online
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/change_status:
    post:
      tags:
        - Itens Kanban
      summary: Mudar status
      description: Muda o status do kanban item (won, lost, open)
      operationId: changeStatus
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Novo status
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  description: Novo status do item
                  enum:
                    - won
                    - lost
                    - open
                  example: won
              required:
                - status
            example:
              status: won
      responses:
        "200":
          description: Status alterado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/kanban_items/{id}/assign_agent_to_checklist_item:
    post:
      tags:
        - Checklist
      summary: Atribuir agente ao item do checklist
      description: Atribui um agente a um item específico do checklist
      operationId: assignAgentToChecklistItem
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados da atribuição
        content:
          application/json:
            schema:
              type: object
              properties:
                checklist_item_id:
                  type: string
                  description: ID do item do checklist
                  example: uuid-123
                agent_id:
                  type: integer
                  description: ID do agente
                  example: 1
              required:
                - checklist_item_id
                - agent_id
            example:
              checklist_item_id: uuid-123
              agent_id: 1
      responses:
        "200":
          description: Agente atribuído ao item do checklist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/remove_agent_from_checklist_item:
    delete:
      tags:
        - Checklist
      summary: Remover agente do item do checklist
      description: Remove um agente de um item específico do checklist
      operationId: removeAgentFromChecklistItem
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados da remoção
        content:
          application/json:
            schema:
              type: object
              properties:
                checklist_item_id:
                  type: string
                  description: ID do item do checklist
                  example: uuid-123
              required:
                - checklist_item_id
            example:
              checklist_item_id: uuid-123
      responses:
        "200":
          description: Agente removido do item do checklist
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/reports:
    get:
      tags:
        - Itens Kanban
      summary: Relatórios de kanban items
      description: Retorna métricas e relatórios dos itens (from, to, funnel_id, channel, user_ids[])
      operationId: reportsKanbanItems
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: funnel_id
          in: query
          schema:
            type: integer
          example: 2
        - name: from
          in: query
          description: Timestamp início (segundos ou milissegundos)
          schema:
            type: integer
          example: 1711929600
        - name: to
          in: query
          description: Timestamp fim (segundos ou milissegundos)
          schema:
            type: integer
          example: 1714521600
        - name: channel
          in: query
          description: "Canal para filtrar relatórios (ex: Whatsapp)"
          schema:
            type: string
          example: Whatsapp
        - name: user_ids
          in: query
          description: "IDs dos agentes para filtrar (ex: user_ids[]=5&user_ids[]=9)"
          style: form
          explode: true
          schema:
            type: array
            items:
              type: integer
          example:
            - 5
            - 9
      responses:
        "200":
          description: Métricas de relatório
          content:
            application/json:
              schema:
                type: object
              example:
                date_range:
                  from: 1711929600
                  to: 1714521600
                filters:
                  funnel_id: 2
                  channel: Whatsapp
                  user_ids:
                    - 5
                    - 9
                totals:
                  total_items: 42
                  won_items: 10
                  lost_items: 6
                  open_items: 26
                  total_value: 12500.75
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
  /api/v1/accounts/{account_id}/kanban_items/search:
    get:
      tags:
        - Itens Kanban
      summary: Buscar kanban items
      description: Busca itens por texto (title, description, customer_name, customer_email)
      operationId: searchKanbanItems
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: query
          in: query
          required: true
          schema:
            type: string
          example: cliente
        - name: funnel_id
          in: query
          schema:
            type: integer
      responses:
        "200":
          description: Lista de itens encontrados
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: "#/components/schemas/KanbanItem"
                  total:
                    type: integer
                  query:
                    type: string
        "401":
          $ref: "#/components/responses/Unauthorized"
  /api/v1/accounts/{account_id}/kanban_items/filter:
    get:
      tags:
        - Itens Kanban
      summary: Filtrar kanban items
      description: Filtra itens por prioridades, valor, agente, conversa, datas (priorities, value_min, value_max, agent_id, conversation, date_start, date_end, scheduled_date_start, scheduled_date_end)
      operationId: filterKanbanItems
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: funnel_id
          in: query
          schema:
            type: integer
        - name: priorities
          in: query
          schema:
            type: array
            items:
              type: string
        - name: value_min
          in: query
          schema:
            type: number
        - name: value_max
          in: query
          schema:
            type: number
        - name: agent_id
          in: query
          schema:
            type: integer
        - name: conversation
          in: query
          description: ID da conversa (display_id) para filtrar itens vinculados a essa conversa
          schema:
            type: integer
          example: 123
        - name: date_start
          in: query
          schema:
            type: string
            format: date
        - name: date_end
          in: query
          schema:
            type: string
            format: date
        - name: scheduled_date_start
          in: query
          schema:
            type: string
            format: date
        - name: scheduled_date_end
          in: query
          schema:
            type: string
            format: date
      responses:
        "200":
          description: Lista de itens filtrados
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: "#/components/schemas/KanbanItem"
                  total:
                    type: integer
                  filters:
                    type: object
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
  /api/v1/accounts/{account_id}/kanban_items/export:
    get:
      tags:
        - Itens Kanban
      summary: Exportar kanban items (CSV)
      description: Exporta itens do funil em CSV (funnel_id obrigatório; filtros opcionais)
      operationId: exportKanbanItems
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: funnel_id
          in: query
          required: true
          schema:
            type: integer
        - name: priorities
          in: query
          schema:
            type: array
            items:
              type: string
        - name: value_min
          in: query
          schema:
            type: number
        - name: value_max
          in: query
          schema:
            type: number
        - name: agent_id
          in: query
          schema:
            type: integer
        - name: date_start
          in: query
          schema:
            type: string
            format: date
        - name: date_end
          in: query
          schema:
            type: string
            format: date
        - name: scheduled_date_start
          in: query
          schema:
            type: string
            format: date
        - name: scheduled_date_end
          in: query
          schema:
            type: string
            format: date
      responses:
        "200":
          description: Arquivo CSV
          content:
            text/csv:
              schema:
                type: string
                format: binary
        "400":
          $ref: "#/components/responses/BadRequest"
        "403":
          $ref: "#/components/responses/Forbidden"
  /api/v1/accounts/{account_id}/kanban_items/import:
    post:
      tags:
        - Itens Kanban
      summary: Importar kanban items (CSV)
      description: Importa itens a partir de CSV (funnel_id, file, mappings, default_stage_id)
      operationId: importKanbanItems
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                funnel_id:
                  type: integer
                default_stage_id:
                  type: string
                mappings:
                  type: object
                  additionalProperties:
                    type: string
                file:
                  type: string
                  format: binary
      responses:
        "200":
          description: Resultado da importação (created_count, error_count, errors)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  created_count:
                    type: integer
                  error_count:
                    type: integer
                  total_rows:
                    type: integer
                  errors:
                    type: array
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/kanban_items/bulk_move_items:
    post:
      tags:
        - Itens Kanban
      summary: Mover múltiplos itens de etapa
      description: Move vários itens para uma nova etapa (item_ids, new_stage, funnel_id opcional)
      operationId: bulkMoveKanbanItems
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                item_ids:
                  type: array
                  items:
                    type: integer
                  example:
                    - 1
                    - 2
                    - 3
                new_stage:
                  type: string
                  example: prospect
                funnel_id:
                  type: integer
              required:
                - item_ids
                - new_stage
      responses:
        "200":
          description: moved_count, total_requested, errors, new_stage
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  moved_count:
                    type: integer
                  total_requested:
                    type: integer
                  errors:
                    type: array
                  new_stage:
                    type: string
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/bulk_assign_agent:
    post:
      tags:
        - Itens Kanban
      summary: Atribuir agente em massa
      description: "Atribui um agente a múltiplos itens (item_ids, agent_id, mode: replace ou add)"
      operationId: bulkAssignAgent
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                item_ids:
                  type: array
                  items:
                    type: integer
                agent_id:
                  type: integer
                mode:
                  type: string
                  enum:
                    - replace
                    - add
                  default: replace
              required:
                - item_ids
                - agent_id
      responses:
        "200":
          description: assigned_count, total_requested, errors, agent_id, agent_name, mode
          content:
            application/json:
              schema:
                type: object
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/bulk_set_priority:
    post:
      tags:
        - Itens Kanban
      summary: Definir prioridade em massa
      description: "Aplica prioridade a múltiplos itens (item_ids, priority: high, medium, low, urgent, none)"
      operationId: bulkSetPriority
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                item_ids:
                  type: array
                  items:
                    type: integer
                priority:
                  type: string
                  enum:
                    - high
                    - medium
                    - low
                    - urgent
                    - none
              required:
                - item_ids
                - priority
      responses:
        "200":
          description: updated_count, total_requested, errors, priority
          content:
            application/json:
              schema:
                type: object
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/get_notes:
    get:
      tags:
        - Notas
      summary: Listar notas do item
      description: Retorna as notas do kanban item
      operationId: getNotes
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: item_id, notes, notes_count
          content:
            application/json:
              schema:
                type: object
                properties:
                  item_id:
                    type: integer
                  notes:
                    type: array
                  notes_count:
                    type: integer
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/update_note:
    patch:
      tags:
        - Notas
      summary: Atualizar nota
      description: Atualiza uma nota do item (note_id no body; text, attachments, linked_item_id, linked_conversation_id, linked_contact_id)
      operationId: updateNote
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                note_id:
                  type: string
                  description: ID da nota
                text:
                  type: string
                attachments:
                  type: array
                linked_item_id:
                  type: integer
                linked_conversation_id:
                  type: integer
                linked_contact_id:
                  type: integer
              required:
                - note_id
      responses:
        "200":
          description: Kanban item atualizado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/delete_note:
    delete:
      tags:
        - Notas
      summary: Excluir nota
      description: Remove uma nota do item (note_id no body ou query)
      operationId: deleteNote
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
        - name: note_id
          in: query
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                note_id:
                  type: string
      responses:
        "200":
          description: Kanban item atualizado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/get_checklist:
    get:
      tags:
        - Checklist
      summary: Listar checklist do item
      description: Retorna o checklist do kanban item
      operationId: getChecklist
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: item_id, checklist, checklist_count
          content:
            application/json:
              schema:
                type: object
                properties:
                  item_id:
                    type: integer
                  checklist:
                    type: array
                  checklist_count:
                    type: object
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/delete_checklist_item:
    delete:
      tags:
        - Checklist
      summary: Excluir item do checklist
      description: Remove um item do checklist (checklist_item_id)
      operationId: deleteChecklistItem
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
        - name: checklist_item_id
          in: query
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Kanban item atualizado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/update_checklist_item:
    patch:
      tags:
        - Checklist
      summary: Atualizar item do checklist
      description: Atualiza um item do checklist (checklist_item_id; text, due_date, priority, agent_id, linked_*)
      operationId: updateChecklistItem
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                checklist_item_id:
                  type: string
                text:
                  type: string
                due_date:
                  type: string
                  format: date-time
                priority:
                  type: string
                agent_id:
                  type: integer
                linked_item_id:
                  type: integer
                linked_conversation_id:
                  type: integer
                linked_contact_id:
                  type: integer
              required:
                - checklist_item_id
      responses:
        "200":
          description: Kanban item atualizado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/toggle_checklist_item:
    post:
      tags:
        - Checklist
      summary: Marcar/desmarcar item do checklist
      description: Alterna o status completed de um item do checklist (checklist_item_id)
      operationId: toggleChecklistItem
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                checklist_item_id:
                  type: string
                  description: ID do item do checklist
              required:
                - checklist_item_id
      responses:
        "200":
          description: Kanban item atualizado
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/KanbanItem"
        "400":
          $ref: "#/components/responses/BadRequest"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/time_report:
    get:
      tags:
        - Itens Kanban
      summary: Relatório de tempo do item
      description: Retorna tempo total gasto no item (timer_duration + sessão atual se timer rodando)
      operationId: timeReport
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: item_id, total_duration_seconds, total_duration_formatted, timer_started_at, is_timer_running
          content:
            application/json:
              schema:
                type: object
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/stage_time_breakdown:
    get:
      tags:
        - Itens Kanban
      summary: Tempo por etapa
      description: Retorna o tempo gasto em cada etapa do funil para o item
      operationId: stageTimeBreakdown
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: item_id, stage_breakdown, total_stages
          content:
            application/json:
              schema:
                type: object
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/duplicate_checklist:
    post:
      tags:
        - Checklist
      summary: Duplicar checklist para outro item
      description: Copia o checklist deste item para outro (target_item_id; merge=true para mesclar)
      operationId: duplicateChecklist
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item origem
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                target_item_id:
                  type: integer
                merge:
                  type: string
                  enum:
                    - "true"
                    - "false"
                  description: Se true, mescla com checklist existente do destino
              required:
                - target_item_id
      responses:
        "200":
          description: source_item_id, target_item_id, duplicated_items_count, total_items_count
          content:
            application/json:
              schema:
                type: object
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/kanban_items/{id}/search_checklist:
    get:
      tags:
        - Checklist
      summary: Buscar no checklist
      description: Busca itens do checklist por texto (query)
      operationId: searchChecklist
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
        - name: query
          in: query
          schema:
            type: string
      responses:
        "200":
          description: item_id, query, total_items, filtered_items, checklist
          content:
            application/json:
              schema:
                type: object
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/counts:
    get:
      tags:
        - Itens Kanban
      summary: Contagens do item
      description: Retorna contagem de notas, checklist e anexos
      operationId: countsKanbanItem
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: item_id, notes_count, checklist_count, attachments_count
          content:
            application/json:
              schema:
                type: object
              example:
                item_id: 123
                notes_count: 8
                checklist_count: 14
                attachments_count: 3
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/kanban_items/{id}/checklist_progress_by_agent:
    get:
      tags:
        - Itens Kanban
      summary: Progresso do checklist por agente
      description: Retorna progresso do checklist agrupado por agente atribuído
      operationId: checklistProgressByAgent
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID do item
          schema:
            type: integer
          example: 1
      responses:
        "200":
          description: item_id, checklist_total_items, progress_by_agent, summary
          content:
            application/json:
              schema:
                type: object
              example:
                item_id: 123
                checklist_total_items: 10
                progress_by_agent:
                  - agent_id: 5
                    completed: 4
                    pending: 1
                  - agent_id: 9
                    completed: 2
                    pending: 3
                summary:
                  completed: 6
                  pending: 4
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/scheduled_messages:
    get:
      tags:
        - Mensagens Agendadas
      summary: Listar mensagens agendadas
      description: Retorna todas as mensagens agendadas de uma conversa específica
      operationId: listScheduledMessages
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: conversation_id
          in: path
          required: true
          description: ID da conversa
          schema:
            type: integer
          example: 1897
      responses:
        "200":
          description: Lista de mensagens agendadas retornada com sucesso
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScheduledMessagesResponse"
              example:
                payload:
                  - id: 3
                    message: TEste
                    scheduled_at: 1756302600
                    title: Teste
                    inbox_id: 7
                    conversation_id: 1918
                    created_at: 1756302539
                    status: pending
                    is_recurrent: false
                    period: ""
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
    post:
      tags:
        - Mensagens Agendadas
      summary: Criar mensagem agendada
      description: Cria uma nova mensagem agendada para uma conversa específica
      operationId: createScheduledMessage
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: conversation_id
          in: path
          required: true
          description: ID da conversa
          schema:
            type: integer
          example: 1897
      requestBody:
        required: true
        description: Dados da mensagem agendada a ser criada
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ScheduledMessageCreate"
            example:
              scheduled_message:
                conversation_id: 1897
                inbox_id: 7
                content: "Lembrete: reunião às 14h"
                scheduled_at: 2025-08-27T13:50:00.000Z
                title: Reunião
                status: pending
                is_recurrent: false
                period: ""
      responses:
        "200":
          description: Mensagem agendada criada com sucesso
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScheduledMessageCreatedResponse"
              example:
                id: 3
                message: "Lembrete: reunião às 14h"
                scheduled_at: 1756302600
                title: Reunião
                inbox_id: 7
                conversation_id: 1897
                created_at: 1756302539
                status: pending
                is_recurrent: false
                period: ""
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/scheduled_messages/{id}:
    patch:
      tags:
        - Mensagens Agendadas
      summary: Atualizar mensagem agendada
      description: Atualiza uma mensagem agendada específica
      operationId: updateScheduledMessage
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: conversation_id
          in: path
          required: true
          description: ID da conversa
          schema:
            type: integer
          example: 1897
        - name: id
          in: path
          required: true
          description: ID da mensagem agendada
          schema:
            type: integer
          example: 3
      requestBody:
        required: true
        description: Dados da mensagem agendada a ser atualizada
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ScheduledMessageUpdate"
            example:
              scheduled_message:
                content: Novo conteúdo da mensagem
                scheduled_at: 2025-08-28T14:00:00.000Z
                title: Título Atualizado
                status: pending
                is_recurrent: false
                period: ""
      responses:
        "200":
          description: Mensagem agendada atualizada com sucesso
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ScheduledMessageCreatedResponse"
              example:
                id: 3
                message: Novo conteúdo da mensagem
                scheduled_at: 1756388400
                title: Título Atualizado
                inbox_id: 7
                conversation_id: 1897
                created_at: 1756302539
                status: pending
                is_recurrent: false
                period: ""
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
    delete:
      tags:
        - Mensagens Agendadas
      summary: Excluir mensagem agendada
      description: Exclui uma mensagem agendada específica
      operationId: deleteScheduledMessage
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: conversation_id
          in: path
          required: true
          description: ID da conversa
          schema:
            type: integer
          example: 1897
        - name: id
          in: path
          required: true
          description: ID da mensagem agendada
          schema:
            type: integer
          example: 3
      responses:
        "200":
          description: Mensagem agendada excluída com sucesso
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Mensagem de confirmação
                    example: Mensagem agendada excluída com sucesso
                  deleted_id:
                    type: integer
                    description: ID da mensagem excluída
                    example: 3
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/leads/capture/{slug}:
    post:
      summary: Captura de lead publico
      description: Recebe form. CORS. Sem auth.
      tags:
        - Lead Capture
      security: []
      parameters:
        - name: slug
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - email
              properties:
                name:
                  type: string
                email:
                  type: string
                phone:
                  type: string
                message:
                  type: string
                custom_attributes:
                  type: object
                tracking:
                  type: object
                  description: gclid/fbclid/ctwa_clid/leadgen_id/utm_*
      responses:
        "200":
          description: Sucesso
          content:
            application/json:
              example:
                success: true
                contact_id: 12345
                conversation_id: 67890
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_post_api_leads_capture_by_slug
    options:
      summary: CORS preflight
      description: Preflight.
      tags:
        - Lead Capture
      security: []
      parameters:
        - name: slug
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
      operationId: core_options_api_leads_capture_by_slug
  /lead-capture.js:
    get:
      summary: Script JS embed
      description: JS auto-tracking.
      tags:
        - Lead Capture
      security: []
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_lead_capture_js
  /api/v1/accounts/{account_id}/lead_capture_endpoints:
    get:
      summary: Listar endpoints
      description: Lista todos.
      tags:
        - Lead Capture
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_lead_capture_endpoints
    post:
      summary: Criar endpoint
      description: capture_config define mapeamento.
      tags:
        - Lead Capture
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - slug
              properties:
                name:
                  type: string
                slug:
                  type: string
                inbox_id:
                  type: integer
                enabled:
                  type: boolean
                capture_config:
                  type: object
                allowed_origins:
                  type: array
                  items:
                    type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_post_api_v1_accounts_by_account_id_lead_capture_endpoints
  /api/v1/accounts/{account_id}/lead_capture_endpoints/{id}:
    get:
      summary: Detalhe
      description: Config completa.
      tags:
        - Lead Capture
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_lead_capture_endpoints_by_id
    patch:
      summary: Atualizar
      description: Atualiza config.
      tags:
        - Lead Capture
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_patch_api_v1_accounts_by_account_id_lead_capture_endpoints_by_id
    delete:
      summary: Excluir
      description: Remove.
      tags:
        - Lead Capture
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_delete_api_v1_accounts_by_account_id_lead_capture_endpoints_by_id
  /api/v1/accounts/{account_id}/agent_bots/{agent_bot_id}/ai_agent_documents:
    get:
      summary: Listar knowledge base
      description: PDFs/URLs/textos.
      tags:
        - Captain (Agente IA)
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: agent_bot_id
          in: path
          required: true
          description: ID do assistente (agent bot)
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_agent_bots_by_agent_bot_id_ai_agent_documents
    post:
      summary: Adicionar ao knowledge base
      description: PDF/URL/texto pra Capitao usar.
      tags:
        - Captain (Agente IA)
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: agent_bot_id
          in: path
          required: true
          description: ID do assistente (agent bot)
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                document_type:
                  type: string
                  enum:
                    - file
                    - url
                    - text
                name:
                  type: string
                content:
                  type: string
                url:
                  type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_post_api_v1_accounts_by_account_id_agent_bots_by_agent_bot_id_ai_agent_documents
  /api/v1/accounts/{account_id}/agent_bots/{agent_bot_id}/ai_agent_documents/{id}:
    get:
      summary: Detalhe do documento
      description: Conteudo + metadados.
      tags:
        - Captain (Agente IA)
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: agent_bot_id
          in: path
          required: true
          description: ID do assistente (agent bot)
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_agent_bots_by_agent_bot_id_ai_agent_documents_by_id
    delete:
      summary: Remover documento
      description: Remove do knowledge base.
      tags:
        - Captain (Agente IA)
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: agent_bot_id
          in: path
          required: true
          description: ID do assistente (agent bot)
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_delete_api_v1_accounts_by_account_id_agent_bots_by_agent_bot_id_ai_agent_documents_by_id
  /api/v1/accounts/{account_id}/agent_bots/{agent_bot_id}/ai_agent_documents/{id}/retry:
    post:
      summary: Reprocessar documento
      description: Tenta reprocessar um documento que falhou na ingestao.
      tags:
        - Captain (Agente IA)
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: agent_bot_id
          in: path
          required: true
          description: ID do assistente (agent bot)
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_post_api_v1_accounts_by_account_id_agent_bots_by_agent_bot_id_ai_agent_documents_by_id_retry
  /api/v1/accounts/{account_id}/upload:
    post:
      summary: Upload de arquivo
      description: |
        Hospeda um arquivo e devolve uma URL publica pronta pra usar como
        media_url em qualquer endpoint que peca mídia (disparo de grupo,
        sequencia, tarefa, nota do Kanban etc.), nenhum desses endpoints
        aceita upload direto, todos esperam uma URL ja hospedada.

        Envie **um dos dois** no corpo multipart:
        - `attachment`: o arquivo em si (binary).
        - `external_url`: uma URL publica ja existente, a API baixa e
          re-hospeda (util quando a mídia já está em outro storage e você só
          quer uma URL estável).

        A `file_url` devolvida é pública, sem autenticação, é a que serviços
        externos (ex.: WAHA) usam pra buscar a mídia na hora de enviar.
      tags:
        - Anexos
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                attachment:
                  type: string
                  format: binary
                  description: Arquivo a hospedar. Use isso OU external_url, não os dois.
                external_url:
                  type: string
                  format: uri
                  description: URL pública já existente, pra baixar e re-hospedar. Use isso OU attachment, não os dois.
      responses:
        "200":
          description: Sucesso
          content:
            application/json:
              schema:
                type: object
                properties:
                  file_url:
                    type: string
                    format: uri
                    description: URL pública do arquivo, use como media_url em outros endpoints.
                  blob_id:
                    type: string
                    description: ID assinado do blob (uso interno).
        "401":
          description: Nao autorizado
        "422":
          description: Nenhum dos dois campos enviado, ou download da external_url falhou (URL invalida, arquivo grande demais, tipo nao suportado).
      operationId: core_post_api_v1_accounts_by_account_id_upload
  /api/v1/accounts/{account_id}/broadcasts:
    get:
      summary: Listar broadcasts
      description: Historico de disparos.
      tags:
        - Disparo de Mensagens
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_broadcasts
    post:
      summary: Criar broadcast
      description: Dispara em massa. Suporta template + agendamento.
      tags:
        - Disparo de Mensagens
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - inbox_id
                - message
                - contact_ids
              properties:
                inbox_id:
                  type: integer
                message:
                  type: string
                template_id:
                  type: string
                contact_ids:
                  type: array
                  items:
                    type: integer
                filters:
                  type: object
                scheduled_at:
                  type: string
                  format: date-time
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_post_api_v1_accounts_by_account_id_broadcasts
  /api/v1/accounts/{account_id}/broadcasts/{id}:
    get:
      summary: Detalhe do broadcast
      description: Status + estatisticas.
      tags:
        - Disparo de Mensagens
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_broadcasts_by_id
    delete:
      summary: Cancelar broadcast
      description: Cancela agendado.
      tags:
        - Disparo de Mensagens
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_delete_api_v1_accounts_by_account_id_broadcasts_by_id
  /api/v1/accounts/{account_id}/whatsapp_group_broadcasts:
    get:
      tags:
        - Broadcasts
      summary: Listar disparos
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - name: bucket
          in: query
          schema:
            type: string
            enum:
              - scheduled
              - completed
        - name: page
          in: query
          schema:
            type: integer
        - name: per_page
          in: query
          schema:
            type: integer
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_broadcasts
      security:
        - userApiKey: []
    post:
      tags:
        - Broadcasts
      summary: Criar disparo
      description: |
        media_type: image | video | document | audio | poll | contact | event | location.
        Agendar: scheduled_at ISO-8601. Imediato: omitir scheduled_at.
        Audio: mp3. content vira caption em mídia (exceto audio).

        **media_url precisa ser uma URL já hospedada**: este endpoint não
        aceita upload de arquivo. Sem uma URL pública pronta, hospede
        primeiro em `POST /api/v1/accounts/{account_id}/upload` (aceita
        arquivo ou reidrata uma URL externa) e use a `file_url` devolvida
        aqui.
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - whatsapp_group_broadcast
              properties:
                whatsapp_group_broadcast:
                  type: object
                  properties:
                    content:
                      type: string
                    media_type:
                      type: string
                    media_url:
                      type: string
                    poll_options:
                      type: array
                      items:
                        type: string
                    poll_multiple:
                      type: boolean
                    extras:
                      type: object
                      description: contact_*, event_*, latitude/longitude/title/address
                    target_group_ids:
                      type: array
                      items:
                        type: integer
                    whatsapp_group_campaign_id:
                      type: integer
                    scheduled_at:
                      type: string
                      format: date-time
                    send_speed:
                      type: number
                    remove_members_after:
                      type: boolean
                      default: false
      responses:
        "201":
          description: Created
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_group_broadcasts
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/voip_settings:
    get:
      summary: Buscar config VOIP
      description: Settings globais.
      tags:
        - VOIP
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_settings
    patch:
      summary: Atualizar config VOIP
      description: Atualiza settings.
      tags:
        - VOIP
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_patch_api_v1_accounts_by_account_id_voip_settings
  /api/v1/accounts/{account_id}/voip_devices:
    get:
      summary: Listar dispositivos VOIP
      description: Numeros configurados.
      tags:
        - VOIP
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_devices
    post:
      summary: Adicionar dispositivo VOIP
      description: Liga uma caixa de entrada a uma instância de chamadas do StackZap. Cada caixa tem no máximo um dispositivo.
      tags:
        - VOIP
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - voip_device
              properties:
                voip_device:
                  type: object
                  required:
                    - inbox_id
                    - label
                    - stackzap_instance_id
                    - stackzap_api_key
                  properties:
                    inbox_id:
                      type: integer
                      description: Caixa de WhatsApp (WAHA) da mesma conta que recebe as chamadas.
                    label:
                      type: string
                      description: Nome do dispositivo na tela de VOIP.
                    stackzap_instance_id:
                      type: string
                      format: uuid
                      description: Id da instância no StackZap.
                    stackzap_api_key:
                      type: string
                      description: Chave de API da instância no StackZap.
                    stackzap_webhook_secret:
                      type: string
                      description: Segredo usado para conferir os eventos que o StackZap envia.
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_post_api_v1_accounts_by_account_id_voip_devices
  /api/v1/accounts/{account_id}/voip_devices/{id}:
    get:
      summary: Detalhe do dispositivo
      description: Config + status.
      tags:
        - VOIP
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_devices_by_id
    patch:
      summary: Atualizar dispositivo
      description: Atualiza config.
      tags:
        - VOIP
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_patch_api_v1_accounts_by_account_id_voip_devices_by_id
    delete:
      summary: Remover dispositivo
      description: Desconecta.
      tags:
        - VOIP
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_delete_api_v1_accounts_by_account_id_voip_devices_by_id
  /api/v1/accounts/{account_id}/conversations/{conversation_id}/voip_calls:
    post:
      summary: Iniciar chamada VOIP
      description: Outbound call.
      tags:
        - VOIP
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: conversation_id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                device_id:
                  type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_post_api_v1_accounts_by_account_id_conversations_by_conversation_id_voip_calls
  /api/v1/accounts/{account_id}/voip_analytics/funnel:
    get:
      tags:
        - VOIP - Analytics
      summary: Funil de chamadas
      description: Volume por etapa do funil (recebidas, atendidas, agendamentos, comparecimentos, fechamentos).
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_funnel
  /api/v1/accounts/{account_id}/voip_analytics/financial:
    get:
      tags:
        - VOIP - Analytics
      summary: Métricas financeiras
      description: Ticket médio, investimento, valor de vendas e valor por lead no período.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_financial
  /api/v1/accounts/{account_id}/voip_analytics/by_agent:
    get:
      tags:
        - VOIP - Analytics
      summary: Métricas por agente
      description: Quebra as métricas de chamada por agente.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_by_agent
  /api/v1/accounts/{account_id}/voip_analytics/by_origin:
    get:
      tags:
        - VOIP - Analytics
      summary: Métricas por origem
      description: Quebra as métricas de chamada por origem do lead.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_by_origin
  /api/v1/accounts/{account_id}/voip_analytics/daily:
    get:
      tags:
        - VOIP - Analytics
      summary: Série diária
      description: Série temporal diária de uma métrica.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
        - name: metric
          in: query
          required: false
          description: Métrica da série. Default leads.
          schema:
            type: string
            default: leads
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_daily
  /api/v1/accounts/{account_id}/voip_analytics/distance:
    get:
      tags:
        - VOIP - Analytics
      summary: Distribuição por distância
      description: Distribuição de chamadas por faixa de distância/duração.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_distance
  /api/v1/accounts/{account_id}/voip_analytics/calls_per_lead:
    get:
      tags:
        - VOIP - Analytics
      summary: Chamadas por lead
      description: Média de chamadas necessárias por lead até conversão.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_calls_per_lead
  /api/v1/accounts/{account_id}/voip_analytics/attendance_rate:
    get:
      tags:
        - VOIP - Analytics
      summary: Taxa de comparecimento
      description: Percentual de agendamentos que viraram comparecimento.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_attendance_rate
  /api/v1/accounts/{account_id}/voip_analytics/lead_speed:
    get:
      tags:
        - VOIP - Analytics
      summary: Velocidade de resposta ao lead
      description: Tempo médio entre lead criado e primeira chamada.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_lead_speed
  /api/v1/accounts/{account_id}/voip_analytics/fcr_rate:
    get:
      tags:
        - VOIP - Analytics
      summary: Taxa de resolução na 1a chamada
      description: Percentual de leads resolvidos já na primeira chamada (first call resolution).
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_fcr_rate
  /api/v1/accounts/{account_id}/voip_analytics/setup_checklist:
    get:
      tags:
        - VOIP - Analytics
      summary: Checklist de configuração
      description: Lista o que falta configurar pra cada métrica do dashboard de VOIP aparecer (progresso educativo pro usuário leigo).
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_setup_checklist
  /api/v1/accounts/{account_id}/voip_analytics/compare:
    get:
      tags:
        - VOIP - Analytics
      summary: Comparar com período anterior
      description: Funil + financeiro do período atual vs. o período anterior equivalente, pra calcular delta %.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: from
          in: query
          required: false
          description: Data inicial (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: to
          in: query
          required: false
          description: Data final (YYYY-MM-DD). Default do service se omitido.
          schema:
            type: string
            format: date
        - name: origins
          in: query
          required: false
          description: Filtra por origem(ns) do lead.
          schema:
            type: array
            items:
              type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_compare
  /api/v1/accounts/{account_id}/voip_analytics/recent_summaries:
    get:
      tags:
        - VOIP - Analytics
      summary: Resumos de IA recentes
      description: Lista chamadas com resumo/transcrição gerados por IA, mais recentes primeiro. Pra revisar o dia sem abrir ficha por ficha.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: limit
          in: query
          required: false
          description: Maximo de itens. Default 20, teto 100.
          schema:
            type: integer
            default: 20
            maximum: 100
        - name: sentiment
          in: query
          required: false
          description: Filtra por sentimento detectado (positivo, neutro, negativo).
          schema:
            type: string
            enum:
              - positivo
              - neutro
              - negativo
        - name: keyword_flagged_only
          in: query
          required: false
          description: true retorna so chamadas com palavra-chave sinalizada.
          schema:
            type: string
            enum:
              - "true"
              - "false"
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_recent_summaries
  /api/v1/accounts/{account_id}/voip_analytics/targets:
    get:
      tags:
        - VOIP - Analytics
      summary: Consultar metas do mês
      description: Metas configuradas (leads, agendamentos, comparecimentos, fechamentos etc.) pra um mês/rótulo.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: month
          in: query
          required: false
          description: Mês de referência (YYYY-MM-DD, qualquer dia do mês).
          schema:
            type: string
            format: date
        - name: label
          in: query
          required: false
          description: Rótulo da meta (ex. por time). Default "Geral".
          schema:
            type: string
            default: Geral
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_analytics_targets
    patch:
      tags:
        - VOIP - Analytics
      summary: Definir metas do mês
      description: Cria ou atualiza (upsert) as metas de um mês/rótulo.
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - month
              properties:
                month:
                  type: string
                  format: date
                  description: Mês de referência (YYYY-MM-DD, qualquer dia do mês).
                label:
                  type: string
                  default: Geral
                leads_target:
                  type: integer
                agendamentos_target:
                  type: integer
                comparecimentos_target:
                  type: integer
                fechamentos_target:
                  type: integer
                ticket_medio_cents:
                  type: integer
                valor_vendas_cents:
                  type: integer
                investimento_cents:
                  type: integer
                valor_lead_cents:
                  type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_patch_api_v1_accounts_by_account_id_voip_analytics_targets
  /api/v1/accounts/{account_id}/voip_sla_policies:
    get:
      summary: Listar SLAs
      description: Politicas configuradas.
      tags:
        - VOIP
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_voip_sla_policies
  /api/v1/accounts/{account_id}/voip_sla_policies/{id}:
    patch:
      summary: Atualizar SLA
      description: Atualiza thresholds.
      tags:
        - VOIP
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          description: ID da politica de SLA
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_patch_api_v1_accounts_by_account_id_voip_sla_policies
  /api/v1/accounts/{account_id}/call_records:
    get:
      summary: Listar chamadas
      description: "Historico: status, duracao, scoring, transcricao."
      tags:
        - Call Records
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_call_records
  /api/v1/accounts/{account_id}/call_records/{id}:
    get:
      summary: Detalhe da chamada
      description: Inclui transcricao + analise IA.
      tags:
        - Call Records
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_call_records_by_id
    patch:
      summary: Atualizar chamada
      description: Disposition + notas.
      tags:
        - Call Records
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                disposition:
                  type: string
                notes:
                  type: string
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_patch_api_v1_accounts_by_account_id_call_records_by_id
  /api/v1/accounts/{account_id}/contacts/{contact_id}/lead_scores:
    get:
      summary: Historico de scoring
      description: Pontuacoes ao longo do tempo + razoes.
      tags:
        - Lead Scoring
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
        - name: contact_id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: Sucesso
        "401":
          description: Nao autorizado
        "404":
          description: Nao encontrado
      operationId: core_get_api_v1_accounts_by_account_id_contacts_by_contact_id_lead_scores
  /api/v1/accounts/{account_id}/tasks:
    get:
      tags:
        - Tarefas
      summary: Listar tarefas
      description: Retorna lista de tarefas da conta com filtros opcionais por responsável, status, prioridade e prazo.
      operationId: listTasks
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
        - name: assignee_id
          in: query
          required: false
          description: Filtrar por agente responsável
          schema:
            type: integer
        - name: status
          in: query
          required: false
          description: Filtrar por status da tarefa
          schema:
            type: string
            enum:
              - open
              - in_progress
              - completed
              - cancelled
        - name: priority
          in: query
          required: false
          description: Filtrar por prioridade
          schema:
            type: string
            enum:
              - low
              - medium
              - high
              - urgent
        - name: contact_id
          in: query
          required: false
          description: Filtrar tarefas vinculadas a um contato
          schema:
            type: integer
        - name: conversation_id
          in: query
          required: false
          description: Filtrar tarefas vinculadas a uma conversa
          schema:
            type: integer
        - name: due_before
          in: query
          required: false
          description: Tarefas vencendo antes desta data (ISO 8601)
          schema:
            type: string
            format: date-time
        - name: page
          in: query
          required: false
          description: Página para paginação (25 itens por página)
          schema:
            type: integer
            default: 1
      responses:
        "200":
          description: Lista de tarefas retornada com sucesso
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TasksListResponse"
              example:
                payload:
                  - id: 12
                    title: Ligar para o lead
                    description: Confirmar interesse na proposta enviada anteontem
                    status: open
                    priority: high
                    due_at: 2026-05-02T14:00:00.000Z
                    assignee_id: 7
                    contact_id: 234
                    conversation_id: 1897
                    created_by: 3
                    created_at: 2026-05-01T09:30:00.000Z
                    updated_at: 2026-05-01T09:30:00.000Z
                meta:
                  count: 12
                  current_page: 1
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
    post:
      tags:
        - Tarefas
      summary: Criar tarefa
      description: Cria uma nova tarefa, opcionalmente vinculada a um contato e/ou conversa.
      operationId: createTask
      parameters:
        - name: account_id
          in: path
          required: true
          description: ID da conta
          schema:
            type: integer
          example: 1
      requestBody:
        required: true
        description: Dados da tarefa a ser criada
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TaskCreate"
            example:
              task:
                title: Ligar para o lead
                description: Confirmar interesse na proposta
                priority: high
                due_at: 2026-05-02T14:00:00.000Z
                assignee_id: 7
                contact_id: 234
                conversation_id: 1897
      responses:
        "200":
          description: Tarefa criada com sucesso
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Task"
        "400":
          $ref: "#/components/responses/BadRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "403":
          $ref: "#/components/responses/Forbidden"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
  /api/v1/accounts/{account_id}/tasks/{id}:
    get:
      tags:
        - Tarefas
      summary: Obter tarefa
      description: Retorna detalhes de uma tarefa específica pelo ID.
      operationId: getTask
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID da tarefa
          schema:
            type: integer
          example: 12
      responses:
        "200":
          description: Tarefa retornada com sucesso
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Task"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
    patch:
      tags:
        - Tarefas
      summary: Atualizar tarefa
      description: Atualiza campos de uma tarefa existente. Use para concluir/cancelar (alterando status), trocar responsável, mudar prazo etc.
      operationId: updateTask
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID da tarefa
          schema:
            type: integer
          example: 12
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TaskUpdate"
            example:
              task:
                status: completed
                priority: medium
      responses:
        "200":
          description: Tarefa atualizada com sucesso
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Task"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "422":
          $ref: "#/components/responses/UnprocessableEntity"
    delete:
      tags:
        - Tarefas
      summary: Excluir tarefa
      description: Remove permanentemente uma tarefa. Para preservar histórico, prefira atualizar status para "cancelled".
      operationId: deleteTask
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: integer
          example: 1
        - name: id
          in: path
          required: true
          description: ID da tarefa
          schema:
            type: integer
          example: 12
      responses:
        "200":
          description: Tarefa excluída com sucesso
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
  /api/v1/accounts/{account_id}/whatsapp_groups:
    get:
      tags:
        - Groups
      summary: Listar grupos
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - name: status
          in: query
          schema:
            type: string
        - name: inbox_id
          in: query
          schema:
            type: integer
        - name: search
          in: query
          schema:
            type: string
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_groups
      security:
        - userApiKey: []
    post:
      tags:
        - Groups
      summary: Criar grupo (WAHA + SiteUp)
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - whatsapp_group
              properties:
                whatsapp_group:
                  type: object
                  required:
                    - name
                    - inbox_id
                  properties:
                    name:
                      type: string
                    description:
                      type: string
                    inbox_id:
                      type: integer
                    max_members:
                      type: integer
                      default: 1024
                    initial_members:
                      type: array
                      items:
                        type: string
                      example:
                        - "5551989769026"
                    admin_members:
                      type: array
                      items:
                        type: string
      responses:
        "201":
          description: Created
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_groups
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/{id}:
    parameters:
      - $ref: "#/components/parameters/whatsapp_groups_account_id"
      - $ref: "#/components/parameters/whatsapp_groups_id"
    get:
      tags:
        - Groups
      summary: Detalhe do grupo
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_groups_by_id
      security:
        - userApiKey: []
    put:
      tags:
        - Groups
      summary: Atualizar grupo
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                whatsapp_group:
                  type: object
                  properties:
                    name:
                      type: string
                    description:
                      type: string
                    status:
                      type: string
                    max_members:
                      type: integer
                    welcome_message:
                      type: string
      responses:
        "200":
          description: OK
      operationId: groups_put_api_v1_accounts_by_account_id_whatsapp_groups_by_id
      security:
        - userApiKey: []
    delete:
      tags:
        - Groups
      summary: Excluir / leave grupo
      responses:
        "200":
          description: OK
      operationId: groups_delete_api_v1_accounts_by_account_id_whatsapp_groups_by_id
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/adopt:
    post:
      tags:
        - Groups
      summary: Adotar grupo, canal ou comunidade já existente
      description: |
        Registra na conta um grupo/canal que já existe no WhatsApp, em vez de criar um novo via WAHA.
        O `jid` define o tipo: `@g.us` = grupo/comunidade, `@newsletter` = canal.
        A inbox precisa enxergar o grupo e, exceto em canal, ser admin nele.
        Comunidade não é criável por API: crie à mão no número conectado e adote o grupo de avisos
        dela com `is_community: true`.
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - whatsapp_group
              properties:
                whatsapp_group:
                  type: object
                  required:
                    - inbox_id
                    - jid
                  properties:
                    inbox_id:
                      type: integer
                    jid:
                      type: string
                      description: Termina em @g.us (grupo/comunidade) ou @newsletter (canal)
                      example: 120363012345678901@g.us
                    name:
                      type: string
                    max_members:
                      type: integer
                      default: 1024
                    launch_id:
                      type: string
                    is_community:
                      type: boolean
                      default: false
                      description: true só para o grupo de avisos de uma comunidade; conferido no WAHA (IsAnnounce + LinkedParentJID) antes de aceitar
      responses:
        "201":
          description: Adotado. Mesmo corpo de POST whatsapp_groups, com chat_kind e community.
        "404":
          description: inbox_id não pertence à conta
        "422":
          description: |
            Recusado. Corpo `{ "error": <símbolo> }`: símbolo, não texto pronto para exibir:
            invalid_jid, already_adopted, session_conflict, not_visible_to_session, not_admin,
            waha_unreachable, adoption_failed, community_must_be_group, community_is_parent_jid,
            not_community_group.
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_groups_adopt
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_launches/provision:
    post:
      tags:
        - Groups
      summary: Provisionar em lote as salas de um lançamento
      description: |
        Cria em lote as salas de um lançamento e, opcionalmente, a campanha guarda-chuva.
        Parâmetros no nível raiz do corpo, sem wrapper.
        Informe `inbox_ids` (rodízio entre inboxes) ou `inbox_id`.
        `chat_kind: channel` é a única via de criação de canal: `POST whatsapp_groups` só cria grupo.
        Canal ignora max_members, initial_members e admin_members.
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - launch_id
                - count
                - name_prefix
              properties:
                launch_id:
                  type: string
                count:
                  type: integer
                  minimum: 1
                  maximum: 20
                name_prefix:
                  type: string
                inbox_ids:
                  type: array
                  items:
                    type: integer
                inbox_id:
                  type: integer
                chat_kind:
                  type: string
                  enum:
                    - group
                    - channel
                  default: group
                group_type:
                  type: string
                  enum:
                    - permanent
                    - temporary
                    - event
                  default: permanent
                lifecycle_days:
                  type: integer
                max_members:
                  type: integer
                  default: 1024
                description:
                  type: string
                welcome_message:
                  type: string
                default_member_label:
                  type: string
                initial_members:
                  type: array
                  items:
                    type: string
                  example:
                    - "5551989769026"
                admin_members:
                  type: array
                  items:
                    type: string
                owner_phone:
                  type: string
                create_campaign:
                  type: boolean
                  default: false
                campaign_name:
                  type: string
      responses:
        "201":
          description: Criado. Corpo com ok, errors, groups[] (id, name, waha_group_id, launch_id, chat_kind, channel_invite_link) e campaign.
        "404":
          description: Nenhuma das inboxes informadas pertence à conta
        "422":
          description: Mesmo corpo com ok=false. errors traz launch_id_blank, name_prefix_blank, count_invalid ou inbox_blank, ou um item por sala que falhou.
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_group_launches_provision
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/available_waha_sessions:
    get:
      tags:
        - WAHA
      summary: Sessões WAHA disponíveis
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_groups_available_waha_sessions
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/inbox_status:
    get:
      tags:
        - WAHA
      summary: Status live das inboxes WAHA
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_groups_inbox_status
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/resolve_session:
    post:
      tags:
        - WAHA
      summary: Resolver sessão WAHA para inbox
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                inbox_id:
                  type: integer
                session_name:
                  type: string
                phone_number:
                  type: string
      responses:
        "200":
          description: OK
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_groups_resolve_session
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/{id}/sync_members:
    post:
      tags:
        - Members
      summary: Sincronizar membros (async job)
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_groups_by_id_sync_members
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/{id}/invite_code:
    get:
      tags:
        - Groups
      summary: Código / link de convite
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_groups_by_id_invite_code
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/{id}/revoke_invite_code:
    post:
      tags:
        - Groups
      summary: Revogar invite
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_groups_by_id_revoke_invite_code
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/{id}/register_webhook:
    post:
      tags:
        - Webhooks
      summary: Registrar webhook WAHA do grupo
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_groups_by_id_register_webhook
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/{whatsapp_group_id}/members:
    parameters:
      - $ref: "#/components/parameters/whatsapp_groups_account_id"
      - $ref: "#/components/parameters/whatsapp_groups_group_id"
    get:
      tags:
        - Members
      summary: Listar membros
      parameters:
        - name: include_removed
          in: query
          schema:
            type: boolean
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_groups_by_whatsapp_group_id_members
      security:
        - userApiKey: []
    post:
      tags:
        - Members
      summary: Adicionar membros
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - phones
              properties:
                phones:
                  type: array
                  items:
                    type: string
                  example:
                    - "5551989769026"
      responses:
        "201":
          description: Created
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_groups_by_whatsapp_group_id_members
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/{whatsapp_group_id}/members/{id}:
    delete:
      tags:
        - Members
      summary: Remover membro
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_group_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_delete_api_v1_accounts_by_account_id_whatsapp_groups_by_whatsapp_group_id_members_by_id
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/{whatsapp_group_id}/members/{id}/promote:
    post:
      tags:
        - Members
      summary: Promover a admin
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_group_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_groups_by_whatsapp_group_id_members_by_id_promote
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_groups/{whatsapp_group_id}/members/{id}/demote:
    post:
      tags:
        - Members
      summary: Rebaixar admin
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_group_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_groups_by_whatsapp_group_id_members_by_id_demote
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_campaigns:
    get:
      tags:
        - Campaigns
      summary: Listar campanhas
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_campaigns
      security:
        - userApiKey: []
    post:
      tags:
        - Campaigns
      summary: Criar campanha
      description: group_ids é obrigatório. Crie o grupo antes.
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - whatsapp_group_campaign
              properties:
                whatsapp_group_campaign:
                  type: object
                  required:
                    - name
                    - group_ids
                  properties:
                    name:
                      type: string
                    status:
                      type: string
                      example: active
                    group_ids:
                      type: array
                      items:
                        type: integer
                      minItems: 1
                    settings:
                      type: object
                      properties:
                        default_inbox_id:
                          type: integer
                        admin_inbox_ids:
                          type: array
                          items:
                            type: integer
                        max_members:
                          type: integer
                          default: 1024
                        auto_provision:
                          type: boolean
                        name_prefix:
                          type: string
                        admin_phones:
                          type: array
                          items:
                            type: string
      responses:
        "201":
          description: Created
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_group_campaigns
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_campaigns/{id}:
    parameters:
      - $ref: "#/components/parameters/whatsapp_groups_account_id"
      - $ref: "#/components/parameters/whatsapp_groups_id"
    get:
      tags:
        - Campaigns
      summary: Detalhe campanha
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_campaigns_by_id
      security:
        - userApiKey: []
    put:
      tags:
        - Campaigns
      summary: Atualizar campanha
      description: Edge 500 reportado em rename simples (2026-08-01). Preferir payloads validados.
      requestBody:
        content:
          application/json:
            schema:
              type: object
      responses:
        "200":
          description: OK
      operationId: groups_put_api_v1_accounts_by_account_id_whatsapp_group_campaigns_by_id
      security:
        - userApiKey: []
    delete:
      tags:
        - Campaigns
      summary: Excluir campanha
      responses:
        "200":
          description: OK
      operationId: groups_delete_api_v1_accounts_by_account_id_whatsapp_group_campaigns_by_id
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_campaigns/{id}/health:
    get:
      tags:
        - Campaigns
      summary: Health da campanha
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_campaigns_by_id_health
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_campaigns/{id}/broadcasts:
    get:
      tags:
        - Campaigns
      summary: Broadcasts da campanha
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_campaigns_by_id_broadcasts
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_broadcasts/{id}:
    get:
      tags:
        - Broadcasts
      summary: Detalhe do disparo
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_broadcasts_by_id
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_broadcasts/{id}/cancel:
    post:
      tags:
        - Broadcasts
      summary: Cancelar disparo agendado/queued
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - $ref: "#/components/parameters/whatsapp_groups_id"
      responses:
        "200":
          description: OK
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_group_broadcasts_by_id_cancel
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_activities:
    get:
      tags:
        - Activities
      summary: Log de atividades
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_activities
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_webhooks:
    get:
      tags:
        - Webhooks
      summary: Listar webhooks de entrada dos grupos
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
        - name: group_id
          in: query
          schema:
            type: integer
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_webhooks
      security:
        - userApiKey: []
    post:
      tags:
        - Webhooks
      summary: Criar webhook de entrada dos grupos
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                whatsapp_group_webhook:
                  type: object
                  properties:
                    name:
                      type: string
                    platform:
                      type: string
                    active:
                      type: boolean
                    whatsapp_group_id:
                      type: integer
                    create_contact:
                      type: boolean
                    auto_invite:
                      type: boolean
                    field_mapping:
                      type: object
      responses:
        "201":
          description: Created
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_group_webhooks
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_webhooks/{id}:
    parameters:
      - $ref: "#/components/parameters/whatsapp_groups_account_id"
      - $ref: "#/components/parameters/whatsapp_groups_id"
    get:
      tags:
        - Webhooks
      summary: Detalhe do webhook de grupos (webhook_url + token)
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_webhooks_by_id
      security:
        - userApiKey: []
    put:
      tags:
        - Webhooks
      summary: Atualizar webhook de grupos
      requestBody:
        content:
          application/json:
            schema:
              type: object
      responses:
        "200":
          description: OK
      operationId: groups_put_api_v1_accounts_by_account_id_whatsapp_group_webhooks_by_id
      security:
        - userApiKey: []
    delete:
      tags:
        - Webhooks
      summary: Excluir webhook de grupos
      responses:
        "200":
          description: OK
      operationId: groups_delete_api_v1_accounts_by_account_id_whatsapp_group_webhooks_by_id
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_sequences:
    get:
      tags:
        - Sequences
      summary: Listar sequências
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_sequences
      security:
        - userApiKey: []
    post:
      tags:
        - Sequences
      summary: Criar sequência
      description: |
        Requer schema completo de steps. Create mínimo pode 422/500 (smoke 2026-08-01).

        Passos com media_type/media_url: a URL precisa estar hospedada
        antes: hospede em `POST /api/v1/accounts/{account_id}/upload` e
        use a `file_url` devolvida.
      parameters:
        - $ref: "#/components/parameters/whatsapp_groups_account_id"
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                whatsapp_group_sequence:
                  type: object
                  properties:
                    name:
                      type: string
                    status:
                      type: string
                    target_group_ids:
                      type: array
                      items:
                        type: integer
                    whatsapp_group_sequence_steps_attributes:
                      type: array
                      items:
                        type: object
      responses:
        "201":
          description: Created
      operationId: groups_post_api_v1_accounts_by_account_id_whatsapp_group_sequences
      security:
        - userApiKey: []
  /api/v1/accounts/{account_id}/whatsapp_group_sequences/{id}:
    parameters:
      - $ref: "#/components/parameters/whatsapp_groups_account_id"
      - $ref: "#/components/parameters/whatsapp_groups_id"
    get:
      tags:
        - Sequences
      summary: Detalhe sequência
      responses:
        "200":
          description: OK
      operationId: groups_get_api_v1_accounts_by_account_id_whatsapp_group_sequences_by_id
      security:
        - userApiKey: []
    put:
      tags:
        - Sequences
      summary: Atualizar sequência
      requestBody:
        content:
          application/json:
            schema:
              type: object
      responses:
        "200":
          description: OK
      operationId: groups_put_api_v1_accounts_by_account_id_whatsapp_group_sequences_by_id
      security:
        - userApiKey: []
    delete:
      tags:
        - Sequences
      summary: Excluir sequência
      responses:
        "200":
          description: OK
      operationId: groups_delete_api_v1_accounts_by_account_id_whatsapp_group_sequences_by_id
      security:
        - userApiKey: []
components:
  schemas:
    bad_request_error:
      title: data
      type: object
      properties:
        description:
          type: string
        errors:
          type: array
          items:
            $ref: "#/components/schemas/request_error"
    request_error:
      type: object
      properties:
        field:
          type: string
        message:
          type: string
        code:
          type: string
    generic_id:
      type: object
      properties:
        id:
          type: number
    canned_response:
      type: object
      properties:
        id:
          type: integer
          description: ID of the canned response
        account_id:
          type: integer
          description: Account Id
        short_code:
          type: string
          description: Short Code for quick access of the canned response
        content:
          type: string
          description: Message content for canned response
        created_at:
          type: string
          description: The date and time when the canned response was created
        updated_at:
          type: string
          description: The date and time when the canned response was updated
    custom_attribute:
      type: object
      properties:
        id:
          type: integer
          description: Identifier
        attribute_display_name:
          type: string
          description: Attribute display name
        attribute_display_type:
          type: string
          description: Attribute display type (text, number, currency, percent, link, date, list, checkbox)
        attribute_description:
          type: string
          description: Attribute description
        attribute_key:
          type: string
          description: Attribute unique key value
        regex_pattern:
          type: string
          description: Regex pattern
        regex_cue:
          type: string
          description: Regex cue
        attribute_values:
          type: string
          description: Attribute values
        attribute_model:
          type: string
          description: Attribute type(conversation_attribute/contact_attribute)
        default_value:
          type: string
          description: Attribute default value
        created_at:
          type: string
          description: The date and time when the custom attribute was created
        updated_at:
          type: string
          description: The date and time when the custom attribute was updated
    automation_rule:
      type: object
      properties:
        payload:
          description: Response payload that contains automation rule(s)
          oneOf:
            - type: array
              description: Array of automation rules (for listing endpoint)
              items:
                $ref: "#/components/schemas/automation_rule_item"
            - type: object
              description: Single automation rule (for show/create/update endpoints)
              allOf:
                - $ref: "#/components/schemas/automation_rule_item"
    automation_rule_item:
      type: object
      properties:
        id:
          type: integer
          description: The ID of the automation rule
        account_id:
          type: integer
          description: Account Id
        name:
          type: string
          description: The name of the rule
          example: Add label on message create event
        description:
          type: string
          description: Description to give more context about the rule
          example: Add label support and sales on message create event if incoming message content contains text help
        event_name:
          type: string
          description: Automation Rule event, on which we call the actions(conversation_created, conversation_updated, message_created)
          enum:
            - conversation_created
            - conversation_updated
            - message_created
          example: message_created
        conditions:
          type: array
          description: Array of conditions on which conversation/message filter would work
          items:
            type: object
            properties:
              values:
                type: array
                items:
                  type: string
              attribute_key:
                type: string
              query_operator:
                type: string
              filter_operator:
                type: string
            example:
              attribute_key: content
              filter_operator: contains
              values:
                - help
              query_operator: and
        actions:
          type: array
          description: Array of actions which we perform when condition matches
          items:
            type: object
            properties:
              action_name:
                type: string
              action_params:
                type: array
                items:
                  type: string
            example:
              action_name: add_label
              action_params:
                - support
                - sales
        created_on:
          type: integer
          description: The timestamp when the rule was created
        active:
          type: boolean
          description: Enable/disable automation rule
    portal:
      type: object
      properties:
        payload:
          type: array
          items:
            $ref: "#/components/schemas/portal_item"
    portal_single:
      type: object
      properties:
        payload:
          $ref: "#/components/schemas/portal_item"
    portal_config:
      type: object
      description: Configuration settings for the portal
      properties:
        allowed_locales:
          type: array
          description: List of allowed locales for the portal
          items:
            type: object
            properties:
              code:
                type: string
                description: The language code
              articles_count:
                type: integer
                description: Number of articles in this locale
              categories_count:
                type: integer
                description: Number of categories in this locale
    portal_logo:
      type: object
      properties:
        id:
          type: integer
          description: ID of the logo file
        portal_id:
          type: integer
          description: ID of the portal this logo belongs to
        file_type:
          type: string
          description: MIME type of the file
        account_id:
          type: integer
          description: ID of the account
        file_url:
          type: string
          description: URL to access the logo file
        blob_id:
          type: integer
          description: ID of the blob
        filename:
          type: string
          description: Name of the file
    portal_meta:
      type: object
      properties:
        all_articles_count:
          type: integer
          description: Total number of articles
        archived_articles_count:
          type:
            - integer
            - "null"
          description: Number of archived articles
        published_count:
          type:
            - integer
            - "null"
          description: Number of published articles
        draft_articles_count:
          type:
            - integer
            - "null"
          description: Number of draft articles
        categories_count:
          type: integer
          description: Number of categories
        default_locale:
          type: string
          description: Default locale for the portal
    portal_item:
      type: object
      properties:
        id:
          type: integer
          description: The ID of the portal
        archived:
          type: boolean
          description: Whether the portal is archived
        color:
          type: string
          description: The color code for the portal
        config:
          $ref: "#/components/schemas/portal_config"
        custom_domain:
          type: string
          description: Custom domain for the portal
        header_text:
          type: string
          description: The header text for the portal
        homepage_link:
          type: string
          description: Homepage link for the portal
        name:
          type: string
          description: Name of the portal
        slug:
          type: string
          description: URL slug for the portal
        page_title:
          type: string
          description: Page title for the portal
        account_id:
          type: integer
          description: ID of the account the portal belongs to
        inbox:
          $ref: "#/components/schemas/inbox"
        logo:
          $ref: "#/components/schemas/portal_logo"
        meta:
          $ref: "#/components/schemas/portal_meta"
    category:
      type: object
      properties:
        id:
          type: integer
        description:
          type: string
          description: The text content.
        locale:
          type: string
        name:
          type: string
        slug:
          type: string
        position:
          type: integer
        portal_id:
          type: integer
        account_id:
          type: integer
        associated_category_id:
          type: integer
          description: To associate similar categories to each other, e.g same category of product documentation in different languages
        parent_category_id:
          type: integer
          description: To define parent category, e.g product documentation has multiple level features in sales category or in engineering category.
    article:
      type: object
      properties:
        id:
          type: integer
        content:
          type: string
          description: The text content.
        meta:
          type: object
        position:
          type: integer
        status:
          type: integer
          enum:
            - draft
            - published
            - archived
        title:
          type: string
        slug:
          type: string
        views:
          type: integer
        portal_id:
          type: integer
        account_id:
          type: integer
        author_id:
          type: integer
        category_id:
          type: integer
        folder_id:
          type: integer
        associated_article_id:
          type: integer
          description: To associate similar articles to each other, e.g to provide the link for the reference.
    contact:
      type: object
      properties:
        payload:
          type: array
          items:
            type: object
            properties:
              additional_attributes:
                type: object
                description: The object containing additional attributes related to the contact
              availability_status:
                type: string
                description: The availability status of the contact
              email:
                type: string
                description: The email address of the contact
              id:
                type: integer
                description: The ID of the contact
              name:
                type: string
                description: The name of the contact
              phone_number:
                type: string
                description: The phone number of the contact
              blocked:
                type: boolean
                description: Whether the contact is blocked
              identifier:
                type: string
                description: The identifier of the contact
              thumbnail:
                type: string
                description: The thumbnail of the contact
              custom_attributes:
                type: object
                description: The custom attributes of the contact
                example:
                  attribute_key: attribute_value
                  signed_up_at: dd/mm/yyyy
              last_activity_at:
                type: integer
                description: The last activity at of the contact
              created_at:
                type: integer
                description: The created at of the contact
              contact_inboxes:
                type: array
                items:
                  $ref: "#/components/schemas/contact_inboxes"
    conversation:
      type: object
      properties:
        id:
          type: number
          description: ID of the conversation
        messages:
          type: array
          items:
            $ref: "#/components/schemas/message"
        account_id:
          type: number
          description: Account Id
        uuid:
          type: string
          description: UUID of the conversation
        additional_attributes:
          type: object
          description: The object containing additional attributes related to the conversation
        agent_last_seen_at:
          type: number
          description: The last activity at of the agent
        assignee_last_seen_at:
          type: number
          description: The last activity at of the assignee
        can_reply:
          type: boolean
          description: Whether the conversation can be replied to
        contact_last_seen_at:
          type: number
          description: The last activity at of the contact
        custom_attributes:
          type: object
          description: The object to save custom attributes for conversation, accepts custom attributes key and value
        inbox_id:
          type: number
          description: ID of the inbox
        labels:
          type: array
          items:
            type: string
          description: The labels of the conversation
        muted:
          type: boolean
          description: Whether the conversation is muted
        snoozed_until:
          type:
            - number
            - "null"
          description: The time at which the conversation will be unmuted
        status:
          type: string
          enum:
            - open
            - resolved
            - pending
          description: The status of the conversation
        created_at:
          type: number
          description: The time at which conversation was created
        updated_at:
          type: number
          description: The time at which conversation was updated
        timestamp:
          type: number
          description: The time at which conversation was created
        first_reply_created_at:
          type:
            - number
            - "null"
          description: The time at which the first reply was created
        unread_count:
          type: number
          description: The number of unread messages
        last_non_activity_message:
          oneOf:
            - $ref: "#/components/schemas/message"
            - type: "null"
          description: The last non activity message
        last_activity_at:
          type: number
          description: The last activity at of the conversation
        priority:
          type:
            - string
            - "null"
          description: The priority of the conversation
        waiting_since:
          type:
            - number
            - "null"
          description: The time at which the conversation was waiting
        sla_policy_id:
          type:
            - number
            - "null"
          description: The ID of the SLA policy
        applied_sla:
          type: object
          description: The applied SLA
        sla_events:
          type: array
          items:
            type: object
            description: SLA event objects
    message:
      type: object
      properties:
        id:
          type: number
          description: The ID of the message
        content:
          type: string
          description: The text content of the message
        account_id:
          type: number
          description: The ID of the account
        inbox_id:
          type: number
          description: The ID of the inbox
        conversation_id:
          type: number
          description: The ID of the conversation
        message_type:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 3
          description: The type of the message
        created_at:
          type: integer
          description: The time at which message was created
        updated_at:
          type:
            - integer
            - string
          description: The time at which message was updated
        private:
          type: boolean
          description: The flags which shows whether the message is private or not
        status:
          type:
            - string
            - "null"
          enum:
            - sent
            - delivered
            - read
            - failed
            - null
          description: The status of the message
        source_id:
          type:
            - string
            - "null"
          description: The source ID of the message
        content_type:
          type:
            - string
            - "null"
          enum:
            - text
            - input_text
            - input_textarea
            - input_email
            - input_select
            - cards
            - form
            - article
            - incoming_email
            - input_csat
            - integrations
            - sticker
            - voice_call
            - null
          description: The type of the template message
        content_attributes:
          type: object
          description: The content attributes for each content_type
        sender_type:
          type:
            - string
            - "null"
          enum:
            - Contact
            - User
            - AgentBot
            - Captain::Assistant
            - null
          description: The type of the sender
        sender_id:
          type:
            - number
            - "null"
          description: The ID of the sender
        external_source_ids:
          type: object
          description: The external source IDs of the message
        additional_attributes:
          type: object
          description: The additional attributes of the message
        processed_message_content:
          type:
            - string
            - "null"
          description: The processed message content
        sentiment:
          type:
            - object
            - "null"
          description: The sentiment of the message
        conversation:
          type:
            - object
            - "null"
          description: The conversation object
        attachment:
          type:
            - object
            - "null"
          description: The file object attached to the image
        sender:
          type: object
          description: User/Agent/AgentBot object
    user:
      type: object
      properties:
        id:
          type: number
        access_token:
          type: string
        account_id:
          type: number
        available_name:
          type: string
        avatar_url:
          type: string
        confirmed:
          type: boolean
        display_name:
          type:
            - string
            - "null"
        message_signature:
          type:
            - string
            - "null"
        email:
          type: string
        hmac_identifier:
          type: string
        inviter_id:
          type:
            - number
            - "null"
        name:
          type: string
        provider:
          type: string
        pubsub_token:
          type: string
        role:
          type: string
          enum:
            - agent
            - administrator
        ui_settings:
          type: object
        uid:
          type: string
        type:
          type:
            - string
            - "null"
        custom_attributes:
          type: object
          description: Available for users who are created through platform APIs and has custom attributes associated.
        accounts:
          type: array
          items:
            type: object
            properties:
              id:
                type: number
              name:
                type: string
              status:
                type: string
              active_at:
                type:
                  - string
                  - "null"
                format: date-time
              role:
                type: string
                enum:
                  - administrator
                  - agent
              permissions:
                type: array
                items:
                  type: string
              availability:
                type: string
              availability_status:
                type: string
              auto_offline:
                type: boolean
              custom_role_id:
                type:
                  - number
                  - "null"
              custom_role:
                type:
                  - object
                  - "null"
    agent:
      type: object
      properties:
        id:
          type: integer
        account_id:
          type: integer
        availability_status:
          type: string
          enum:
            - available
            - busy
            - offline
          description: The availability status of the agent computed by SiteUp.
        auto_offline:
          type: boolean
          description: Whether the availability status of agent is configured to go offline automatically when away.
        confirmed:
          type: boolean
          description: Whether the agent has confirmed their email address.
        email:
          type: string
          description: The email of the agent
        available_name:
          type: string
          description: The available name of the agent
        name:
          type: string
          description: The name of the agent
        role:
          type: string
          enum:
            - agent
            - administrator
          description: The role of the agent
        thumbnail:
          type: string
          description: The thumbnail of the agent
        custom_role_id:
          type:
            - integer
            - "null"
          description: The custom role id of the agent
    inbox:
      type: object
      properties:
        id:
          type: number
          description: ID of the inbox
        name:
          type: string
          description: The name of the inbox
        website_url:
          type: string
          description: Website URL
        channel_type:
          type: string
          description: The type of the inbox
        avatar_url:
          type: string
          description: The avatar image of the inbox
        widget_color:
          type: string
          description: Widget Color used for customization of the widget
        website_token:
          type: string
          description: Website Token
        enable_auto_assignment:
          type: boolean
          description: The flag which shows whether Auto Assignment is enabled or not
        web_widget_script:
          type: string
          description: Script used to load the website widget
        welcome_title:
          type:
            - string
            - "null"
          description: Welcome title to be displayed on the widget
        welcome_tagline:
          type:
            - string
            - "null"
          description: Welcome tagline to be displayed on the widget
        greeting_enabled:
          type: boolean
          description: The flag which shows whether greeting is enabled
        greeting_message:
          type:
            - string
            - "null"
          description: A greeting message when the user starts the conversation
        channel_id:
          type: number
          description: ID of the channel this inbox belongs to
        working_hours_enabled:
          type: boolean
          description: The flag which shows whether working hours feature is enabled
        enable_email_collect:
          type: boolean
          description: The flag to enable collecting email from contacts
        csat_survey_enabled:
          type: boolean
          description: The flag to enable CSAT survey
        auto_assignment_config:
          type: object
          description: Configuration settings for auto assignment
        out_of_office_message:
          type:
            - string
            - "null"
          description: Message to show when agents are out of office
        working_hours:
          type: array
          description: Configuration for working hours of the inbox
          items:
            type: object
            properties:
              day_of_week:
                type: number
                description: Day of the week (0-6, where 0 is Sunday)
              closed_all_day:
                type: boolean
                description: Whether the inbox is closed for the entire day
              open_hour:
                type:
                  - number
                  - "null"
                description: Hour when inbox opens (0-23)
              open_minutes:
                type:
                  - number
                  - "null"
                description: Minutes of the hour when inbox opens (0-59)
              close_hour:
                type:
                  - number
                  - "null"
                description: Hour when inbox closes (0-23)
              close_minutes:
                type:
                  - number
                  - "null"
                description: Minutes of the hour when inbox closes (0-59)
              open_all_day:
                type: boolean
                description: Whether the inbox is open for the entire day
        timezone:
          type: string
          description: Timezone configuration for the inbox
        callback_webhook_url:
          type:
            - string
            - "null"
          description: Webhook URL for callbacks
        allow_messages_after_resolved:
          type: boolean
          description: Whether to allow messages after a conversation is resolved
        lock_to_single_conversation:
          type: boolean
          description: Whether to lock a contact to a single conversation
        sender_name_type:
          type: string
          description: Type of sender name to display (e.g., friendly)
        business_name:
          type:
            - string
            - "null"
          description: Business name associated with the inbox
        hmac_mandatory:
          type: boolean
          description: Whether HMAC verification is mandatory
        selected_feature_flags:
          type:
            - array
            - "null"
          description: Selected feature flags for the inbox
          items:
            type: string
        reply_time:
          type: string
          description: Expected reply time
        messaging_service_sid:
          type:
            - string
            - "null"
          description: Messaging service SID for SMS providers
        phone_number:
          type:
            - string
            - "null"
          description: Phone number associated with the inbox
        medium:
          type: string
          description: Medium of communication (e.g., sms, email)
        provider:
          type:
            - string
            - "null"
          description: Provider of the channel
    inbox_contact:
      type: object
      properties:
        id:
          type: number
          description: ID of the inbox
        avatar_url:
          type: string
          description: The avatar image of the inbox
        channel_id:
          type: number
          description: The ID of the channel
        name:
          type: string
          description: The name of the inbox
        channel_type:
          type: string
          description: The type of the inbox
        provider:
          type: string
          description: The provider of the inbox
    agent_bot:
      type: object
      properties:
        id:
          type: number
          description: ID of the agent bot
        name:
          type: string
          description: The name of the agent bot
        description:
          type: string
          description: The description about the agent bot
        thumbnail:
          type: string
          description: The thumbnail of the agent bot
        outgoing_url:
          type: string
          description: The webhook URL for the bot
        bot_type:
          type: string
          description: The type of the bot
        bot_config:
          type: object
          description: The configuration of the bot
        account_id:
          type: number
          description: Account ID if it's an account specific bot
        access_token:
          type: string
          description: The access token for the bot
        system_bot:
          type: boolean
          description: Whether the bot is a system bot
    contact_inboxes:
      type: object
      properties:
        source_id:
          type: string
          description: Contact Inbox Source Id
        inbox:
          $ref: "#/components/schemas/inbox_contact"
    contactable_inboxes:
      type: object
      properties:
        source_id:
          type: string
          description: Contact Inbox Source Id
        inbox:
          $ref: "#/components/schemas/inbox"
    custom_filter:
      type: object
      properties:
        id:
          type: number
          description: The ID of the custom filter
        name:
          type: string
          description: The name of the custom filter
        type:
          type: string
          enum:
            - conversation
            - contact
            - report
          description: The description about the custom filter
        query:
          type: object
          description: A query that needs to be saved as a custom filter
        created_at:
          type: string
          format: date-time
          description: The time at which the custom filter was created
        updated_at:
          type: string
          format: date-time
          description: The time at which the custom filter was updated
    webhook:
      type: object
      properties:
        id:
          type: number
          description: The ID of the webhook
        url:
          type: string
          description: The url to which the events will be send
        name:
          type: string
          description: The name of the webhook
        subscriptions:
          type: array
          items:
            type: string
            enum:
              - conversation_created
              - conversation_status_changed
              - conversation_updated
              - contact_created
              - contact_updated
              - message_created
              - message_updated
              - webwidget_triggered
          description: The list of subscribed events
        account_id:
          type: number
          description: The id of the account which the webhook object belongs to
    account:
      type: object
      properties:
        id:
          type: number
          description: Account ID
        name:
          type: string
          description: Name of the account
        role:
          type: string
          enum:
            - administrator
            - agent
          description: The user role in the account
    account_detail:
      type: object
      properties:
        id:
          type: number
          description: Account ID
        name:
          type: string
          description: Name of the account
        locale:
          type: string
          description: The locale of the account
        domain:
          type: string
          description: The domain of the account
        support_email:
          type: string
          description: The support email of the account
        status:
          type: string
          description: The status of the account
        created_at:
          type: string
          format: date-time
          description: The creation date of the account
        cache_keys:
          type: object
          description: Cache keys for the account
        features:
          type: object
          description: Enabled features for the account
        settings:
          type: object
          description: Account settings
          properties:
            auto_resolve_after:
              type: number
              description: Auto resolve conversations after specified minutes
            auto_resolve_message:
              type: string
              description: Message to send when auto resolving
            auto_resolve_ignore_waiting:
              type: boolean
              description: Whether to ignore waiting conversations for auto resolve
        custom_attributes:
          type: object
          description: Custom attributes of the account
          properties:
            plan_name:
              type:
                - string
                - "null"
              description: Subscription plan name
            subscribed_quantity:
              type:
                - number
                - "null"
              description: Subscribed quantity
            subscription_status:
              type:
                - string
                - "null"
              description: Subscription status
            subscription_ends_on:
              type:
                - string
                - "null"
              format: date
              description: Subscription end date
            industry:
              type: string
              description: Industry type
            company_size:
              type: string
              description: Company size
            timezone:
              type: string
              description: Account timezone
            logo:
              type: string
              description: Account logo URL
            onboarding_step:
              type: string
              description: Current onboarding step
            marked_for_deletion_at:
              type: string
              format: date-time
              description: When account was marked for deletion
            marked_for_deletion_reason:
              type: string
              description: Reason for account deletion
    account_show_response:
      allOf:
        - $ref: "#/components/schemas/account_detail"
        - type: object
          properties:
            subscribed_features:
              type: array
              items:
                type: string
              description: List of subscribed enterprise features (if enterprise edition is enabled)
    account_user:
      type: array
      description: Array of account users
      items:
        type: object
        properties:
          account_id:
            type: integer
            description: The ID of the account
          user_id:
            type: integer
            description: The ID of the user
          role:
            type: string
            description: whether user is an administrator or agent
    platform_account:
      type: object
      properties:
        id:
          type: number
          description: Account ID
        name:
          type: string
          description: Name of the account
    team:
      type: object
      properties:
        id:
          type: number
          description: The ID of the team
        name:
          type: string
          description: The name of the team
        description:
          type:
            - string
            - "null"
          description: The description about the team
        allow_auto_assign:
          type: boolean
          description: If this setting is turned on, the system would automatically assign the conversation to an agent in the team while assigning the conversation to a team
        account_id:
          type: number
          description: The ID of the account with the team is a part of
        is_member:
          type: boolean
          description: This field shows whether the current user is a part of the team
    label:
      type: object
      properties:
        id:
          type: number
          description: The ID of the label
        title:
          type: string
          description: The title of the label
        description:
          type: string
          description: The description of the label
        color:
          type: string
          description: Hex color code for the label
        show_on_sidebar:
          type: boolean
          description: Whether the label should appear in the sidebar
    integrations_app:
      type: object
      properties:
        id:
          type: string
          description: The ID of the integration
        name:
          type: string
          description: The name of the integration
        description:
          type: string
          description: The description about the team
        hook_type:
          type: string
          description: Whether the integration is an account or inbox integration
        enabled:
          type: boolean
          description: Whether the integration is enabled for the account
        allow_multiple_hooks:
          type: boolean
          description: Whether multiple hooks can be created for the integration
        hooks:
          type: array
          items:
            type: object
          description: If there are any hooks created for this integration
    integrations_hook:
      type: object
      properties:
        id:
          type: string
          description: The ID of the integration hook
        app_id:
          type: string
          description: The ID of the integration app
        inbox_id:
          type: string
          description: Inbox ID if its an Inbox integration
        account_id:
          type: string
          description: Account ID of the integration
        status:
          type: boolean
          description: Whether the integration hook is enabled for the account
        hook_type:
          type: boolean
          description: Whether its an account or inbox integration hook
        settings:
          type: object
          description: The associated settings for the integration
    audit_log:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier for the audit log entry
        auditable_id:
          type: integer
          description: The ID of the audited object
        auditable_type:
          type: string
          description: The type of the audited object (e.g., Conversation, Contact, User)
        auditable:
          type: object
          description: The audited object data
        associated_id:
          type: integer
          description: The ID of the associated object (typically the account ID)
        associated_type:
          type: string
          description: The type of the associated object
        user_id:
          type: integer
          description: The ID of the user who performed the action
        user_type:
          type: string
          description: The type of user who performed the action
        username:
          type: string
          description: The email/username of the user who performed the action
        action:
          type: string
          enum:
            - create
            - update
            - destroy
          description: The action performed on the object
        audited_changes:
          type: object
          description: JSON object containing the changes made to the audited object
        version:
          type: integer
          description: Version number of the audit log entry
        comment:
          type:
            - string
            - "null"
          description: Optional comment associated with the audit log entry
        request_uuid:
          type: string
          description: UUID to identify the request that generated this audit log
        created_at:
          type: integer
          description: Unix timestamp when the audit log entry was created
        remote_address:
          type:
            - string
            - "null"
          description: IP address from which the action was performed
    public_contact:
      type: object
      properties:
        id:
          type: integer
          description: Id of the contact
        source_id:
          type: string
          description: The session identifier of the contact
        name:
          type:
            - string
            - "null"
          description: Name of the contact when available
        email:
          type:
            - string
            - "null"
          description: Email of the contact
        phone_number:
          type:
            - string
            - "null"
          description: Phone number of the contact
        pubsub_token:
          type: string
          description: The token to be used to connect to SiteUp websocket
    public_contact_record:
      type: object
      additionalProperties: true
      description: Full serialized contact record returned when the public API renders a Contact model directly.
      properties:
        id:
          type: integer
          description: Id of the contact
        name:
          type:
            - string
            - "null"
          description: Name of the contact when available
        email:
          type:
            - string
            - "null"
          description: Email of the contact
        phone_number:
          type:
            - string
            - "null"
          description: Phone number of the contact
        identifier:
          type:
            - string
            - "null"
          description: Identifier of the contact
        blocked:
          type: boolean
          description: Whether the contact is blocked
        additional_attributes:
          type:
            - object
            - "null"
          description: Additional attributes of the contact when present
        custom_attributes:
          type:
            - object
            - "null"
          description: Custom attributes of the contact when present
        contact_type:
          type:
            - string
            - "null"
          description: Contact type of the contact when available
        country_code:
          type:
            - string
            - "null"
          description: Country code of the contact
        last_activity_at:
          type:
            - string
            - "null"
          description: Last activity timestamp of the contact in ISO 8601 format
        created_at:
          type:
            - string
            - "null"
          description: Created timestamp of the contact in ISO 8601 format
        updated_at:
          type:
            - string
            - "null"
          description: Updated timestamp of the contact in ISO 8601 format
        last_name:
          type:
            - string
            - "null"
          description: Last name of the contact
        middle_name:
          type:
            - string
            - "null"
          description: Middle name of the contact
        location:
          type:
            - string
            - "null"
          description: Location of the contact
        account_id:
          type: integer
          description: Account id of the contact
        company_id:
          type:
            - integer
            - "null"
          description: Company id of the contact
        label_list:
          type: array
          description: Labels applied to the contact
          items:
            type: string
    public_conversation:
      type: object
      properties:
        id:
          type: integer
          description: Id of the conversation
        uuid:
          type: string
          description: UUID of the conversation
        inbox_id:
          type: integer
          description: The inbox id of the conversation
        contact_last_seen_at:
          type: integer
          description: Timestamp of when the contact last seen the conversation (Unix timestamp)
        status:
          type: string
          enum:
            - open
            - resolved
            - pending
            - snoozed
          description: The status of the conversation
        agent_last_seen_at:
          type: integer
          description: Timestamp of when the agent last seen the conversation (Unix timestamp)
        messages:
          type: array
          items:
            $ref: "#/components/schemas/public_message"
          description: Messages in the conversation
        contact:
          $ref: "#/components/schemas/public_contact_record"
    public_message:
      type: object
      properties:
        id:
          type: integer
          description: Id of the message
        content:
          type:
            - string
            - "null"
          description: Text content of the message. Can be null for attachment-only messages.
        message_type:
          type: integer
          description: "Denotes the message type. Possible values: 0 (incoming), 1 (outgoing), 2 (activity), 3 (template)"
        content_type:
          type: string
          description: Content type of the message
        content_attributes:
          type: object
          description: Additional content attributes of the message
        created_at:
          type: integer
          description: Created at Unix timestamp of the message
        conversation_id:
          type: integer
          description: Display Id of the conversation the message belongs to
        attachments:
          type: array
          description: Attachments if any
          items:
            $ref: "#/components/schemas/public_message_attachment"
        sender:
          $ref: "#/components/schemas/public_message_sender"
    public_message_attachment:
      type: object
      additionalProperties: true
      description: Attachment payload. Available fields vary by attachment file_type.
      properties:
        id:
          type: integer
          description: Id of the attachment
        message_id:
          type: integer
          description: Id of the parent message
        file_type:
          type: string
          enum:
            - image
            - audio
            - video
            - file
            - location
            - fallback
            - share
            - story_mention
            - contact
            - ig_reel
            - ig_post
            - ig_story
            - embed
          description: Type of the attached file
        account_id:
          type: integer
          description: Id of the account
        extension:
          type:
            - string
            - "null"
          description: File extension
        data_url:
          type:
            - string
            - "null"
          description: URL of the file. Can be null when an attachment variant has no external URL.
        thumb_url:
          type: string
          description: URL of the file thumbnail
        file_size:
          type: integer
          description: File size in bytes
        width:
          type:
            - integer
            - "null"
          description: Width of the attachment when available
        height:
          type:
            - integer
            - "null"
          description: Height of the attachment when available
        coordinates_lat:
          type: number
          description: Latitude for location attachments
        coordinates_long:
          type: number
          description: Longitude for location attachments
        fallback_title:
          type:
            - string
            - "null"
          description: Fallback title for location, fallback, and contact attachments when available
        meta:
          type: object
          description: Metadata for contact attachments
        transcribed_text:
          type: string
          description: Transcribed text for audio attachments
    public_message_sender:
      type: object
      additionalProperties: true
      description: Polymorphic sender payload returned by push_event_data. Available fields vary by sender type.
      properties:
        id:
          type: integer
          description: Id of the sender
        name:
          type:
            - string
            - "null"
          description: Name of the sender when available
        avatar_url:
          type: string
          description: Avatar URL of the sender. Present for senders of type user, agent_bot, and captain_assistant. Not present for contact senders (use thumbnail instead).
        thumbnail:
          type: string
          description: Avatar/thumbnail URL of the sender. Contact senders use this field; user senders may also include it.
        type:
          type: string
          enum:
            - contact
            - user
            - agent_bot
            - captain_assistant
          description: Type of the sender
        available_name:
          type:
            - string
            - "null"
          description: Display name for user senders
        availability_status:
          type:
            - string
            - "null"
          description: Availability status for user senders
        email:
          type:
            - string
            - "null"
          description: Email of the sender when the sender is a contact
        phone_number:
          type:
            - string
            - "null"
          description: Phone number of the sender when the sender is a contact
        identifier:
          type:
            - string
            - "null"
          description: Identifier of the sender when the sender is a contact
        blocked:
          type: boolean
          description: Whether the sender is blocked when the sender is a contact
        additional_attributes:
          type:
            - object
            - "null"
          description: Additional attributes when the sender is a contact and available
        custom_attributes:
          type:
            - object
            - "null"
          description: Custom attributes when the sender is a contact and available
        description:
          type:
            - string
            - "null"
          description: Description when the sender is a captain assistant
        created_at:
          type:
            - string
            - "null"
          description: Created timestamp in ISO 8601 format when the sender is a captain assistant
    public_inbox:
      type: object
      properties:
        identifier:
          type: string
          description: Inbox identifier
        name:
          type: string
          description: Name of the inbox
        timezone:
          type: string
          description: The timezone defined on the inbox
        working_hours:
          type: array
          description: The working hours defined on the inbox
          items:
            type: object
            properties:
              day_of_week:
                type: integer
                description: Day of the week as a number. Sunday -> 0, Saturday -> 6
              open_all_day:
                type: boolean
                description: Whether or not the business is open the whole day
              closed_all_day:
                type: boolean
                description: Whether or not the business is closed the whole day
              open_hour:
                type: integer
                description: Opening hour. Can be null if closed all day
              open_minutes:
                type: integer
                description: Opening minute. Can be null if closed all day
              close_hour:
                type: integer
                description: Closing hour. Can be null if closed all day
              close_minutes:
                type: integer
                description: Closing minute. Can be null if closed all day
        working_hours_enabled:
          type: boolean
          description: Whether of not the working hours are enabled on the inbox
        csat_survey_enabled:
          type: boolean
          description: Whether of not the Customer Satisfaction survey is enabled on the inbox
        greeting_enabled:
          type: boolean
          description: Whether of not the Greeting Message is enabled on the inbox
        identity_validation_enabled:
          type: boolean
          description: Whether of not the User Identity Validation is enforced on the inbox
    account_create_update_payload:
      type: object
      properties:
        name:
          type: string
          description: Name of the account
          example: My Account
        locale:
          type: string
          description: The locale of the account
          example: en
        domain:
          type: string
          description: The domain of the account
          example: example.com
        support_email:
          type: string
          description: The support email of the account
          example: support@example.com
        status:
          type: string
          enum:
            - active
            - suspended
          description: The status of the account
          example: active
        limits:
          type: object
          description: The limits of the account
          example: {}
        custom_attributes:
          type: object
          description: The custom attributes of the account
          example: {}
    account_update_payload:
      type: object
      properties:
        name:
          type: string
          description: Name of the account
          example: My Account
        locale:
          type: string
          description: The locale of the account
          example: en
        domain:
          type: string
          description: The domain of the account
          example: example.com
        support_email:
          type: string
          description: The support email of the account
          example: support@example.com
        auto_resolve_after:
          type:
            - integer
            - "null"
          minimum: 10
          maximum: 1439856
          description: Auto resolve conversations after specified minutes
          example: 1440
        auto_resolve_message:
          type:
            - string
            - "null"
          description: Message to send when auto resolving
          example: This conversation has been automatically resolved due to inactivity
        auto_resolve_ignore_waiting:
          type:
            - boolean
            - "null"
          description: Whether to ignore waiting conversations for auto resolve
          example: false
        industry:
          type: string
          description: Industry type
          example: Technology
        company_size:
          type: string
          description: Company size
          example: 50-100
        timezone:
          type: string
          description: Account timezone
          example: UTC
    account_user_create_update_payload:
      type: object
      required:
        - user_id
        - role
      properties:
        user_id:
          type: integer
          description: The ID of the user
          example: 1
        role:
          type: string
          description: whether user is an administrator or agent
          example: administrator
    platform_agent_bot_create_update_payload:
      type: object
      properties:
        name:
          type: string
          description: The name of the agent bot
          example: My Agent Bot
        description:
          type: string
          description: The description of the agent bot
          example: This is a sample agent bot
        outgoing_url:
          type: string
          description: The webhook URL for the bot
          example: https://example.com/webhook
        account_id:
          type: integer
          description: The account ID to associate the agent bot with
          example: 1
        avatar:
          type: string
          format: binary
          description: Send the form data with the avatar image binary or use the avatar_url
        avatar_url:
          type: string
          description: The url to a jpeg, png file for the agent bot avatar
          example: https://example.com/avatar.png
    agent_bot_create_update_payload:
      type: object
      properties:
        name:
          type: string
          description: The name of the agent bot
          example: My Agent Bot
        description:
          type: string
          description: The description of the agent bot
          example: This is a sample agent bot
        outgoing_url:
          type: string
          description: The webhook URL for the bot
          example: https://example.com/webhook
        avatar:
          type: string
          format: binary
          description: Send the form data with the avatar image binary or use the avatar_url
        avatar_url:
          type: string
          description: The url to a jpeg, png file for the agent bot avatar
          example: https://example.com/avatar.png
        bot_type:
          type: integer
          description: The type of the bot (0 for webhook)
          example: 0
        bot_config:
          type: object
          description: The configuration for the bot
          example: {}
    user_create_update_payload:
      type: object
      properties:
        name:
          type: string
          description: Name of the user
          example: Daniel
        display_name:
          type: string
          description: Display name of the user
          example: Dan
        email:
          type: string
          description: Email of the user
          example: daniel@acme.inc
        password:
          type: string
          description: Password must contain uppercase, lowercase letters, number and a special character
          example: Password2!
        custom_attributes:
          type: object
          description: Custom attributes you want to associate with the user
          example: {}
    canned_response_create_update_payload:
      type: object
      properties:
        content:
          type: string
          description: Message content for canned response
          example: Hello, {{contact.name}}! Welcome to our service.
        short_code:
          type: string
          description: Short Code for quick access of the canned response
          example: welcome
    custom_attribute_create_update_payload:
      type: object
      properties:
        attribute_display_name:
          type: string
          description: Attribute display name
          example: Custom Attribute
        attribute_display_type:
          type: integer
          description: Attribute display type (text- 0, number- 1, currency- 2, percent- 3, link- 4, date- 5, list- 6, checkbox- 7)
          example: 0
        attribute_description:
          type: string
          description: Attribute description
          example: This is a custom attribute
        attribute_key:
          type: string
          description: Attribute unique key value
          example: custom_attribute
        attribute_values:
          type: array
          description: Attribute values
          items:
            type: string
          example:
            - value1
            - value2
        attribute_model:
          type: integer
          description: Attribute type(conversation_attribute- 0, contact_attribute- 1)
          example: 0
        regex_pattern:
          type: string
          description: Regex pattern (Only applicable for type- text). The regex pattern is used to validate the attribute value(s).
          example: ^[a-zA-Z0-9]+$
        regex_cue:
          type: string
          description: Regex cue message (Only applicable for type- text). The cue message is shown when the regex pattern is not matched.
          example: Please enter a valid value
    agent_create_payload:
      type: object
      required:
        - name
        - email
        - role
      properties:
        name:
          type: string
          description: Full Name of the agent
          example: John Doe
        email:
          type: string
          description: Email of the Agent
          example: john.doe@acme.inc
        role:
          type: string
          enum:
            - agent
            - administrator
          description: Whether its administrator or agent
          example: agent
        availability_status:
          type: string
          enum:
            - available
            - busy
            - offline
          description: The availability setting of the agent.
          example: available
        auto_offline:
          type: boolean
          description: Whether the availability status of agent is configured to go offline automatically when away.
          example: true
    agent_update_payload:
      type: object
      required:
        - role
      properties:
        role:
          type: string
          enum:
            - agent
            - administrator
          description: Whether its administrator or agent
          example: agent
        availability_status:
          type: string
          enum:
            - available
            - busy
            - offline
          description: The availability status of the agent.
          example: available
        auto_offline:
          type: boolean
          description: Whether the availability status of agent is configured to go offline automatically when away.
          example: true
    contact_create_payload:
      type: object
      required:
        - inbox_id
      properties:
        inbox_id:
          type: number
          description: ID of the inbox to which the contact belongs
          example: 1
        name:
          type: string
          description: name of the contact
          example: Alice
        email:
          type: string
          description: email of the contact
          example: alice@acme.inc
        blocked:
          type: boolean
          description: whether the contact is blocked or not
          example: false
        phone_number:
          type: string
          description: phone number of the contact
          example: "+123456789"
        avatar:
          type: string
          format: binary
          description: Send the form data with the avatar image binary or use the avatar_url
        avatar_url:
          type: string
          description: The url to a jpeg, png file for the contact avatar
          example: https://example.com/avatar.png
        identifier:
          type: string
          description: A unique identifier for the contact in external system
          example: "1234567890"
        additional_attributes:
          type: object
          description: An object where you can store additional attributes for contact. example {"type":"customer", "age":30}
          example:
            type: customer
            age: 30
        custom_attributes:
          type: object
          description: An object where you can store custom attributes for contact. example {"type":"customer", "age":30}, this should have a valid custom attribute definition.
          example: {}
    contact_update_payload:
      type: object
      properties:
        name:
          type: string
          description: name of the contact
          example: Alice
        email:
          type: string
          description: email of the contact
          example: alice@acme.inc
        blocked:
          type: boolean
          description: whether the contact is blocked or not
          example: false
        phone_number:
          type: string
          description: phone number of the contact
          example: "+123456789"
        avatar:
          type: string
          format: binary
          description: Send the form data with the avatar image binary or use the avatar_url
        avatar_url:
          type: string
          description: The url to a jpeg, png file for the contact avatar
          example: https://example.com/avatar.png
        identifier:
          type: string
          description: A unique identifier for the contact in external system
          example: "1234567890"
        additional_attributes:
          type: object
          description: An object where you can store additional attributes for contact. example {"type":"customer", "age":30}
          example:
            type: customer
            age: 30
        custom_attributes:
          type: object
          description: An object where you can store custom attributes for contact. example {"type":"customer", "age":30}, this should have a valid custom attribute definition.
          example: {}
    conversation_create_payload:
      type: object
      required:
        - source_id
      properties:
        source_id:
          type: string
          description: Conversation source id
          example: "1234567890"
        inbox_id:
          type: integer
          description: "Id of inbox in which the conversation is created <br/> Allowed Inbox Types: Website, Phone, Api, Email"
          example: 1
        contact_id:
          type: integer
          description: Contact Id for which conversation is created
          example: 1
        additional_attributes:
          type: object
          description: Lets you specify attributes like browser information
          example:
            browser: Chrome
            browser_version: 89.0.4389.82
            os: Windows
            os_version: "10"
        custom_attributes:
          type: object
          description: The object to save custom attributes for conversation, accepts custom attributes key and value
          example:
            attribute_key: attribute_value
            priority_conversation_number: 3
        status:
          type: string
          enum:
            - open
            - resolved
            - pending
          description: Specify the conversation whether it's pending, open, closed
          example: open
        assignee_id:
          type: integer
          description: Agent Id for assigning a conversation to an agent
          example: 1
        team_id:
          type: integer
          description: Team Id for assigning a conversation to a team\
          example: 1
        snoozed_until:
          type: string
          format: date-time
          description: Snoozed until date time
          example: 2030-07-21T17:32:28Z
        message:
          type: object
          description: The initial message to be sent to the conversation
          required:
            - content
          properties:
            content:
              type: string
              description: The content of the message
              example: Hello, how can I help you?
            template_params:
              type: object
              description: The template params for the message in case of whatsapp Channel
              properties:
                name:
                  type: string
                  description: Name of the template
                  example: sample_issue_resolution
                category:
                  type: string
                  description: Category of the template
                  example: UTILITY
                language:
                  type: string
                  description: Language of the template
                  example: en_US
                processed_params:
                  type: object
                  description: The processed param values for template variables in template
                  example:
                    "1": SiteUp
    conversation_message_create_payload:
      type: object
      required:
        - content
      properties:
        content:
          type: string
          description: The content of the message
          example: Hello, how can I help you?
        message_type:
          type: string
          enum:
            - outgoing
            - incoming
          description: The type of the message
          example: outgoing
        private:
          type: boolean
          description: Flag to identify if it is a private note
          example: false
        content_type:
          type: string
          enum:
            - text
            - input_email
            - cards
            - input_select
            - form
            - article
          description: Content type of the message
          example: text
        content_attributes:
          type: object
          description: Attributes based on the content type
          example: {}
        campaign_id:
          type: integer
          description: The campaign id to which the message belongs
          example: 1
        template_params:
          type: object
          description: WhatsApp template parameters for sending structured messages
          required:
            - name
            - category
            - language
            - processed_params
          properties:
            name:
              type: string
              description: Name of the WhatsApp template (must be approved in WhatsApp Business Manager)
              example: purchase_receipt
            category:
              type: string
              enum:
                - UTILITY
                - MARKETING
                - SHIPPING_UPDATE
                - TICKET_UPDATE
                - ISSUE_RESOLUTION
              description: Category of the template
              example: UTILITY
            language:
              type: string
              description: Language code of the template (BCP 47 format)
              example: en_US
            processed_params:
              type: object
              description: Processed template parameters organized by component type
              properties:
                body:
                  type: object
                  description: Body component parameters with variable placeholders
                  additionalProperties:
                    type: string
                  example:
                    "1": Visa
                    "2": Nike
                    "3": Bill
                header:
                  type: object
                  description: Header component parameters for media templates
                  properties:
                    media_url:
                      type: string
                      format: uri
                      description: Publicly accessible URL for IMAGE, VIDEO, or DOCUMENT headers
                      example: https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf
                    media_type:
                      type: string
                      enum:
                        - image
                        - video
                        - document
                      description: Type of media for the header
                      example: document
                buttons:
                  type: array
                  description: Button component parameters for interactive templates
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - url
                          - copy_code
                        description: Type of button parameter
                      parameter:
                        type: string
                        description: Dynamic parameter value for the button
                        example: SSFSDFSD
    inbox_create_payload:
      type: object
      properties:
        name:
          type: string
          description: The name of the inbox
          example: Support
        avatar:
          type: string
          format: binary
          description: Image file for avatar
        greeting_enabled:
          type: boolean
          description: Enable greeting message
          example: true
        greeting_message:
          type: string
          description: Greeting message to be displayed on the widget
          example: Hello, how can I help you?
        enable_email_collect:
          type: boolean
          description: Enable email collection
          example: true
        csat_survey_enabled:
          type: boolean
          description: Enable CSAT survey
          example: true
        enable_auto_assignment:
          type: boolean
          description: Enable Auto Assignment
          example: true
        working_hours_enabled:
          type: boolean
          description: Enable working hours
          example: true
        out_of_office_message:
          type: string
          description: Out of office message to be displayed on the widget
          example: We are currently out of office. Please leave a message and we will get back to you.
        timezone:
          type: string
          description: Timezone of the inbox
          example: America/New_York
        allow_messages_after_resolved:
          type: boolean
          description: Allow messages after conversation is resolved
          example: true
        lock_to_single_conversation:
          type: boolean
          description: Lock to single conversation
          example: true
        portal_id:
          type: integer
          description: Id of the help center portal to attach to the inbox
          example: 1
        sender_name_type:
          type: string
          description: Sender name type for the inbox
          enum:
            - friendly
            - professional
          example: friendly
        business_name:
          type: string
          description: Business name for the inbox
          example: My Business
        channel:
          type: object
          properties:
            type:
              type: string
              description: Type of the channel
              enum:
                - web_widget
                - api
                - email
                - line
                - telegram
                - whatsapp
                - sms
              example: web_widget
            website_url:
              type: string
              description: URL at which the widget will be loaded
              example: https://example.com
            welcome_title:
              type: string
              description: Welcome title to be displayed on the widget
              example: Welcome to our support
            welcome_tagline:
              type: string
              description: Welcome tagline to be displayed on the widget
              example: We are here to help you
            widget_color:
              type: string
              description: A Hex-color string used to customize the widget
              example: "#FF5733"
    inbox_update_payload:
      type: object
      properties:
        name:
          type: string
          description: The name of the inbox
          example: Support
        avatar:
          type: string
          format: binary
          description: Image file for avatar
        greeting_enabled:
          type: boolean
          description: Enable greeting message
          example: true
        greeting_message:
          type: string
          description: Greeting message to be displayed on the widget
          example: Hello, how can I help you?
        enable_email_collect:
          type: boolean
          description: Enable email collection
          example: true
        csat_survey_enabled:
          type: boolean
          description: Enable CSAT survey
          example: true
        enable_auto_assignment:
          type: boolean
          description: Enable Auto Assignment
          example: true
        working_hours_enabled:
          type: boolean
          description: Enable working hours
          example: true
        out_of_office_message:
          type: string
          description: Out of office message to be displayed on the widget
          example: We are currently out of office. Please leave a message and we will get back to you.
        timezone:
          type: string
          description: Timezone of the inbox
          example: America/New_York
        allow_messages_after_resolved:
          type: boolean
          description: Allow messages after conversation is resolved
          example: true
        lock_to_single_conversation:
          type: boolean
          description: Lock to single conversation
          example: true
        portal_id:
          type: integer
          description: Id of the help center portal to attach to the inbox
          example: 1
        sender_name_type:
          type: string
          description: Sender name type for the inbox
          enum:
            - friendly
            - professional
          example: friendly
        business_name:
          type: string
          description: Business name for the inbox
          example: My Business
        channel:
          type: object
          properties:
            website_url:
              type: string
              description: URL at which the widget will be loaded
              example: https://example.com
            welcome_title:
              type: string
              description: Welcome title to be displayed on the widget
              example: Welcome to our support
            welcome_tagline:
              type: string
              description: Welcome tagline to be displayed on the widget
              example: We are here to help you
            widget_color:
              type: string
              description: A Hex-color string used to customize the widget
              example: "#FF5733"
    team_create_update_payload:
      type: object
      properties:
        name:
          type: string
          description: The name of the team
          example: Support Team
        description:
          type: string
          description: The description of the team
          example: This is a team of support agents
        allow_auto_assign:
          type: boolean
          description: If this setting is turned on, the system would automatically assign the conversation to an agent in the team while assigning the conversation to a team
          example: true
    label_create_update_payload:
      type: object
      properties:
        title:
          type: string
          description: The label title
          example: support
        description:
          type: string
          description: A short description for the label
          example: Conversations that need support follow-up
        color:
          type: string
          description: Hex color code for the label
          example: "#1f93ff"
        show_on_sidebar:
          type: boolean
          description: Whether the label should appear in the sidebar
          example: true
    custom_filter_create_update_payload:
      type: object
      properties:
        name:
          type: string
          description: The name of the custom filter
          example: My Custom Filter
        type:
          type: string
          enum:
            - conversation
            - contact
            - report
          description: The description about the custom filter
          example: conversation
        query:
          type: object
          description: A query that needs to be saved as a custom filter
          example: {}
    webhook_create_update_payload:
      type: object
      properties:
        url:
          type: string
          description: The url where the events should be sent
          example: https://example.com/webhook
        name:
          type: string
          description: The name of the webhook
        subscriptions:
          type: array
          items:
            type: string
            enum:
              - conversation_created
              - conversation_status_changed
              - conversation_updated
              - message_created
              - message_updated
              - contact_created
              - contact_updated
              - webwidget_triggered
          description: The events you want to subscribe to.
          example:
            - conversation_created
            - conversation_status_changed
    integrations_hook_create_payload:
      type: object
      properties:
        app_id:
          type: integer
          description: The ID of app for which integration hook is being created
          example: 1
        inbox_id:
          type: integer
          description: The inbox ID, if the hook is an inbox hook
          example: 1
        status:
          type: integer
          description: The status of the integration (0 for inactive, 1 for active)
          example: 1
        settings:
          type: object
          description: The settings required by the integration
          example: {}
    integrations_hook_update_payload:
      type: object
      properties:
        status:
          type: integer
          description: The status of the integration (0 for inactive, 1 for active)
          example: 1
        settings:
          type: object
          description: The settings required by the integration
          example: {}
    automation_rule_create_update_payload:
      type: object
      properties:
        name:
          type: string
          description: Rule name
          example: Add label on message create event
        description:
          type: string
          description: The description about the automation and actions
          example: Add label support and sales on message create event if incoming message content contains text help
        event_name:
          type: string
          enum:
            - conversation_created
            - conversation_updated
            - conversation_resolved
            - message_created
          example: message_created
          description: The event when you want to execute the automation actions
        active:
          type: boolean
          description: Enable/disable automation rule
        actions:
          type: array
          description: Array of actions which you want to perform when condition matches, e.g add label support if message contains content help.
          items:
            type: object
            example:
              action_name: add_label
              action_params:
                - support
        conditions:
          type: array
          description: Array of conditions on which conversation filter would work, e.g message content contains text help.
          items:
            type: object
            example:
              attribute_key: content
              filter_operator: contains
              query_operator: OR
              values:
                - help
    portal_create_update_payload:
      type: object
      properties:
        color:
          type: string
          description: Header color for help-center in hex format
          example: "#FFFFFF"
        custom_domain:
          type: string
          description: Custom domain to display help center.
          example: siteup.help
        header_text:
          type: string
          description: Help center header
          example: Handbook
        homepage_link:
          type: string
          description: link to main dashboard
          example: https://siteup.com.br
        name:
          type: string
          description: Name for the portal
          example: Handbook
        page_title:
          type: string
          description: Page title for the portal
          example: Handbook
        slug:
          type: string
          description: Slug for the portal to display in link
          example: handbook
        archived:
          type: boolean
          description: Status to check if portal is live
          example: false
        config:
          type: object
          description: Configuration about supporting locales
          example:
            allowed_locales:
              - en
              - es
            default_locale: en
    category_create_update_payload:
      type: object
      properties:
        name:
          type: string
          description: The name of the category
          example: Category Name
        description:
          type: string
          description: A description for the category
          example: Category description
        position:
          type: integer
          description: Category position in the portal list to sort
          example: 1
        slug:
          type: string
          description: The category slug used in the URL
          example: category-name
        locale:
          type: string
          description: The locale of the category
          example: en
        icon:
          type: string
          description: The icon of the category as a string (emoji)
          example: 📚
        parent_category_id:
          type: integer
          description: To define parent category, e.g product documentation has multiple level features in sales category or in engineering category.
          example: 1
        associated_category_id:
          type: integer
          description: To associate similar categories to each other, e.g same category of product documentation in different languages
          example: 2
    article_create_update_payload:
      type: object
      properties:
        title:
          type: string
          description: The title of the article
          example: Article Title
        slug:
          type: string
          description: The slug of the article
          example: article-title
        position:
          type: integer
          description: article position in category
          example: 1
        content:
          type: string
          description: The text content.
          example: This is the content of the article
        description:
          type: string
          description: The description of the article
          example: This is the description of the article
        category_id:
          type: integer
          description: The category id of the article
          example: 1
        author_id:
          type: integer
          description: The author agent id of the article
          example: 1
        associated_article_id:
          type: integer
          description: To associate similar articles to each other, e.g to provide the link for the reference.
          example: 2
        status:
          type: integer
          description: The status of the article. 0 for draft, 1 for published, 2 for archived
          example: 1
        locale:
          type: string
          description: The locale of the article
          example: en
        meta:
          type: object
          description: Use for search
          example:
            tags:
              - article_name
            title: article title
            description: article description
    public_contact_create_update_payload:
      type: object
      properties:
        identifier:
          type: string
          description: External identifier of the contact
          example: "1234567890"
        identifier_hash:
          type: string
          description: Identifier hash prepared for HMAC authentication
          example: e93275d4eba0e5679ad55f5360af00444e2a888df9b0afa3e8b691c3173725f9
        email:
          type: string
          description: Email of the contact
          example: alice@acme.inc
        name:
          type: string
          description: Name of the contact
          example: Alice
        phone_number:
          type: string
          description: Phone number of the contact
          example: "+123456789"
        avatar:
          type: string
          format: binary
          description: Send the form data with the avatar image binary or use the avatar_url
        custom_attributes:
          type: object
          description: Custom attributes of the customer
          example: {}
    public_message_create_payload:
      type: object
      properties:
        content:
          type: string
          description: Content for the message
          example: Hello, how can I help you?
        echo_id:
          type: string
          description: Temporary identifier which will be passed back via websockets
          example: "1234567890"
    public_message_update_payload:
      type: object
      properties:
        submitted_values:
          type: object
          description: Replies to the Bot Message Types
          properties:
            name:
              type: string
              description: The name of the submiitted value
              example: My Name
            title:
              type: string
              description: The title of the submitted value
              example: My Title
            value:
              type: string
              description: The value of the submitted value
              example: value
            csat_survey_response:
              type: object
              description: The CSAT survey response
              properties:
                feedback_message:
                  type: string
                  description: The feedback message of the CSAT survey response
                  example: Great service!
                rating:
                  type: integer
                  description: The rating of the CSAT survey response
                  example: 5
    public_conversation_create_payload:
      type: object
      properties:
        custom_attributes:
          type: object
          description: Custom attributes of the conversation
          example: {}
    extended_contact:
      allOf:
        - $ref: "#/components/schemas/contact"
        - type: object
          properties:
            id:
              type: number
              description: Id of the user
            availability_status:
              type: string
              enum:
                - online
                - offline
              description: Availability status of the user
    contact_base:
      allOf:
        - $ref: "#/components/schemas/generic_id"
        - $ref: "#/components/schemas/contact"
    contact_list:
      type: array
      description: array of contacts
      items:
        allOf:
          - $ref: "#/components/schemas/contact"
    contact_conversations:
      type: array
      description: array of conversations
      items:
        allOf:
          - $ref: "#/components/schemas/conversation"
          - type: object
            properties:
              meta:
                type: object
                properties:
                  sender:
                    type: object
                    properties:
                      additional_attributes:
                        type: object
                        description: The additional attributes of the sender
                      availability_status:
                        type: string
                        description: The availability status of the sender
                      email:
                        type:
                          - string
                          - "null"
                        description: The email of the sender
                      id:
                        type: number
                        description: ID fo the sender
                      name:
                        type: string
                        description: The name of the sender
                      phone_number:
                        type:
                          - string
                          - "null"
                        description: The phone number of the sender
                      blocked:
                        type: boolean
                        description: Whether the sender is blocked
                      identifier:
                        type:
                          - string
                          - "null"
                        description: The identifier of the sender
                      thumbnail:
                        type:
                          - string
                          - "null"
                        description: Avatar URL of the contact
                      custom_attributes:
                        type: object
                        description: The custom attributes of the sender
                      last_activity_at:
                        type: number
                        description: The last activity at of the sender
                      created_at:
                        type: number
                        description: The created at of the sender
                  channel:
                    type: string
                    description: Channel Type
                  assignee:
                    $ref: "#/components/schemas/user"
                  hmac_verified:
                    type: boolean
                    description: Whether the hmac is verified
          - type: object
            properties:
              display_id:
                type: number
    contact_labels:
      type: object
      properties:
        payload:
          type: array
          description: Array of labels
          items:
            type: string
    conversation_list:
      type: object
      properties:
        data:
          type: object
          properties:
            meta:
              type: object
              properties:
                mine_count:
                  type: number
                unassigned_count:
                  type: number
                assigned_count:
                  type: number
                all_count:
                  type: number
            payload:
              type: array
              description: array of conversations
              items:
                allOf:
                  - $ref: "#/components/schemas/generic_id"
                  - $ref: "#/components/schemas/conversation"
                  - type: object
                    properties:
                      meta:
                        type: object
                        properties:
                          sender:
                            type: object
                            properties:
                              additional_attributes:
                                type: object
                                description: The additional attributes of the sender
                              availability_status:
                                type: string
                                description: The availability status of the sender
                              email:
                                type:
                                  - string
                                  - "null"
                                description: The email of the sender
                              id:
                                type: number
                                description: ID fo the sender
                              name:
                                type: string
                                description: The name of the sender
                              phone_number:
                                type:
                                  - string
                                  - "null"
                                description: The phone number of the sender
                              blocked:
                                type: boolean
                                description: Whether the sender is blocked
                              identifier:
                                type:
                                  - string
                                  - "null"
                                description: The identifier of the sender
                              thumbnail:
                                type:
                                  - string
                                  - "null"
                                description: Avatar URL of the contact
                              custom_attributes:
                                type: object
                                description: The custom attributes of the sender
                              last_activity_at:
                                type: number
                                description: The last activity at of the sender
                              created_at:
                                type: number
                                description: The created at of the sender
                          channel:
                            type: string
                            description: Channel Type
                          assignee:
                            $ref: "#/components/schemas/user"
                          hmac_verified:
                            type: boolean
                            description: Whether the hmac is verified
    conversation_show:
      type: object
      allOf:
        - $ref: "#/components/schemas/conversation"
        - type: object
          properties:
            meta:
              type: object
              properties:
                sender:
                  type: object
                  properties:
                    additional_attributes:
                      type: object
                      description: The additional attributes of the sender
                    availability_status:
                      type: string
                      description: The availability status of the sender
                    email:
                      type:
                        - string
                        - "null"
                      description: The email of the sender
                    id:
                      type: number
                      description: ID fo the sender
                    name:
                      type: string
                      description: The name of the sender
                    phone_number:
                      type:
                        - string
                        - "null"
                      description: The phone number of the sender
                    blocked:
                      type: boolean
                      description: Whether the sender is blocked
                    identifier:
                      type:
                        - string
                        - "null"
                      description: The identifier of the sender
                    thumbnail:
                      type:
                        - string
                        - "null"
                      description: Avatar URL of the contact
                    custom_attributes:
                      type: object
                      description: The custom attributes of the sender
                    last_activity_at:
                      type: number
                      description: The last activity at of the sender
                    created_at:
                      type: number
                      description: The created at of the sender
                channel:
                  type: string
                  description: Channel Type
                assignee:
                  $ref: "#/components/schemas/user"
                hmac_verified:
                  type: boolean
                  description: Whether the hmac is verified
    conversation_status_toggle:
      type: object
      properties:
        meta:
          type: object
        payload:
          type: object
          properties:
            success:
              type: boolean
            current_status:
              type: string
              enum:
                - open
                - resolved
            conversation_id:
              type: number
    conversation_labels:
      type: object
      properties:
        payload:
          type: array
          description: Array of labels
          items:
            type: string
    account_summary:
      type: object
      properties:
        avg_first_response_time:
          type: string
        avg_resolution_time:
          type: string
        conversations_count:
          type: number
        incoming_messages_count:
          type: number
        outgoing_messages_count:
          type: number
        resolutions_count:
          type: number
        previous:
          type: object
          properties:
            avg_first_response_time:
              type: string
            avg_resolution_time:
              type: string
            conversations_count:
              type: number
            incoming_messages_count:
              type: number
            outgoing_messages_count:
              type: number
            resolutions_count:
              type: number
    agent_conversation_metrics:
      type: object
      properties:
        id:
          type: number
        name:
          type: string
        email:
          type: string
        thumbnail:
          type: string
        availability:
          type: string
        metric:
          type: object
          properties:
            open:
              type: number
            unattended:
              type: number
    channel_summary:
      type: object
      description: Channel summary report containing conversation counts grouped by channel type and status. Available in version 4.10.0+.
      additionalProperties:
        type: object
        description: Conversation statistics for a specific channel type (e.g., Channel::WebWidget, Channel::Api)
        properties:
          open:
            type: number
            description: Number of open conversations
          resolved:
            type: number
            description: Number of resolved conversations
          pending:
            type: number
            description: Number of pending conversations
          snoozed:
            type: number
            description: Number of snoozed conversations
          total:
            type: number
            description: Total number of conversations
      example:
        Channel::WebWidget:
          open: 10
          resolved: 20
          pending: 5
          snoozed: 2
          total: 37
        Channel::Api:
          open: 5
          resolved: 15
          pending: 3
          snoozed: 1
          total: 24
    first_response_time_distribution:
      type: object
      description: First response time distribution report grouped by channel type. Shows the count of conversations with first response times in different time buckets.
      additionalProperties:
        type: object
        description: First response time distribution for a specific channel type (e.g., Channel::WebWidget, Channel::Api)
        properties:
          0-1h:
            type: number
            description: Number of conversations with first response time less than 1 hour
          1-4h:
            type: number
            description: Number of conversations with first response time between 1-4 hours
          4-8h:
            type: number
            description: Number of conversations with first response time between 4-8 hours
          8-24h:
            type: number
            description: Number of conversations with first response time between 8-24 hours
          24h+:
            type: number
            description: Number of conversations with first response time greater than 24 hours
      example:
        Channel::WebWidget:
          0-1h: 150
          1-4h: 80
          4-8h: 45
          8-24h: 30
          24h+: 15
        Channel::Api:
          0-1h: 75
          1-4h: 40
          4-8h: 20
          8-24h: 10
          24h+: 5
    inbox_label_matrix:
      type: object
      description: Inbox-label matrix report showing the count of conversations for each inbox-label combination.
      properties:
        inboxes:
          type: array
          description: List of inboxes included in the report
          items:
            type: object
            properties:
              id:
                type: number
                description: The inbox ID
              name:
                type: string
                description: The inbox name
        labels:
          type: array
          description: List of labels included in the report
          items:
            type: object
            properties:
              id:
                type: number
                description: The label ID
              title:
                type: string
                description: The label title
        matrix:
          type: array
          description: 2D array where matrix[i][j] represents the count of conversations in inboxes[i] with labels[j]
          items:
            type: array
            items:
              type: number
      example:
        inboxes:
          - id: 1
            name: Website Chat
          - id: 2
            name: Email Support
        labels:
          - id: 1
            title: bug
          - id: 2
            title: feature-request
          - id: 3
            title: urgent
        matrix:
          - - 10
            - 5
            - 3
          - - 8
            - 12
            - 2
    outgoing_messages_count:
      type: array
      description: Outgoing messages count report grouped by entity (agent, team, inbox, or label).
      items:
        type: object
        properties:
          id:
            type: number
            description: The ID of the grouped entity (agent, team, inbox, or label).
          name:
            type: string
            description: The name of the grouped entity.
          outgoing_messages_count:
            type: number
            description: The total number of outgoing messages for this entity in the given time range.
      example:
        - id: 1
          name: Agent One
          outgoing_messages_count: 42
        - id: 2
          name: Agent Two
          outgoing_messages_count: 18
    inbox_summary:
      type: array
      description: Inbox summary report containing conversation statistics grouped by inbox.
      items:
        type: object
        properties:
          id:
            type: number
            description: The inbox ID
          conversations_count:
            type: number
            description: Number of conversations created in the inbox during the date range
          resolved_conversations_count:
            type: number
            description: Number of conversations resolved in the inbox during the date range
          avg_resolution_time:
            type:
              - number
              - "null"
            description: Average time (in seconds) to resolve conversations. Null if no data available.
          avg_first_response_time:
            type:
              - number
              - "null"
            description: Average time (in seconds) for the first response. Null if no data available.
          avg_reply_time:
            type:
              - number
              - "null"
            description: Average time (in seconds) between replies. Null if no data available.
      example:
        - id: 1
          conversations_count: 150
          resolved_conversations_count: 120
          avg_resolution_time: 3600
          avg_first_response_time: 300
          avg_reply_time: 600
        - id: 2
          conversations_count: 75
          resolved_conversations_count: 60
          avg_resolution_time: 1800
          avg_first_response_time: 180
          avg_reply_time: 420
    agent_summary:
      type: array
      description: Agent summary report containing conversation statistics grouped by agent.
      items:
        type: object
        properties:
          id:
            type: number
            description: The agent (user) ID
          conversations_count:
            type: number
            description: Number of conversations assigned to the agent during the date range
          resolved_conversations_count:
            type: number
            description: Number of conversations resolved by the agent during the date range
          avg_resolution_time:
            type:
              - number
              - "null"
            description: Average time (in seconds) to resolve conversations. Null if no data available.
          avg_first_response_time:
            type:
              - number
              - "null"
            description: Average time (in seconds) for the first response. Null if no data available.
          avg_reply_time:
            type:
              - number
              - "null"
            description: Average time (in seconds) between replies. Null if no data available.
      example:
        - id: 1
          conversations_count: 150
          resolved_conversations_count: 120
          avg_resolution_time: 3600
          avg_first_response_time: 300
          avg_reply_time: 600
        - id: 2
          conversations_count: 75
          resolved_conversations_count: 60
          avg_resolution_time: 1800
          avg_first_response_time: 180
          avg_reply_time: 420
    team_summary:
      type: array
      description: Team summary report containing conversation statistics grouped by team.
      items:
        type: object
        properties:
          id:
            type: number
            description: The team ID
          conversations_count:
            type: number
            description: Number of conversations assigned to the team during the date range
          resolved_conversations_count:
            type: number
            description: Number of conversations resolved by the team during the date range
          avg_resolution_time:
            type:
              - number
              - "null"
            description: Average time (in seconds) to resolve conversations. Null if no data available.
          avg_first_response_time:
            type:
              - number
              - "null"
            description: Average time (in seconds) for the first response. Null if no data available.
          avg_reply_time:
            type:
              - number
              - "null"
            description: Average time (in seconds) between replies. Null if no data available.
      example:
        - id: 1
          conversations_count: 250
          resolved_conversations_count: 200
          avg_resolution_time: 2800
          avg_first_response_time: 240
          avg_reply_time: 500
        - id: 2
          conversations_count: 180
          resolved_conversations_count: 150
          avg_resolution_time: 2400
          avg_first_response_time: 200
          avg_reply_time: 450
    contact_detail:
      type: object
      properties:
        additional_attributes:
          type: object
          description: The object containing additional attributes related to the contact
          properties:
            city:
              type: string
              description: City of the contact
            country:
              type: string
              description: Country of the contact
            country_code:
              type:
                - string
                - "null"
              description: Country code of the contact
            created_at_ip:
              type: string
              description: IP address when the contact was created
        custom_attributes:
          type: object
          description: The custom attributes of the contact
        email:
          type: string
          description: The email address of the contact
        id:
          type: integer
          description: The ID of the contact
        identifier:
          type:
            - string
            - "null"
          description: The identifier of the contact
        name:
          type: string
          description: The name of the contact
        phone_number:
          type:
            - string
            - "null"
          description: The phone number of the contact
        thumbnail:
          type: string
          description: The thumbnail of the contact
        blocked:
          type: boolean
          description: Whether the contact is blocked
        type:
          type: string
          description: The type of entity
          enum:
            - contact
    message_detailed:
      type: object
      properties:
        id:
          type: number
          description: The ID of the message
        content:
          type: string
          description: The text content of the message
        inbox_id:
          type: number
          description: The ID of the inbox
        conversation_id:
          type: number
          description: The ID of the conversation
        message_type:
          type: integer
          enum:
            - 0
            - 1
            - 2
            - 3
          description: "The type of the message (0: incoming, 1: outgoing, 2: activity, 3: template)"
        content_type:
          type: string
          enum:
            - text
            - input_text
            - input_textarea
            - input_email
            - input_select
            - cards
            - form
            - article
            - incoming_email
            - input_csat
            - integrations
            - sticker
            - voice_call
          description: The type of the message content
        status:
          type: string
          enum:
            - sent
            - delivered
            - read
            - failed
          description: The status of the message
        content_attributes:
          type: object
          description: The content attributes for each content_type
          properties:
            in_reply_to:
              type:
                - string
                - "null"
              description: ID of the message this is replying to
        echo_id:
          type:
            - string
            - "null"
          description: The echo ID of the message, used for deduplication
        created_at:
          type: integer
          description: The timestamp when message was created
        private:
          type: boolean
          description: The flag which shows whether the message is private or not
        source_id:
          type:
            - string
            - "null"
          description: The source ID of the message
        sender:
          $ref: "#/components/schemas/contact_detail"
        attachments:
          type: array
          description: The list of attachments associated with the message
          items:
            type: object
            properties:
              id:
                type: number
                description: The ID of the attachment
              message_id:
                type: number
                description: The ID of the message
              file_type:
                type: string
                enum:
                  - image
                  - video
                  - audio
                  - file
                  - location
                  - fallback
                  - share
                  - story_mention
                  - contact
                  - ig_reel
                description: The type of the attached file
              account_id:
                type: number
                description: The ID of the account
              data_url:
                type: string
                description: The URL of the attached file
              thumb_url:
                type: string
                description: The thumbnail URL of the attached file
              file_size:
                type: number
                description: The size of the attached file in bytes
    conversation_meta:
      type: object
      properties:
        labels:
          type: array
          items:
            type: string
          description: Labels associated with the conversation
        additional_attributes:
          type: object
          properties:
            browser:
              type: object
              properties:
                device_name:
                  type: string
                  description: Name of the device
                browser_name:
                  type: string
                  description: Name of the browser
                platform_name:
                  type: string
                  description: Name of the platform
                browser_version:
                  type: string
                  description: Version of the browser
                platform_version:
                  type: string
                  description: Version of the platform
            referer:
              type: string
              description: Referrer URL
            initiated_at:
              type: object
              properties:
                timestamp:
                  type: string
                  description: Timestamp when the conversation was initiated
            browser_language:
              type: string
              description: Browser language setting
            conversation_language:
              type: string
              description: Conversation language
          description: Additional attributes of the conversation
        contact:
          $ref: "#/components/schemas/contact_detail"
        assignee:
          allOf:
            - $ref: "#/components/schemas/agent"
          description: The agent assigned to the conversation
          nullable: true
        agent_last_seen_at:
          type:
            - string
            - "null"
          description: Timestamp when the agent last saw the conversation
        assignee_last_seen_at:
          type:
            - string
            - "null"
          description: Timestamp when the assignee last saw the conversation
    conversation_messages:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/conversation_meta"
        payload:
          type: array
          items:
            $ref: "#/components/schemas/message_detailed"
          description: List of messages in the conversation
    contact_meta:
      type: object
      properties:
        count:
          type: integer
          description: Total number of contacts
        current_page:
          type:
            - string
            - integer
          description: Current page number
    contact_inbox:
      type: object
      properties:
        source_id:
          type: string
          description: Source identifier for the contact inbox
        inbox:
          type: object
          properties:
            id:
              type: integer
              description: ID of the inbox
            avatar_url:
              type: string
              description: URL for the inbox avatar
            channel_id:
              type: integer
              description: ID of the channel
            name:
              type: string
              description: Name of the inbox
            channel_type:
              type: string
              description: Type of channel
            provider:
              type:
                - string
                - "null"
              description: Provider of the inbox
    contact_list_item:
      type: object
      properties:
        additional_attributes:
          type: object
          description: The object containing additional attributes related to the contact
          properties:
            city:
              type: string
              description: City of the contact
            country:
              type: string
              description: Country of the contact
            country_code:
              type:
                - string
                - "null"
              description: Country code of the contact
            created_at_ip:
              type: string
              description: IP address when the contact was created
        availability_status:
          type: string
          description: Availability status of the contact
          enum:
            - online
            - offline
        email:
          type:
            - string
            - "null"
          description: The email address of the contact
        id:
          type: integer
          description: The ID of the contact
        name:
          type: string
          description: The name of the contact
        phone_number:
          type:
            - string
            - "null"
          description: The phone number of the contact
        blocked:
          type: boolean
          description: Whether the contact is blocked
        identifier:
          type:
            - string
            - "null"
          description: The identifier of the contact
        thumbnail:
          type: string
          description: The thumbnail of the contact
        custom_attributes:
          type: object
          description: The custom attributes of the contact
        last_activity_at:
          type:
            - integer
            - "null"
          description: Timestamp of last activity
        created_at:
          type: integer
          description: Timestamp when contact was created
        contact_inboxes:
          type: array
          description: List of inboxes associated with this contact
          items:
            $ref: "#/components/schemas/contact_inbox"
    contacts_list_response:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/contact_meta"
        payload:
          type: array
          items:
            $ref: "#/components/schemas/contact_list_item"
          description: List of contacts
    contact_show_response:
      type: object
      properties:
        payload:
          $ref: "#/components/schemas/contact_list_item"
    contact_conversation_message:
      type: object
      properties:
        id:
          type: integer
          description: ID of the message
        content:
          type: string
          description: Content of the message
        account_id:
          type: integer
          description: ID of the account
        inbox_id:
          type: integer
          description: ID of the inbox
        conversation_id:
          type: integer
          description: ID of the conversation
        message_type:
          type: integer
          description: Type of the message
        created_at:
          type: integer
          description: Timestamp when message was created
        updated_at:
          type: string
          description: Formatted datetime when message was updated
        private:
          type: boolean
          description: Whether the message is private
        status:
          type: string
          description: Status of the message
        source_id:
          type:
            - string
            - "null"
          description: Source ID of the message
        content_type:
          type: string
          description: Type of the content
        content_attributes:
          type: object
          description: Attributes of the content
        sender_type:
          type:
            - string
            - "null"
          description: Type of the sender
        sender_id:
          type:
            - integer
            - "null"
          description: ID of the sender
        external_source_ids:
          type: object
          description: External source IDs
        additional_attributes:
          type: object
          description: Additional attributes of the message
        processed_message_content:
          type:
            - string
            - "null"
          description: Processed message content
        sentiment:
          type: object
          description: Sentiment analysis of the message
        conversation:
          type: object
          description: Conversation details
          properties:
            assignee_id:
              type:
                - integer
                - "null"
              description: ID of the assignee
            unread_count:
              type: integer
              description: Count of unread messages
            last_activity_at:
              type: integer
              description: Timestamp of last activity
            contact_inbox:
              type: object
              description: Contact inbox details
              properties:
                source_id:
                  type: string
                  description: Source ID of the contact inbox
        sender:
          type: object
          description: Details of the sender
          properties:
            id:
              type: integer
              description: ID of the sender
            name:
              type: string
              description: Name of the sender
            available_name:
              type: string
              description: Available name of the sender
            avatar_url:
              type: string
              description: URL of the sender's avatar
            type:
              type: string
              description: Type of the sender
            availability_status:
              type: string
              description: Availability status of the sender
            thumbnail:
              type: string
              description: Thumbnail URL of the sender
    contact_conversations_response:
      type: object
      properties:
        payload:
          type: array
          items:
            allOf:
              - $ref: "#/components/schemas/conversation"
              - type: object
                properties:
                  meta:
                    type: object
                    properties:
                      sender:
                        type: object
                        properties:
                          additional_attributes:
                            type: object
                            description: The additional attributes of the sender
                          availability_status:
                            type: string
                            description: The availability status of the sender
                          email:
                            type:
                              - string
                              - "null"
                            description: The email of the sender
                          id:
                            type: number
                            description: ID fo the sender
                          name:
                            type: string
                            description: The name of the sender
                          phone_number:
                            type:
                              - string
                              - "null"
                            description: The phone number of the sender
                          blocked:
                            type: boolean
                            description: Whether the sender is blocked
                          identifier:
                            type:
                              - string
                              - "null"
                            description: The identifier of the sender
                          thumbnail:
                            type:
                              - string
                              - "null"
                            description: Avatar URL of the contact
                          custom_attributes:
                            type: object
                            description: The custom attributes of the sender
                          last_activity_at:
                            type: number
                            description: The last activity at of the sender
                          created_at:
                            type: number
                            description: The created at of the sender
                      channel:
                        type: string
                        description: Channel Type
                      assignee:
                        $ref: "#/components/schemas/user"
                      hmac_verified:
                        type: boolean
                        description: Whether the hmac is verified
          description: List of conversations for the contact
    contactable_inboxes_response:
      type: object
      properties:
        payload:
          type: array
          items:
            $ref: "#/components/schemas/contact_inbox"
          description: List of contactable inboxes for the contact
    reporting_event:
      type: object
      properties:
        id:
          type: number
          description: ID of the reporting event
        name:
          type: string
          description: Name of the event (e.g., first_response, resolution, reply_time)
        value:
          type: number
          format: double
          description: Value of the metric in seconds
        value_in_business_hours:
          type: number
          format: double
          description: Value of the metric in seconds, calculated only for business hours
        event_start_time:
          type: string
          format: date-time
          description: The timestamp when the event started
        event_end_time:
          type: string
          format: date-time
          description: The timestamp when the event ended
        account_id:
          type: number
          description: ID of the account
        conversation_id:
          type:
            - number
            - "null"
          description: ID of the conversation
        inbox_id:
          type:
            - number
            - "null"
          description: ID of the inbox
        user_id:
          type:
            - number
            - "null"
          description: ID of the user/agent
        created_at:
          type: string
          format: date-time
          description: The timestamp when the reporting event was created
        updated_at:
          type: string
          format: date-time
          description: The timestamp when the reporting event was last updated
    reporting_event_meta:
      type: object
      properties:
        count:
          type: integer
          description: Total number of reporting events
        current_page:
          type: integer
          description: Current page number
        total_pages:
          type: integer
          description: Total number of pages
    reporting_events_list_response:
      type: object
      properties:
        meta:
          $ref: "#/components/schemas/reporting_event_meta"
        payload:
          type: array
          items:
            $ref: "#/components/schemas/reporting_event"
          description: List of reporting events
    Funnel:
      type: object
      description: Representa um funil de vendas
      properties:
        id:
          type: integer
          description: ID único do funil
          example: 1
        name:
          type: string
          description: Nome do funil
          example: Funnel de Vendas
        description:
          type: string
          description: Descrição do funil
          example: Funnel principal de vendas
        active:
          type: boolean
          description: Se o funil está ativo
          example: true
        stages:
          type: object
          description: Estágios do funil
          additionalProperties:
            type: object
          example:
            lead:
              name: Lead
              color: "#3b82f6"
              id: lead_1
            prospect:
              name: Prospecto
              color: "#f59e0b"
              id: prospect_1
            customer:
              name: Cliente
              color: "#10b981"
              id: customer_1
        settings:
          type: object
          description: Configurações do funil
          additionalProperties: true
        global_custom_attributes:
          type: array
          description: Atributos customizados globais
          items:
            type: object
            properties:
              name:
                type: string
              type:
                type: string
        account_id:
          type: integer
          description: ID da conta
          example: 1
        created_at:
          type: string
          format: date-time
          description: Data de criação
          example: 2024-01-15T10:00:00Z
        updated_at:
          type: string
          format: date-time
          description: Data de atualização
          example: 2024-01-15T10:00:00Z
      required:
        - id
        - name
        - account_id
    FunnelCreate:
      type: object
      description: Dados para criar um funil
      properties:
        funnel:
          type: object
          properties:
            name:
              type: string
              description: Nome do funil
              example: Novo Funnel
            description:
              type: string
              description: Descrição do funil
              example: Descrição do funil
            active:
              type: boolean
              description: Se o funil está ativo
              example: true
            stages:
              type: object
              description: Estágios do funil
              additionalProperties:
                type: object
              example:
                lead:
                  name: Lead
                  color: "#3b82f6"
                  id: lead_1
                prospect:
                  name: Prospecto
                  color: "#f59e0b"
                  id: prospect_1
                customer:
                  name: Cliente
                  color: "#10b981"
                  id: customer_1
            settings:
              type: object
              description: Configurações do funil
              additionalProperties: true
            global_custom_attributes:
              type: array
              description: Atributos customizados globais
              items:
                type: object
                properties:
                  name:
                    type: string
                  type:
                    type: string
          required:
            - name
      required:
        - funnel
    FunnelUpdate:
      type: object
      description: Dados para atualizar um funil
      properties:
        funnel:
          type: object
          properties:
            name:
              type: string
              description: Nome do funil
              example: Funnel Atualizado
            description:
              type: string
              description: Descrição do funil
              example: Nova descrição
            active:
              type: boolean
              description: Se o funil está ativo
              example: true
            stages:
              type: object
              description: Estágios do funil
              additionalProperties:
                type: object
            settings:
              type: object
              description: Configurações do funil
              additionalProperties: true
            global_custom_attributes:
              type: array
              description: Atributos customizados globais
              items:
                type: object
                properties:
                  name:
                    type: string
                  type:
                    type: string
          required:
            - funnel
    KanbanItem:
      type: object
      description: Representa um item do Kanban
      properties:
        id:
          type: integer
          description: ID único do item
          example: 1
        funnel_id:
          type: integer
          description: ID do funil
          example: 1
        funnel_stage:
          type: string
          description: Estágio atual do item
          example: lead
        position:
          type: integer
          description: Posição no estágio
          example: 1
        conversation_display_id:
          type: integer
          description: ID da conversa
          example: 123
        timer_started_at:
          type: string
          format: date-time
          description: Início do timer
          example: 2024-01-15T10:00:00Z
        timer_duration:
          type: integer
          description: Duração do timer em segundos
          example: 3600
        stage_entered_at:
          type: string
          format: date-time
          description: Data de entrada no estágio
          example: 2024-01-15T10:00:00Z
        checklist:
          type: array
          description: Lista de itens do checklist
          items:
            type: object
            properties:
              id:
                type: string
                description: ID único do item
              text:
                type: string
                description: Texto do item
              completed:
                type: boolean
                description: Se o item está completo
              created_at:
                type: string
                format: date-time
                description: Data de criação
              position:
                type: integer
                description: Posição do item
              agent_id:
                type: integer
                description: ID do agente responsável
        assigned_agents:
          type: array
          description: Lista de agentes atribuídos
          items:
            type: integer
        custom_attributes:
          type: object
          description: Atributos customizados
          additionalProperties: true
        item_details:
          type: object
          description: Detalhes do item
          properties:
            title:
              type: string
              description: Título do item
              example: Novo Lead
            description:
              type: string
              description: Descrição do item
              example: Descrição do lead
            status:
              type: string
              description: Status do item
              example: active
            priority:
              type: string
              description: Prioridade do item
              example: high
            value:
              type: number
              description: Valor do item
              example: 1000
            currency:
              type: object
              description: Informações da moeda
              properties:
                symbol:
                  type: string
                code:
                  type: string
                locale:
                  type: string
            custom_attributes:
              type: array
              description: Atributos customizados
              items:
                type: object
                properties:
                  name:
                    type: string
                  value:
                    type: string
                  type:
                    type: string
            offers:
              type: array
              description: Lista de ofertas
              items:
                type: object
                properties:
                  value:
                    type: number
                  currency:
                    type: object
                    properties:
                      symbol:
                        type: string
                      code:
                        type: string
                      locale:
                        type: string
                  description:
                    type: string
            deadline_at:
              type: string
              format: date-time
              description: Data limite
            scheduling_type:
              type: string
              description: Tipo de agendamento
            scheduled_at:
              type: string
              format: date-time
              description: Data agendada
            activities:
              type: array
              description: Lista de atividades
              items:
                type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                  user:
                    type: object
                    properties:
                      id:
                        type: integer
                      name:
                        type: string
                      avatar_url:
                        type: string
                  details:
                    type: object
                    properties:
                      user:
                        type: object
                        properties:
                          id:
                            type: integer
                          name:
                            type: string
                          avatar_url:
                            type: string
                      new_stage:
                        type: string
                      old_stage:
                        type: string
                  created_at:
                    type: string
                    format: date-time
            conversation_id:
              type: integer
              description: ID da conversa
            notes:
              type: array
              description: Lista de notas
              items:
                type: object
                properties:
                  id:
                    type: string
                  text:
                    type: string
                  created_at:
                    type: string
                    format: date-time
                  attachments:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        url:
                          type: string
                        filename:
                          type: string
                        byte_size:
                          type: integer
                        content_type:
                          type: string
                        created_at:
                          type: string
                          format: date-time
                  linked_item_id:
                    type: integer
                  linked_conversation_id:
                    type: integer
                  linked_contact_id:
                    type: integer
                  author:
                    type: string
                  author_id:
                    type: integer
                  author_avatar:
                    type: string
          required:
            - title
        account_id:
          type: integer
          description: ID da conta
          example: 1
        created_at:
          type: string
          format: date-time
          description: Data de criação
          example: 2024-01-15T10:00:00Z
        updated_at:
          type: string
          format: date-time
          description: Data de atualização
          example: 2024-01-15T10:00:00Z
      required:
        - id
        - funnel_id
        - funnel_stage
        - item_details
    KanbanItemCreate:
      type: object
      description: Dados para criar um item do Kanban
      properties:
        kanban_item:
          type: object
          properties:
            funnel_id:
              type: integer
              description: ID do funil
              example: 1
            funnel_stage:
              type: string
              description: Estágio inicial do item
              example: lead
            position:
              type: integer
              description: Posição no estágio
              example: 1
            conversation_display_id:
              type: integer
              description: ID da conversa
              example: 123
            timer_started_at:
              type: string
              format: date-time
              description: Início do timer
              example: 2024-01-15T10:00:00Z
            timer_duration:
              type: integer
              description: Duração do timer em segundos
              example: 3600
            checklist:
              type: array
              description: Lista de itens do checklist
              items:
                type: object
            assigned_agents:
              type: array
              description: Lista de agentes atribuídos
              items:
                type: integer
            custom_attributes:
              type: object
              description: Atributos customizados
              additionalProperties: true
            item_details:
              type: object
              description: Detalhes do item
              properties:
                title:
                  type: string
                  description: Título do item
                  example: Novo Lead
                description:
                  type: string
                  description: Descrição do item
                  example: Descrição do lead
                status:
                  type: string
                  description: Status do item
                  example: open
                priority:
                  type: string
                  description: Prioridade do item
                  example: high
                value:
                  type: number
                  description: Valor do item
                  example: 1000
                conversation_id:
                  type: integer
                  description: ID da conversa
              required:
                - title
          required:
            - funnel_id
            - funnel_stage
            - position
            - item_details
      required:
        - kanban_item
    KanbanItemUpdate:
      type: object
      description: Dados para atualizar um item do Kanban
      properties:
        kanban_item:
          type: object
          properties:
            funnel_id:
              type: integer
              description: ID do funil
              example: 1
            funnel_stage:
              type: string
              description: Novo estágio do item
              example: prospect
            position:
              type: integer
              description: Nova posição no estágio
              example: 2
            conversation_display_id:
              type: integer
              description: ID da conversa
              example: 123
            timer_started_at:
              type: string
              format: date-time
              description: Início do timer
              example: 2024-01-15T10:00:00Z
            timer_duration:
              type: integer
              description: Duração do timer em segundos
              example: 3600
            checklist:
              type: array
              description: Lista de itens do checklist
              items:
                type: object
            assigned_agents:
              type: array
              description: Lista de agentes atribuídos
              items:
                type: integer
            custom_attributes:
              type: object
              description: Atributos customizados
              additionalProperties: true
            item_details:
              type: object
              description: Detalhes do item
              properties:
                title:
                  type: string
                  description: Título do item
                  example: Lead Atualizado
                description:
                  type: string
                  description: Descrição do item
                  example: Nova descrição
                status:
                  type: string
                  description: Status do item
                  example: active
                priority:
                  type: string
                  description: Prioridade do item
                  example: medium
                value:
                  type: number
                  description: Valor do item
                  example: 1500
          required:
            - kanban_item
      required:
        - kanban_item
    KanbanItemsResponse:
      type: object
      description: Resposta paginada de kanban items
      properties:
        items:
          type: array
          description: Lista de itens do Kanban
          items:
            $ref: "#/components/schemas/KanbanItem"
        pagination:
          type: object
          description: Informações de paginação
          properties:
            current_page:
              type: integer
              description: Página atual
              example: 1
            total_count:
              type: integer
              description: Total de itens
              example: 50
            has_more:
              type: boolean
              description: Se há mais páginas
              example: true
            items_per_page:
              type: integer
              description: Itens por página
              example: 50
          required:
            - current_page
            - total_count
            - has_more
            - items_per_page
      required:
        - items
        - pagination
    AssignedAgentsResponse:
      type: object
      description: Resposta com agentes atribuídos
      properties:
        assigned_agents:
          type: array
          description: Lista de agentes atribuídos
          items:
            type: object
            properties:
              id:
                type: integer
                description: ID do agente
              name:
                type: string
                description: Nome do agente
              email:
                type: string
                description: Email do agente
              avatar_url:
                type: string
                description: URL do avatar
              availability_status:
                type: string
                description: Status de disponibilidade
        primary_agent:
          type: object
          description: Agente principal
          properties:
            id:
              type: integer
              description: ID do agente
            name:
              type: string
              description: Nome do agente
            email:
              type: string
              description: Email do agente
            avatar_url:
              type: string
              description: URL do avatar
            availability_status:
              type: string
              description: Status de disponibilidade
      required:
        - assigned_agents
    Error:
      type: object
      description: Representa um erro da API
      properties:
        error:
          type: string
          description: Mensagem de erro
          example: Erro ao processar requisição
        status:
          type: string
          description: Status do erro
          example: bad_request
        details:
          type: object
          description: Detalhes adicionais do erro
          additionalProperties: true
      required:
        - error
    ReorderRequest:
      type: object
      description: Dados para reordenar itens do Kanban
      properties:
        positions:
          type: array
          description: Lista de posições dos itens
          items:
            type: object
            properties:
              id:
                type: integer
                description: ID do item
                example: 1
              position:
                type: integer
                description: Nova posição do item
                example: 1
              funnel_stage:
                type: string
                description: Etapa do funil
                example: lead
            required:
              - id
              - position
              - funnel_stage
          example:
            - id: 1
              position: 1
              funnel_stage: lead
            - id: 2
              position: 2
              funnel_stage: lead
      required:
        - positions
    StageStats:
      type: object
      description: Estatísticas por etapa do funil
      properties:
        stages:
          type: object
          description: Estatísticas por etapa
          additionalProperties:
            type: object
            properties:
              count:
                type: integer
                description: Número de itens na etapa
                example: 5
              total_value:
                type: number
                description: Valor total dos itens na etapa
                example: 5000
          example:
            lead:
              count: 5
              total_value: 5000
            prospect:
              count: 3
              total_value: 3000
            customer:
              count: 2
              total_value: 2000
    DebugInfo:
      type: object
      description: Informações de debug
      properties:
        environment:
          type: string
          description: Ambiente da aplicação
          example: development
        ruby_version:
          type: string
          description: Versão do Ruby
          example: 3.2.0
        rails_version:
          type: string
          description: Versão do Rails
          example: 7.1.0
        kanban_items_count:
          type: integer
          description: Número total de itens do Kanban
          example: 10
        first_item_sample:
          type: object
          description: Amostra do primeiro item
          additionalProperties: true
        has_conversation_data:
          type: boolean
          description: Se há dados de conversa
          example: true
    FunnelLimitError:
      type: object
      description: Erro de limite de funnels
      properties:
        error:
          type: string
          description: Mensagem de erro
          example: Limite de funnels atingido. Atualize para a versão PRO para criar mais funnels.
        code:
          type: string
          description: Código do erro
          example: FUNNEL_LIMIT_REACHED
      required:
        - error
        - code
    ScheduledMessage:
      type: object
      description: Representa uma mensagem agendada
      properties:
        id:
          type: integer
          description: ID único da mensagem agendada
          example: 1
        message:
          type: string
          description: Conteúdo da mensagem
          example: "Lembrete: reunião às 14h"
        scheduled_at:
          type: string
          format: date-time
          description: Data e hora agendada para envio
          example: 2024-01-16T14:00:00Z
        status:
          type: string
          description: Status da mensagem agendada
          enum:
            - pending
            - sent
            - cancelled
            - failed
          example: pending
        message_type:
          type: string
          description: Tipo da mensagem
          enum:
            - text
            - template
            - interactive
          example: text
        sender_id:
          type: integer
          description: ID do remetente
          example: 1
        sender_name:
          type: string
          description: Nome do remetente
          example: João Silva
        conversation_id:
          type: integer
          description: ID da conversa
          example: 1897
        account_id:
          type: integer
          description: ID da conta
          example: 1
        sent_at:
          type: string
          format: date-time
          description: Data e hora em que a mensagem foi enviada (apenas para status 'sent')
          example: 2024-01-16T14:00:00Z
        cancelled_at:
          type: string
          format: date-time
          description: Data e hora em que a mensagem foi cancelada (apenas para status 'cancelled')
          example: 2024-01-16T13:30:00Z
        error_message:
          type: string
          description: Mensagem de erro (apenas para status 'failed')
          example: Falha na conexão com WhatsApp
        template_params:
          type: object
          description: Parâmetros do template (apenas para message_type 'template')
          additionalProperties: true
          example:
            name: João
            date: 16/01/2024
        created_at:
          type: string
          format: date-time
          description: Data de criação
          example: 2024-01-15T10:00:00Z
        updated_at:
          type: string
          format: date-time
          description: Data de atualização
          example: 2024-01-15T10:00:00Z
      required:
        - id
        - message
        - scheduled_at
        - status
        - message_type
        - sender_id
        - conversation_id
        - account_id
    ScheduledMessagesResponse:
      type: object
      description: Resposta de mensagens agendadas
      properties:
        payload:
          type: array
          description: Lista de mensagens agendadas
          items:
            $ref: "#/components/schemas/ScheduledMessageCreatedResponse"
      required:
        - payload
    ScheduledMessageCreate:
      type: object
      description: Dados para criar uma mensagem agendada
      properties:
        scheduled_message:
          type: object
          properties:
            conversation_id:
              type: integer
              description: ID da conversa
              example: 1897
            inbox_id:
              type: integer
              description: ID da inbox
              example: 7
            content:
              type: string
              description: Conteúdo da mensagem
              example: "Lembrete: reunião às 14h"
            scheduled_at:
              type: string
              format: date-time
              description: Data e hora agendada para envio (ISO 8601)
              example: 2025-08-27T13:50:00.000Z
            title:
              type: string
              description: Título da mensagem agendada
              example: Reunião
            status:
              type: string
              description: Status inicial da mensagem
              enum:
                - pending
                - sent
                - cancelled
                - failed
              default: pending
              example: pending
            is_recurrent:
              type: boolean
              description: Se a mensagem é recorrente
              default: false
              example: false
            period:
              type: string
              description: Período de recorrência (se is_recurrent for true)
              enum:
                - ""
                - daily
                - weekly
                - monthly
                - yearly
              default: ""
              example: ""
          required:
            - conversation_id
            - inbox_id
            - content
            - scheduled_at
            - title
      required:
        - scheduled_message
    ScheduledMessageCreatedResponse:
      type: object
      description: Resposta da criação de uma mensagem agendada
      properties:
        id:
          type: integer
          description: ID único da mensagem agendada criada
          example: 3
        message:
          type: string
          description: Conteúdo da mensagem
          example: "Lembrete: reunião às 14h"
        scheduled_at:
          type: integer
          description: Timestamp Unix da data agendada
          example: 1756302600
        title:
          type: string
          description: Título da mensagem agendada
          example: Reunião
        inbox_id:
          type: integer
          description: ID da inbox
          example: 7
        conversation_id:
          type: integer
          description: ID da conversa
          example: 1897
        created_at:
          type: integer
          description: Timestamp Unix da data de criação
          example: 1756302539
        status:
          type: string
          description: Status da mensagem agendada
          enum:
            - pending
            - sent
            - cancelled
            - failed
          example: pending
        is_recurrent:
          type: boolean
          description: Se a mensagem é recorrente
          example: false
        period:
          type: string
          description: Período de recorrência
          example: ""
      required:
        - id
        - message
        - scheduled_at
        - title
        - inbox_id
        - conversation_id
        - created_at
        - status
        - is_recurrent
        - period
    ScheduledMessageUpdate:
      type: object
      description: Dados para atualizar uma mensagem agendada
      properties:
        scheduled_message:
          type: object
          properties:
            content:
              type: string
              description: Novo conteúdo da mensagem
              example: Conteúdo atualizado da mensagem
            scheduled_at:
              type: string
              format: date-time
              description: Nova data e hora agendada para envio (ISO 8601)
              example: 2025-08-28T14:00:00.000Z
            title:
              type: string
              description: Novo título da mensagem agendada
              example: Título Atualizado
            status:
              type: string
              description: Novo status da mensagem
              enum:
                - pending
                - sent
                - cancelled
                - failed
              example: pending
            is_recurrent:
              type: boolean
              description: Se a mensagem é recorrente
              example: false
            period:
              type: string
              description: Período de recorrência (se is_recurrent for true)
              enum:
                - ""
                - daily
                - weekly
                - monthly
                - yearly
              example: ""
      required:
        - scheduled_message
    Task:
      type: object
      properties:
        id:
          type: integer
          description: ID único da tarefa
        title:
          type: string
          description: Título curto da tarefa
        description:
          type: string
          description: Descrição opcional, suporta markdown leve
        status:
          type: string
          enum:
            - open
            - in_progress
            - completed
            - cancelled
          description: Status atual da tarefa
        priority:
          type: string
          enum:
            - low
            - medium
            - high
            - urgent
          description: Prioridade da tarefa
        due_at:
          type: string
          format: date-time
          nullable: true
          description: Data/hora de vencimento (ISO 8601)
        assignee_id:
          type: integer
          nullable: true
          description: ID do agente responsável
        contact_id:
          type: integer
          nullable: true
          description: ID do contato vinculado
        conversation_id:
          type: integer
          nullable: true
          description: ID da conversa vinculada
        created_by:
          type: integer
          description: ID do agente que criou a tarefa
        cancellation_reason:
          type: string
          nullable: true
          description: Motivo do cancelamento (status=cancelled)
        completed_at:
          type: string
          format: date-time
          nullable: true
          description: Timestamp de conclusão
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    TaskCreate:
      type: object
      required:
        - task
      properties:
        task:
          type: object
          required:
            - title
          properties:
            title:
              type: string
              description: Título curto da tarefa (obrigatório)
            description:
              type: string
            priority:
              type: string
              enum:
                - low
                - medium
                - high
                - urgent
              default: medium
            due_at:
              type: string
              format: date-time
            assignee_id:
              type: integer
              description: ID do agente responsável (default = criador)
            contact_id:
              type: integer
            conversation_id:
              type: integer
    TaskUpdate:
      type: object
      required:
        - task
      properties:
        task:
          type: object
          properties:
            title:
              type: string
            description:
              type: string
            status:
              type: string
              enum:
                - open
                - in_progress
                - completed
                - cancelled
            priority:
              type: string
              enum:
                - low
                - medium
                - high
                - urgent
            due_at:
              type: string
              format: date-time
              nullable: true
            assignee_id:
              type: integer
              nullable: true
            cancellation_reason:
              type: string
              description: Obrigatório quando status=cancelled
    TasksListResponse:
      type: object
      properties:
        payload:
          type: array
          items:
            $ref: "#/components/schemas/Task"
        meta:
          type: object
          properties:
            count:
              type: integer
            current_page:
              type: integer
  parameters:
    account_id:
      in: path
      name: account_id
      schema:
        type: integer
      required: true
      description: The numeric ID of the account
    agent_bot_id:
      in: path
      name: id
      schema:
        type: integer
      required: true
      description: The ID of the agentbot to be updated
    team_id:
      in: path
      name: team_id
      schema:
        type: integer
      required: true
      description: The ID of the team to be updated
    inbox_id:
      in: path
      name: inbox_id
      schema:
        type: integer
      required: true
      description: The ID of the Inbox
    hook_id:
      in: path
      name: hook_id
      schema:
        type: integer
      required: true
      description: The numeric ID of the integration hook
    source_id:
      in: path
      name: source_id
      required: true
      schema:
        type: string
      description: |-
        Id of the session for which the conversation is created.



         Source Ids can be obtained through contactable inboxes API or via generated.<br/><br/>Website: SiteUp generated string which can be obtained from webhook events. <br/> Phone Channels(Twilio): Phone number in e164 format <br/> Email Channels: Contact Email address <br/> API Channel: Any Random String
    contact_sort_param:
      in: query
      name: sort
      schema:
        type: string
        enum:
          - name
          - email
          - phone_number
          - last_activity_at
          - -name
          - -email
          - -phone_number
          - -last_activity_at
      required: false
      description: The attribute by which list should be sorted
    conversation_id:
      in: path
      name: conversation_id
      schema:
        type: integer
      required: true
      description: The numeric ID of the conversation
    conversation_uuid:
      in: path
      name: conversation_uuid
      schema:
        type: integer
      required: true
      description: The uuid of the conversation
    custom_filter_id:
      in: path
      name: custom_filter_id
      schema:
        type: integer
      required: true
      description: The numeric ID of the custom filter
    webhook_id:
      in: path
      name: webhook_id
      schema:
        type: integer
      required: true
      description: The numeric ID of the webhook
    message_id:
      in: path
      name: message_id
      schema:
        type: integer
      required: true
      description: The numeric ID of the message
    page:
      in: query
      name: page
      schema:
        type: integer
        default: 1
      required: false
      description: The page parameter
    platform_user_id:
      in: path
      name: id
      schema:
        type: integer
      required: true
      description: The numeric ID of the user on the platform
    report_type:
      in: query
      name: type
      schema:
        type: string
        enum:
          - account
          - agent
          - inbox
          - label
          - team
      required: true
      description: Type of report
    report_metric:
      in: query
      name: metric
      schema:
        type: string
        enum:
          - conversations_count
          - incoming_messages_count
          - outgoing_messages_count
          - avg_first_response_time
          - avg_resolution_time
          - resolutions_count
      required: true
      description: The type of metric
    public_inbox_identifier:
      in: path
      name: inbox_identifier
      schema:
        type: string
      required: true
      description: The identifier obtained from API inbox channel
    public_contact_identifier:
      in: path
      name: contact_identifier
      schema:
        type: string
      required: true
      description: The source id of contact obtained on contact create
    portal_id:
      in: path
      name: id
      schema:
        type: string
      required: true
      description: The slug identifier of the portal
    whatsapp_groups_account_id:
      name: account_id
      in: path
      required: true
      schema:
        type: integer
    whatsapp_groups_id:
      name: id
      in: path
      required: true
      schema:
        type: integer
    whatsapp_groups_group_id:
      name: whatsapp_group_id
      in: path
      required: true
      schema:
        type: integer
  responses:
    BadRequest:
      description: Requisição inválida
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    Unauthorized:
      description: Não autorizado
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    Forbidden:
      description: Acesso negado
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    NotFound:
      description: Recurso não encontrado
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
    UnprocessableEntity:
      description: Entidade não processável
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/Error"
  securitySchemes:
    userApiKey:
      type: apiKey
      in: header
      name: api_access_token
      description: This token can be obtained by visiting the profile page or via rails console. Provides access to  endpoints based on the user permissions levels. This token can be saved by an external system when user is created via API, to perform activities on behalf of the user.
    agentBotApiKey:
      type: apiKey
      in: header
      name: api_access_token
      description: This token should be provided by system admin or obtained via rails console. This token can be used to build bot integrations and can only access limited apis.
    platformAppApiKey:
      type: apiKey
      in: header
      name: api_access_token
      description: This token can be obtained by the system admin after creating a platformApp. This token should be used to provision agent bots, accounts, users and their roles.
    apiAccessToken:
      type: apiKey
      in: header
      name: api_access_token
      description: Token de acesso da API
tags:
  - name: Contas
    description: Account management APIs
  - name: Usuários da Conta
    description: Account user management APIs
  - name: Bots
    description: Bot integrations
  - name: Usuários
    description: User management APIs
  - name: Bots da Conta
    description: Account-specific Agent Bots
  - name: Agentes
    description: Agent management APIs
  - name: Respostas Prontas
    description: Pre-defined responses for common queries
  - name: Contatos
    description: Contact management APIs
  - name: Etiquetas de Contato
    description: Manage contact labels
  - name: Atribuição de Conversas
    description: Manage conversation assignments
  - name: Conversas
    description: Conversation management APIs
  - name: Atributos Personalizados
    description: Custom fields for contacts and conversations
  - name: Filtros Personalizados
    description: Saved filters for conversations
  - name: Caixas de Entrada
    description: Communication channels setup
  - name: Integrações
    description: Third-party integrations
  - name: Etiquetas
    description: Account label management APIs
  - name: Mensagens
    description: Message management APIs
  - name: Perfil
    description: User profile APIs
  - name: Relatórios
    description: Analytics and reporting APIs
  - name: Times
    description: Team management APIs
  - name: Webhooks
    description: "Dois tipos na mesma lista. Webhooks da conta (/webhooks): o SiteUp avisa a sua URL quando algo acontece na conta (conversas, mensagens, contatos). Webhooks de grupos (/whatsapp_group_webhooks): URLs de entrada que recebem compras da Hotmart, Eduzz, Shopify e outras plataformas e colocam o comprador num grupo de WhatsApp; register_webhook liga o webhook do WAHA a um grupo."
  - name: Regras de Automação
    description: Workflow automation rules
  - name: Central de Ajuda
    description: Knowledge base management
  - name: API Pública - Contatos
    description: Public contact APIs
  - name: API Pública - Conversas
    description: Public conversation APIs
  - name: API Pública - Mensagens
    description: Public message APIs
  - name: Pesquisa CSAT
    description: Customer satisfaction survey
  - name: Funis
    description: Operações relacionadas aos funis de vendas
  - name: Ofertas
    description: Operações relacionadas às ofertas
  - name: Itens Kanban
    description: Operações relacionadas aos itens do Kanban
  - name: Checklist
    description: Operações relacionadas ao checklist
  - name: Notas
    description: Operações relacionadas às notas
  - name: Tarefas
    description: Lembretes acionaveis vinculados a contatos e conversas.
  - name: Mensagens Agendadas
    description: Operações relacionadas às mensagens agendadas
  - name: Anexos
    description: Upload de arquivos para gerar uma URL hospedada (usada como media_url em disparos, tarefas, notas do Kanban etc.)
  - name: Lead Capture
    description: Captura de leads via formularios. Publicos + admin.
  - name: Captain (Agente IA)
    description: "Agente IA: preferencias, knowledge base, tarefas."
  - name: Disparo de Mensagens
    description: Broadcasts em massa.
  - name: VOIP
    description: Chamadas via WhatsApp Business.
  - name: VOIP - Analytics
    description: Metricas de chamadas.
  - name: Call Records
    description: Historico de chamadas.
  - name: Lead Scoring
    description: Pontuacao de leads.
  - name: Groups
  - name: Members
  - name: Campaigns
  - name: Broadcasts
  - name: Sequences
  - name: Activities
  - name: WAHA
  - name: Inbox API
  - name: Account
  - name: Audit Logs
  - name: Conversation
  - name: Agentes (Kanban)
x-tagGroups:
  - name: Plataforma
    tags:
      - Contas
      - Usuários da Conta
      - Bots
      - Usuários
  - name: Aplicação
    tags:
      - Account
      - Audit Logs
      - Tarefas
      - Anexos
      - Bots da Conta
      - Agentes
      - Respostas Prontas
      - Contatos
      - Etiquetas de Contato
      - Atribuição de Conversas
      - Conversas
      - Atributos Personalizados
      - Filtros Personalizados
      - Caixas de Entrada
      - Integrações
      - Etiquetas
      - Mensagens
      - Perfil
      - Relatórios
      - Times
      - Webhooks
      - Regras de Automação
      - Central de Ajuda
  - name: APIs Públicas
    tags:
      - Inbox API
      - API Pública - Contatos
      - API Pública - Conversas
      - API Pública - Mensagens
  - name: Outros
    tags:
      - Pesquisa CSAT
  - name: SiteUp Custom
    tags:
      - Lead Capture
      - Captain (Agente IA)
      - Disparo de Mensagens
      - VOIP
      - VOIP - Analytics
      - Call Records
      - Lead Scoring
  - name: Kanban
    tags:
      - Funis
      - Ofertas
      - Itens Kanban
      - Agentes (Kanban)
      - Checklist
      - Notas
      - Mensagens Agendadas
  - name: WhatsApp Groups
    tags:
      - Groups
      - Members
      - Campaigns
      - Broadcasts
      - Sequences
      - Activities
      - WAHA
