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

# Criar uma campanha

> Criar uma campanha



## OpenAPI

````yaml pt-BR/openapi.json POST /v1/broadcasts
openapi: 3.1.0
info:
  title: Watahub API
  version: 0.2.0
  description: >-
    API para clientes do Watahub, gateway multiempresa da WhatsApp Cloud API.
    Autentique cada requisição com `Authorization: Bearer <key>` ou `X-API-Key:
    <key>`. Os contratos próprios são fechados; os registros da Meta preservam
    campos adicionais. O proxy `/vN.N` preserva o corpo e o status da Meta;
    aceita a versão da rota, mas a ignora.
servers:
  - url: https://cloud.watahub.dev
security:
  - bearerApiKey: []
  - headerApiKey: []
tags:
  - name: Messages
  - name: Media
  - name: Templates
  - name: Graph-compatible proxy
    description: >-
      Compatibilidade com o Graph da Meta em três rotas. Retorna a resposta da
      Meta sem alterações.
  - name: Phones
    description: Telefones
  - name: Conversations
    description: Conversas
  - name: Connect
    description: Conexão
  - name: Customers
    description: Clientes
  - name: Webhooks
    description: Webhooks
  - name: Logs
    description: Registros
  - name: Health
    description: Status do serviço
  - name: Message templates
    description: >-
      Modelos por WABA em cache no gateway, sincronizados da Meta e necessários
      para campanhas.
  - name: Broadcasts
    description: >-
      Envia um modelo aprovado para até 500 destinatários; processado em fila e
      em segundo plano.
paths:
  /v1/broadcasts:
    post:
      tags:
        - Broadcasts
      summary: Criar uma campanha
      description: >-
        Cria um `draft` com um destinatário `pending` por número único. Nada é
        enviado até chamar send.
      operationId: createBroadcast
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BroadcastCreate'
      responses:
        '201':
          description: Rascunho criado.
          content:
            application/json:
              schema:
                type: object
                required:
                  - broadcast
                properties:
                  broadcast:
                    $ref: '#/components/schemas/Broadcast'
        '400':
          description: >-
            Dados inválidos, telefone inativo ou modelo fora do cache (`Template
            not found; sync first`) ou sem status `APPROVED`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  schemas:
    BroadcastCreate:
      type: object
      required:
        - name
        - phoneNumberId
        - templateName
        - templateLanguage
        - recipients
      properties:
        name:
          type: string
        phoneNumberId:
          type: string
          pattern: ^\d+$
          description: Telefone ativo da conta.
        templateName:
          type: string
          minLength: 1
          maxLength: 512
          description: Deve estar em cache e `APPROVED`; sincronize antes.
        templateLanguage:
          type: string
          minLength: 2
          maxLength: 16
        templateComponents:
          type: array
          maxItems: 10
          items:
            type: object
            additionalProperties: true
          description: Parâmetros enviados a todos os destinatários.
        recipients:
          type: array
          minItems: 1
          maxItems: 500
          items:
            type: string
            pattern: ^\d{6,20}$
          description: Números sem `+`; o `+` inicial e os duplicados são removidos.
      additionalProperties: false
    Broadcast:
      type: object
      required:
        - id
        - phoneNumberId
        - wabaId
        - name
        - templateName
        - templateLanguage
        - templateComponents
        - status
        - createdAt
        - updatedAt
        - startedAt
        - completedAt
        - counts
      properties:
        id:
          type: string
          format: uuid
        phoneNumberId:
          type: string
        wabaId:
          type: string
        name:
          type: string
        templateName:
          type: string
        templateLanguage:
          type: string
        templateComponents:
          type:
            - array
            - 'null'
          items:
            type: object
            additionalProperties: true
        status:
          type: string
          enum:
            - draft
            - queued
            - sending
            - completed
            - cancelled
            - failed
        createdAt:
          type: integer
          description: Tempo Unix em milissegundos.
        updatedAt:
          type: integer
          description: Tempo Unix em milissegundos.
        startedAt:
          type:
            - integer
            - 'null'
          description: Tempo Unix em milissegundos.
        completedAt:
          type:
            - integer
            - 'null'
          description: Tempo Unix em milissegundos.
        counts:
          type: object
          description: Destinatários por status; status sem destinatários são omitidos.
          propertyNames:
            enum:
              - pending
              - sent
              - failed
              - skipped
          additionalProperties:
            type: integer
      additionalProperties: false
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
  responses:
    Unauthorized:
      description: Chave de API ausente ou inválida.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    PaymentRequired:
      description: A conta exige pagamento.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Recurso inexistente ou de outra conta.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: >-
        Muitas requisições (limite da conta, 10 chaves inválidas/min por IP ou
        20 links de conexão/hora).
      headers:
        Retry-After:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: >-
        Gateway pausado, em manutenção ou sem configuração do aplicativo da
        Meta.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerApiKey:
      type: http
      scheme: bearer
      description: Chave de API da conta.
    headerApiKey:
      type: apiKey
      in: header
      name: X-API-Key
      description: Chave de API da conta.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.