> ## Documentation Index
> Fetch the complete documentation index at: https://developers.nuvia.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Send bulk template

> 
Sends an approved WhatsApp template to multiple contacts in a single
request (`multipart/form-data`).

Contacts come via the `contacts` field (JSON) **or** through a CSV/XLSX file in the
`file` field, with the columns `name` and `phone` — one of the two is required.
The template parameters go in `components` and must match the approved
template in number and type.

Processing is synchronous and partial: the response returns `totalProcessed`,
`sentCount`, `errorCount`, the contacts sent, and the list of `errors` per
row. A contact with an error does not stop the others.

Since these are templates, sends are valid outside the 24-hour window, but remain
subject to the WhatsApp account tier's daily limit.




## OpenAPI

````yaml /en/openapi.json post /v1/messages/send-bulk-template
openapi: 3.0.0
info:
  title: Nuvia API - Company
  description: API documentation for companies
  version: '1.0'
  contact: {}
servers:
  - url: https://api.nuvia.ai
security: []
tags:
  - name: messages
    x-group: Mensagens
  - name: contacts
    x-group: Contatos
  - name: campaigns
    x-group: Campanhas
  - name: tables
    x-group: Tabelas e Listas
  - name: agents
    x-group: Agentes
  - name: conversations
    x-group: Conversas
  - name: inboxes
    x-group: Caixas de Entrada
  - name: knowledge
    x-group: Base de Conhecimento
  - name: Webhooks
    x-group: Webhooks
  - name: campaign-enrollments
    x-group: Inscrições em Campanha
  - name: custom-fields
    x-group: Campos Customizados
paths:
  /v1/messages/send-bulk-template:
    post:
      tags:
        - messages
      summary: Send bulk template
      description: >

        Sends an approved WhatsApp template to multiple contacts in a single

        request (`multipart/form-data`).


        Contacts come via the `contacts` field (JSON) **or** through a CSV/XLSX
        file in the

        `file` field, with the columns `name` and `phone` — one of the two is
        required.

        The template parameters go in `components` and must match the approved

        template in number and type.


        Processing is synchronous and partial: the response returns
        `totalProcessed`,

        `sentCount`, `errorCount`, the contacts sent, and the list of `errors`
        per

        row. A contact with an error does not stop the others.


        Since these are templates, sends are valid outside the 24-hour window,
        but remain

        subject to the WhatsApp account tier's daily limit.
      operationId: MessageController_sendBulkTemplate
      parameters:
        - name: x-company-id
          in: header
          description: >-
            Target company identifier. Required only for global API keys
            (type=global). Ignored for company API keys and human users.
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/SendBulkTemplateMessageDto'
      responses:
        '201':
          description: Bulk send executed successfully (returns detailed statistics)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkTemplateResponseDto'
        '400':
          description: Invalid data
        '401':
          description: Invalid or expired token
        '403':
          description: You do not have permission to access this resource
      security:
        - JWT-auth: []
components:
  schemas:
    SendBulkTemplateMessageDto:
      type: object
      properties:
        inboxId:
          type: string
          minLength: 1
          description: ID of the inbox/WhatsApp connection to use for sending
        templateName:
          type: string
          minLength: 1
          description: Name of the template registered on WhatsApp Business
        languageCode:
          type: string
          default: pt_BR
          description: 'Template language code (format: pt_BR, en_US, en, etc.)'
        components:
          type: array
          description: >-
            List of the template's components with their parameters/variables.
            Use it to customize header, body, and buttons with dynamic data.
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - header
                  - body
                  - button
                description: Tipo do componente (header, body, button)
              sub_type:
                description: Subtipo do componente (usado principalmente para botões)
                type: string
                enum:
                  - quick_reply
                  - url
                  - phone_number
              index:
                description: >-
                  Índice do componente (usado para identificar botões
                  específicos)
                anyOf:
                  - type: string
                  - type: number
              parameters:
                description: Lista de parâmetros/variáveis deste componente
                type: array
                items:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - text
                        - image
                        - document
                        - video
                        - currency
                        - date_time
                        - payload
                      description: Tipo do parâmetro
                    image:
                      description: Configurações de imagem (quando type = "image")
                      type: object
                      properties:
                        link:
                          description: URL da imagem
                          type: string
                        id:
                          description: ID da imagem já carregada
                          type: string
                    document:
                      description: Configurações de documento (quando type = "document")
                      type: object
                      properties:
                        link:
                          description: URL do documento
                          type: string
                        filename:
                          description: Nome do arquivo do documento
                          type: string
                    video:
                      description: Configurações de vídeo (quando type = "video")
                      type: object
                      properties:
                        link:
                          description: URL do vídeo
                          type: string
                    text:
                      description: Texto do parâmetro
                      type: string
                    value:
                      description: Valor genérico do parâmetro (alias para text)
                      type: string
                    link:
                      description: Link genérico
                      type: string
                    imageUrl:
                      description: URL alternativa para imagem
                      type: string
                    imageId:
                      description: ID da imagem (quando já carregada)
                      type: string
                    documentUrl:
                      description: URL alternativa para documento
                      type: string
                    documentFilename:
                      description: Nome alternativo do arquivo
                      type: string
                    videoUrl:
                      description: URL alternativa para vídeo
                      type: string
                    currencyCode:
                      description: 'Código da moeda (ex: BRL, USD, EUR)'
                      type: string
                    currencyAmount:
                      description: Valor monetário
                      type: number
                    dateTime:
                      description: Data/hora no formato ISO 8601
                      type: string
                    payload:
                      description: Dados customizados em formato string
                      type: string
                    parameter_name:
                      description: Nome do parâmetro (para templates nomeados)
                      type: string
                    variable_ref:
                      description: >-
                        Referência a variável automática (ex: V_contact_name).
                        Se presente, o valor será resolvido automaticamente do
                        contact/business/conversation.
                      type: string
                    variable_type:
                      description: >-
                        Tipo da variável: "auto" = resolvida automaticamente,
                        "free" = input manual
                      type: string
                      enum:
                        - auto
                        - free
                  required:
                    - type
            required:
              - type
        contacts:
          type: array
          description: >-
            List of contacts that will receive the template. Optional if you
            send a CSV/Excel file with the contacts.
          items:
            type: object
            properties:
              name:
                type: string
                minLength: 1
                description: Nome completo do contato
              phone:
                type: string
                minLength: 8
                description: 'Número de telefone com código de país (ex: 5511999999999)'
            required:
              - name
              - phone
        who_will_answer:
          type: string
          default: AGENT
          description: >-
            Defines who will answer after the template is sent. Values: AGENT
            (AI agent), HUMAN (human attendant). Default: AGENT
          enum:
            - AGENT
            - HUMAN
            - UNASSIGNED
        agentToActivate:
          type: string
          description: >-
            ID of the AI agent that will be activated to answer. Used together
            with who_will_answer=AGENT
        keep_existing_assignment:
          type: boolean
          default: false
          description: >-
            If true, preserves the conversation's current assignment: nothing is
            written to owner/agent and who_will_answer is NOT applied (the AI
            does not take over). Default false so as not to change the behavior
            of existing integrations via API key — the support front end sends
            true.
        owner_user_id:
          description: >-
            ID of the user who owns the conversation. `null` is the explicit
            choice of "Unassigned" (authorizes clearing the current owner);
            absent means the caller did not weigh in on the assignment.
          type: string
          nullable: true
        attendant_user_id:
          description: >-
            ID of the attendant user. Applies when who_will_answer=HUMAN. `null`
            is an explicit "Unassigned"; absent means the caller did not weigh
            in. The owner takes precedence: conversation.user = owner ??
            attendant.
          type: string
          nullable: true
      required:
        - inboxId
        - templateName
    BulkTemplateResponseDto:
      type: object
      properties:
        totalProcessed:
          type: number
          description: Total contacts processed
        sentCount:
          type: number
          description: Number of messages sent successfully
        errorCount:
          type: number
          description: Number of errors during the send
        errors:
          type: array
          items:
            type: object
            properties:
              row:
                type: number
                description: Linha do erro no arquivo/lista
              contact:
                type: string
                description: Contato que falhou
              error:
                type: string
                description: Descrição do erro
            required:
              - row
              - contact
              - error
          description: Detailed list of errors that occurred
        sentContacts:
          type: array
          items:
            type: object
            properties:
              conversationId:
                type: string
                description: ID da conversa criada/utilizada
              phoneNumber:
                type: string
                description: Número de telefone do contato
            required:
              - conversationId
              - phoneNumber
          description: List of contacts that received the message successfully
      required:
        - totalProcessed
        - sentCount
        - errorCount
        - errors
        - sentContacts
  securitySchemes:
    JWT-auth:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Token JWT de autenticação

````