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

# Criar template de WhatsApp

> Submete um novo template à aprovação da Meta. A análise não é instantânea: o template nasce com status `PENDING` e só pode ser enviado após virar `APPROVED`. Cabeçalhos de mídia exigem o handle devolvido por `POST /integration/templates/{integrationId}/media` em `example.header_handle`.



## OpenAPI

````yaml https://api.jurichat.com/docs/client/openapi.json post /integration/templates/{integrationId}
openapi: 3.1.0
info:
  title: JuriChat API — Documentação para Integradores
  description: ''
  version: 1.0.0
servers:
  - url: https://api.jurichat.com
    description: Production server
security:
  - apiKeyAuth: []
tags: []
paths:
  /integration/templates/{integrationId}:
    post:
      tags:
        - Templates
      summary: Criar template de WhatsApp
      description: >-
        Submete um novo template à aprovação da Meta. A análise não é
        instantânea: o template nasce com status `PENDING` e só pode ser enviado
        após virar `APPROVED`. Cabeçalhos de mídia exigem o handle devolvido por
        `POST /integration/templates/{integrationId}/media` em
        `example.header_handle`.
      parameters:
        - schema:
            type: string
            pattern: ^[cC][^\s-]{8,}$
          in: path
          name: integrationId
          required: true
          description: ID da integração de WhatsApp API Oficial do escritório.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 512
                  pattern: ^[a-z0-9_]+$
                  description: >-
                    Nome único do template. Apenas letras minúsculas, números e
                    underscores, ex.: retorno_atendimento.
                category:
                  type: string
                  enum:
                    - UTILITY
                    - MARKETING
                    - AUTHENTICATION
                  description: >-
                    Categoria declarada à Meta. AUTHENTICATION exige botão OTP e
                    corpo com aviso de segurança.
                language:
                  type: string
                  minLength: 2
                  description: 'Código do idioma do template, ex.: pt_BR.'
                components:
                  type: array
                  items:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - HEADER
                          - BODY
                          - FOOTER
                          - BUTTONS
                        description: >-
                          Tipo do componente. BODY é obrigatório em todo
                          template.
                      format:
                        type: string
                        enum:
                          - TEXT
                          - IMAGE
                          - VIDEO
                          - DOCUMENT
                          - LOCATION
                        description: >-
                          Formato do cabeçalho. Aplicável somente a componentes
                          HEADER.
                      text:
                        type: string
                        description: >-
                          Conteúdo textual do componente. Use {{1}}, {{2}} para
                          variáveis posicionais.
                      example:
                        type: object
                        properties:
                          header_text:
                            type: array
                            items:
                              type: array
                              items:
                                type: string
                            description: Exemplos das variáveis do cabeçalho de texto.
                          header_handle:
                            type: array
                            items:
                              type: string
                            description: >-
                              Handle da mídia devolvido por POST
                              /integration/templates/{integrationId}/media.
                              Obrigatório em cabeçalhos IMAGE, VIDEO ou
                              DOCUMENT.
                          body_text:
                            type: array
                            items:
                              type: array
                              items:
                                type: string
                            description: >-
                              Exemplos das variáveis do corpo. Gerados
                              automaticamente quando omitidos.
                        additionalProperties: true
                        description: Exemplos exigidos pela Meta para aprovar o template.
                      buttons:
                        type: array
                        items:
                          anyOf:
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - QUICK_REPLY
                                text:
                                  type: string
                                  minLength: 1
                                  maxLength: 25
                                  description: Rótulo do botão (até 25 caracteres).
                              required:
                                - type
                                - text
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - URL
                                text:
                                  type: string
                                  minLength: 1
                                  maxLength: 25
                                  description: Rótulo do botão (até 25 caracteres).
                                url:
                                  type: string
                                  format: uri
                                  description: >-
                                    URL de destino. Pode conter a variável {{1}}
                                    no final do caminho.
                                example:
                                  type: array
                                  items:
                                    type: string
                                  description: >-
                                    Exemplos de URL completa quando a URL contém
                                    variável.
                              required:
                                - type
                                - text
                                - url
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - PHONE_NUMBER
                                text:
                                  type: string
                                  minLength: 1
                                  maxLength: 25
                                  description: Rótulo do botão (até 25 caracteres).
                                phone_number:
                                  type: string
                                  minLength: 8
                                  description: >-
                                    Telefone no formato internacional, ex.:
                                    +5511999999999.
                              required:
                                - type
                                - text
                                - phone_number
                              additionalProperties: false
                            - type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - OTP
                                otp_type:
                                  type: string
                                  enum:
                                    - COPY_CODE
                                    - ONE_TAP
                                  description: >-
                                    Forma de entrega do código: copiar código ou
                                    toque único.
                                text:
                                  type: string
                                  minLength: 1
                                  maxLength: 25
                                  description: Rótulo do botão (até 25 caracteres).
                              required:
                                - type
                                - otp_type
                                - text
                              additionalProperties: false
                          description: >-
                            Botão do template. QUICK_REPLY não pode ser
                            combinado com URL/PHONE_NUMBER na mesma mensagem.
                        description: >-
                          Botões do componente BUTTONS. Máximo de 3 QUICK_REPLY
                          ou 2 URL/PHONE_NUMBER.
                      add_security_recommendation:
                        type: boolean
                        description: >-
                          Adiciona o aviso de segurança padrão. Somente em
                          templates AUTHENTICATION.
                      code_expiration_minutes:
                        type: integer
                        minimum: 1
                        maximum: 90
                        description: >-
                          Validade do código OTP em minutos (1 a 90). Somente em
                          AUTHENTICATION.
                    required:
                      - type
                    additionalProperties: false
                  minItems: 1
                  description: >-
                    Componentes do template. Ao menos um componente BODY é
                    obrigatório.
              required:
                - name
                - category
                - language
                - components
              additionalProperties: false
        required: true
      responses:
        '201':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: ID do template na Meta.
                  status:
                    type: string
                    description: Status inicial atribuído pela Meta, normalmente PENDING.
                  category:
                    type: string
                    description: Categoria confirmada pela Meta.
                  success:
                    type: boolean
                    description: Indica sucesso em operações de exclusão.
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  statusCode:
                    type: number
                  details: {}
                required:
                  - message
                  - statusCode
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  statusCode:
                    type: number
                  details: {}
                required:
                  - message
                  - statusCode
                additionalProperties: false
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-jurichat-api-key
      description: >-
        Chave de API do escritório (criada no painel). Envie o valor no header
        x-jurichat-api-key.

````