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

# Criar template de mensagem na WABA

> Envia um novo template de mensagem para revisão da Meta. `name` deve estar em snake_case minúsculo; `category` é MARKETING, UTILITY ou AUTHENTICATION; `language` é um código de idioma da Meta (ex.: pt_BR). Os marcadores do corpo usam {{1}}, {{2}}… e `bodyExample` fornece um valor de exemplo para cada marcador.

Cabeçalhos: defina `headerFormat` como TEXT (com `headerText`) ou IMAGE/VIDEO/DOCUMENT (com `headerMediaUrl` ou `headerMediaBase64` — o exemplo é enviado à Meta automaticamente). Botões: use `buttons[]` com QUICK_REPLY (`text`), URL (`text`, `url` — inclua `urlExample` quando a url tiver {{1}}), PHONE_NUMBER (`text`, `phoneNumber`) ou COPY_CODE (`example`). `data` traz o id do template criado e o status inicial (normalmente PENDING).



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/connections/cloud-api/{id}/templates
openapi: 3.1.0
info:
  title: D-API - Infraestrutura WhatsApp Completa
  description: >-
    Solução escalável e robusta para gestores de automação, SaaS e usuários
    finais que precisam de uma integração WhatsApp confiável. Oferece múltiplas
    instâncias simultâneas, webhooks em tempo real, dashboard intuitivo e API
    REST documentada com 99.9% de uptime e latência inferior a 30ms.
  version: 1.2.1
  contact:
    name: Suporte D-API
    email: suporte@d-api.cloud
    url: https://d-api.cloud
servers:
  - url: https://api.d-api.cloud
    description: Produção
security:
  - ApiKeyAuth: []
tags:
  - name: Início
    description: Endpoints base
  - name: Sessões
    description: Endpoints para gerenciamento de sessões
  - name: Mensagens
    description: Endpoints para envio de mensagens
  - name: Cloud API
    description: >-
      WhatsApp API Oficial (Meta Cloud API): conexão manual, gestão de templates
      (listar/criar/excluir) e envio de templates.
  - name: Ligações URA
    description: >-
      Disparo de ligações de voz (URA): individual ou em massa, com áudio ou
      fluxo IVR.
  - name: SMS
    description: 'Envio de SMS: individual ou em massa.'
  - name: Comandos
    description: >-
      Consulta de comandos assíncronos (async: true) pelo commandId retornado no
      enfileiramento.
paths:
  /api/v1/connections/cloud-api/{id}/templates:
    post:
      tags:
        - Cloud API
      summary: Criar template de mensagem na WABA
      description: >-
        Envia um novo template de mensagem para revisão da Meta. `name` deve
        estar em snake_case minúsculo; `category` é MARKETING, UTILITY ou
        AUTHENTICATION; `language` é um código de idioma da Meta (ex.: pt_BR).
        Os marcadores do corpo usam {{1}}, {{2}}… e `bodyExample` fornece um
        valor de exemplo para cada marcador.


        Cabeçalhos: defina `headerFormat` como TEXT (com `headerText`) ou
        IMAGE/VIDEO/DOCUMENT (com `headerMediaUrl` ou `headerMediaBase64` — o
        exemplo é enviado à Meta automaticamente). Botões: use `buttons[]` com
        QUICK_REPLY (`text`), URL (`text`, `url` — inclua `urlExample` quando a
        url tiver {{1}}), PHONE_NUMBER (`text`, `phoneNumber`) ou COPY_CODE
        (`example`). `data` traz o id do template criado e o status inicial
        (normalmente PENDING).
      operationId: postApiV1ConnectionsCloud-apiByIdTemplates
      parameters:
        - schema:
            type: string
          in: path
          name: id
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  minLength: 1
                  pattern: ^[a-z0-9_]+$
                  type: string
                category:
                  anyOf:
                    - const: MARKETING
                      type: string
                    - const: UTILITY
                      type: string
                    - const: AUTHENTICATION
                      type: string
                language:
                  minLength: 2
                  type: string
                headerFormat:
                  anyOf:
                    - const: TEXT
                      type: string
                    - const: IMAGE
                      type: string
                    - const: VIDEO
                      type: string
                    - const: DOCUMENT
                      type: string
                headerText:
                  type: string
                headerMediaUrl:
                  type: string
                headerMediaBase64:
                  type: string
                headerMediaMime:
                  type: string
                bodyText:
                  minLength: 1
                  type: string
                footerText:
                  type: string
                bodyExample:
                  type: array
                  items:
                    type: string
                buttons:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        anyOf:
                          - const: QUICK_REPLY
                            type: string
                          - const: URL
                            type: string
                          - const: PHONE_NUMBER
                            type: string
                          - const: COPY_CODE
                            type: string
                      text:
                        type: string
                      url:
                        type: string
                      urlExample:
                        type: string
                      phoneNumber:
                        type: string
                      example:
                        type: string
                    required:
                      - type
              required:
                - name
                - category
                - language
                - bodyText
          multipart/form-data:
            schema:
              type: object
              properties:
                name:
                  minLength: 1
                  pattern: ^[a-z0-9_]+$
                  type: string
                category:
                  anyOf:
                    - const: MARKETING
                      type: string
                    - const: UTILITY
                      type: string
                    - const: AUTHENTICATION
                      type: string
                language:
                  minLength: 2
                  type: string
                headerFormat:
                  anyOf:
                    - const: TEXT
                      type: string
                    - const: IMAGE
                      type: string
                    - const: VIDEO
                      type: string
                    - const: DOCUMENT
                      type: string
                headerText:
                  type: string
                headerMediaUrl:
                  type: string
                headerMediaBase64:
                  type: string
                headerMediaMime:
                  type: string
                bodyText:
                  minLength: 1
                  type: string
                footerText:
                  type: string
                bodyExample:
                  type: array
                  items:
                    type: string
                buttons:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        anyOf:
                          - const: QUICK_REPLY
                            type: string
                          - const: URL
                            type: string
                          - const: PHONE_NUMBER
                            type: string
                          - const: COPY_CODE
                            type: string
                      text:
                        type: string
                      url:
                        type: string
                      urlExample:
                        type: string
                      phoneNumber:
                        type: string
                      example:
                        type: string
                    required:
                      - type
              required:
                - name
                - category
                - language
                - bodyText
          text/plain:
            schema:
              type: object
              properties:
                name:
                  minLength: 1
                  pattern: ^[a-z0-9_]+$
                  type: string
                category:
                  anyOf:
                    - const: MARKETING
                      type: string
                    - const: UTILITY
                      type: string
                    - const: AUTHENTICATION
                      type: string
                language:
                  minLength: 2
                  type: string
                headerFormat:
                  anyOf:
                    - const: TEXT
                      type: string
                    - const: IMAGE
                      type: string
                    - const: VIDEO
                      type: string
                    - const: DOCUMENT
                      type: string
                headerText:
                  type: string
                headerMediaUrl:
                  type: string
                headerMediaBase64:
                  type: string
                headerMediaMime:
                  type: string
                bodyText:
                  minLength: 1
                  type: string
                footerText:
                  type: string
                bodyExample:
                  type: array
                  items:
                    type: string
                buttons:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        anyOf:
                          - const: QUICK_REPLY
                            type: string
                          - const: URL
                            type: string
                          - const: PHONE_NUMBER
                            type: string
                          - const: COPY_CODE
                            type: string
                      text:
                        type: string
                      url:
                        type: string
                      urlExample:
                        type: string
                      phoneNumber:
                        type: string
                      example:
                        type: string
                    required:
                      - type
              required:
                - name
                - category
                - language
                - bodyText
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data: {}
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - success
            multipart/form-data:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data: {}
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - success
            text/plain:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data: {}
                  error:
                    type: string
                  code:
                    type: string
                required:
                  - success
          description: Resposta bem-sucedida
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'API Key para autenticação. Formato: <API_KEY>'

````