> ## 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.

# Send template

> Send an approved template through an Official API (Cloud API) connection.

Sends an **approved** template to a number (`to`) from an
**Official API (Cloud API)** connection (`sessionId`). The number uses international format
without `+` (e.g. `5511999999999`).

Inside `template`:

* `name` and `language` — must match an `APPROVED` template (see
  [List approved templates](https://docs.d-api.cloud/en/api-reference/cloud-api/listar-templates.md)).
* `bodyVariables` — values for the body's `{{1}}`, `{{2}}`… placeholders.
* `headerVariable` / `headerMedia` — header text variable or media
  (by `url` or `base64`); the backend builds the Graph API `components`.
* `components` — optional: build the components yourself in Graph API format
  and the backend sends them as-is.

> [!WARNING]
>
> Templates can only be sent through `cloud_api` connections. On unofficial
> connections the response is `400` with `code: "NOT_CLOUD_API"`.


## OpenAPI

````yaml api-reference/openapi.en.json POST /api/v1/messages/send/template
openapi: 3.1.0
info:
  title: D-API - Complete WhatsApp Infrastructure
  description: >-
    A scalable, robust solution for automation managers, SaaS products and end
    users who need a reliable WhatsApp integration. It offers multiple
    simultaneous instances, real-time webhooks, an intuitive dashboard and a
    documented REST API with 99.9% uptime and latency under 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: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Home
    description: Base endpoints
  - name: Sessions
    description: Endpoints for managing sessions
  - name: Messages
    description: Endpoints for sending messages
  - name: Cloud API
    description: >-
      WhatsApp Official API (Meta Cloud API): manual connection, template
      management (list/create/delete) and template sending.
  - name: IVR Calls
    description: 'Voice call dispatch (IVR): single or bulk, with audio or an IVR flow.'
  - name: SMS
    description: 'SMS sending: single or bulk.'
  - name: Commands
    description: >-
      Look up asynchronous commands (async: true) by the commandId returned when
      enqueued.
paths:
  /api/v1/messages/send/template:
    post:
      tags:
        - Messages
        - Cloud API
      summary: Send template (Official API)
      description: >-
        Sends an approved template through a Cloud API connection. Accepts body
        variables, a header variable/media (url or base64) and button parameters
        in `buttons[]` — the backend builds the Graph API components.


        `buttons[]` is a union by `subType`: `url` (`text` — the suffix that
        replaces the {{1}} in the url), `copy_code` (`couponCode`), `flow`
        (`flowToken`, `flowActionData`), `order_details` and `payment_request`
        (`orderDetails`, with the amount in BRL). `index` is the button's
        position in the template, starting at 0. Quick reply does not accept
        parameters. `components` still exists as a raw escape hatch, but cannot
        be combined with `buttons`.
      operationId: postApiV1MessagesSendTemplate
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sessionId:
                  minLength: 1
                  type: string
                to:
                  minLength: 1
                  type: string
                template:
                  type: object
                  properties:
                    name:
                      minLength: 1
                      type: string
                    language:
                      minLength: 1
                      type: string
                    bodyVariables:
                      type: array
                      items:
                        type: string
                    headerVariable:
                      type: string
                    headerMedia:
                      type: object
                      properties:
                        type:
                          anyOf:
                            - const: image
                              type: string
                            - const: video
                              type: string
                            - const: document
                              type: string
                        url:
                          type: string
                        base64:
                          type: string
                        mimetype:
                          type: string
                      required:
                        - type
                    buttons:
                      type: array
                      items:
                        anyOf:
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: url
                                type: string
                              text:
                                minLength: 1
                                description: Suffix that replaces the {{1}} in the url.
                                type: string
                            required:
                              - index
                              - subType
                              - text
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: copy_code
                                type: string
                              couponCode:
                                minLength: 1
                                type: string
                            required:
                              - index
                              - subType
                              - couponCode
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: flow
                                type: string
                              flowToken:
                                minLength: 1
                                type: string
                              flowActionData:
                                type: object
                                patternProperties:
                                  ^(.*)$: {}
                            required:
                              - index
                              - subType
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: order_details
                                type: string
                              orderDetails:
                                type: object
                                properties:
                                  referenceId:
                                    minLength: 1
                                    description: Unique per message.
                                    type: string
                                  paymentType:
                                    const: br
                                    type: string
                                  pix:
                                    type: object
                                    properties:
                                      code:
                                        minLength: 1
                                        type: string
                                      merchantName:
                                        minLength: 1
                                        type: string
                                      key:
                                        minLength: 1
                                        type: string
                                      keyType:
                                        anyOf:
                                          - const: CPF
                                            type: string
                                          - const: CNPJ
                                            type: string
                                          - const: EMAIL
                                            type: string
                                          - const: PHONE
                                            type: string
                                          - const: EVP
                                            type: string
                                    required:
                                      - code
                                      - merchantName
                                      - key
                                      - keyType
                                  boleto:
                                    type: object
                                    properties:
                                      digitableLine:
                                        minLength: 1
                                        type: string
                                    required:
                                      - digitableLine
                                  paymentLink:
                                    type: object
                                    properties:
                                      uri:
                                        minLength: 1
                                        type: string
                                    required:
                                      - uri
                                  offsiteCardPay:
                                    type: object
                                    properties:
                                      lastFourDigits:
                                        minLength: 4
                                        maxLength: 4
                                        type: string
                                      credentialId:
                                        minLength: 1
                                        type: string
                                    required:
                                      - lastFourDigits
                                      - credentialId
                                  currency:
                                    minLength: 3
                                    maxLength: 3
                                    type: string
                                  totalAmountBrl:
                                    description: >-
                                      Amount in BRL (e.g. "50", "50,00", "R$
                                      1.234,56"). Never in cents.
                                    anyOf:
                                      - minLength: 1
                                        type: string
                                      - minimum: 0
                                        type: number
                                  items:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        retailerId:
                                          minLength: 1
                                          type: string
                                        name:
                                          minLength: 1
                                          type: string
                                        amountBrl:
                                          description: >-
                                            Amount in BRL (e.g. "50", "50,00", "R$
                                            1.234,56"). Never in cents.
                                          anyOf:
                                            - minLength: 1
                                              type: string
                                            - minimum: 0
                                              type: number
                                        quantity:
                                          minimum: 1
                                          anyOf:
                                            - format: integer
                                              default: 0
                                              type: string
                                            - minimum: 1
                                              type: integer
                                      required:
                                        - retailerId
                                        - name
                                        - amountBrl
                                        - quantity
                                required:
                                  - referenceId
                                  - totalAmountBrl
                            required:
                              - index
                              - subType
                              - orderDetails
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: payment_request
                                type: string
                              orderDetails:
                                type: object
                                properties:
                                  referenceId:
                                    minLength: 1
                                    description: Unique per message.
                                    type: string
                                  paymentType:
                                    const: br
                                    type: string
                                  pix:
                                    type: object
                                    properties:
                                      code:
                                        minLength: 1
                                        type: string
                                      merchantName:
                                        minLength: 1
                                        type: string
                                      key:
                                        minLength: 1
                                        type: string
                                      keyType:
                                        anyOf:
                                          - const: CPF
                                            type: string
                                          - const: CNPJ
                                            type: string
                                          - const: EMAIL
                                            type: string
                                          - const: PHONE
                                            type: string
                                          - const: EVP
                                            type: string
                                    required:
                                      - code
                                      - merchantName
                                      - key
                                      - keyType
                                  boleto:
                                    type: object
                                    properties:
                                      digitableLine:
                                        minLength: 1
                                        type: string
                                    required:
                                      - digitableLine
                                  paymentLink:
                                    type: object
                                    properties:
                                      uri:
                                        minLength: 1
                                        type: string
                                    required:
                                      - uri
                                  offsiteCardPay:
                                    type: object
                                    properties:
                                      lastFourDigits:
                                        minLength: 4
                                        maxLength: 4
                                        type: string
                                      credentialId:
                                        minLength: 1
                                        type: string
                                    required:
                                      - lastFourDigits
                                      - credentialId
                                  currency:
                                    minLength: 3
                                    maxLength: 3
                                    type: string
                                  totalAmountBrl:
                                    description: >-
                                      Amount in BRL (e.g. "50", "50,00", "R$
                                      1.234,56"). Never in cents.
                                    anyOf:
                                      - minLength: 1
                                        type: string
                                      - minimum: 0
                                        type: number
                                  items:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        retailerId:
                                          minLength: 1
                                          type: string
                                        name:
                                          minLength: 1
                                          type: string
                                        amountBrl:
                                          description: >-
                                            Amount in BRL (e.g. "50", "50,00", "R$
                                            1.234,56"). Never in cents.
                                          anyOf:
                                            - minLength: 1
                                              type: string
                                            - minimum: 0
                                              type: number
                                        quantity:
                                          minimum: 1
                                          anyOf:
                                            - format: integer
                                              default: 0
                                              type: string
                                            - minimum: 1
                                              type: integer
                                      required:
                                        - retailerId
                                        - name
                                        - amountBrl
                                        - quantity
                                required:
                                  - referenceId
                                  - totalAmountBrl
                            required:
                              - index
                              - subType
                              - orderDetails
                    components:
                      type: array
                      items: {}
                  required:
                    - name
                    - language
              required:
                - sessionId
                - to
                - template
              additionalProperties: false
          multipart/form-data:
            schema:
              type: object
              properties:
                sessionId:
                  minLength: 1
                  type: string
                to:
                  minLength: 1
                  type: string
                template:
                  type: object
                  properties:
                    name:
                      minLength: 1
                      type: string
                    language:
                      minLength: 1
                      type: string
                    bodyVariables:
                      type: array
                      items:
                        type: string
                    headerVariable:
                      type: string
                    headerMedia:
                      type: object
                      properties:
                        type:
                          anyOf:
                            - const: image
                              type: string
                            - const: video
                              type: string
                            - const: document
                              type: string
                        url:
                          type: string
                        base64:
                          type: string
                        mimetype:
                          type: string
                      required:
                        - type
                    buttons:
                      type: array
                      items:
                        anyOf:
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: url
                                type: string
                              text:
                                minLength: 1
                                description: Suffix that replaces the {{1}} in the url.
                                type: string
                            required:
                              - index
                              - subType
                              - text
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: copy_code
                                type: string
                              couponCode:
                                minLength: 1
                                type: string
                            required:
                              - index
                              - subType
                              - couponCode
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: flow
                                type: string
                              flowToken:
                                minLength: 1
                                type: string
                              flowActionData:
                                type: object
                                patternProperties:
                                  ^(.*)$: {}
                            required:
                              - index
                              - subType
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: order_details
                                type: string
                              orderDetails:
                                type: object
                                properties:
                                  referenceId:
                                    minLength: 1
                                    description: Unique per message.
                                    type: string
                                  paymentType:
                                    const: br
                                    type: string
                                  pix:
                                    type: object
                                    properties:
                                      code:
                                        minLength: 1
                                        type: string
                                      merchantName:
                                        minLength: 1
                                        type: string
                                      key:
                                        minLength: 1
                                        type: string
                                      keyType:
                                        anyOf:
                                          - const: CPF
                                            type: string
                                          - const: CNPJ
                                            type: string
                                          - const: EMAIL
                                            type: string
                                          - const: PHONE
                                            type: string
                                          - const: EVP
                                            type: string
                                    required:
                                      - code
                                      - merchantName
                                      - key
                                      - keyType
                                  boleto:
                                    type: object
                                    properties:
                                      digitableLine:
                                        minLength: 1
                                        type: string
                                    required:
                                      - digitableLine
                                  paymentLink:
                                    type: object
                                    properties:
                                      uri:
                                        minLength: 1
                                        type: string
                                    required:
                                      - uri
                                  offsiteCardPay:
                                    type: object
                                    properties:
                                      lastFourDigits:
                                        minLength: 4
                                        maxLength: 4
                                        type: string
                                      credentialId:
                                        minLength: 1
                                        type: string
                                    required:
                                      - lastFourDigits
                                      - credentialId
                                  currency:
                                    minLength: 3
                                    maxLength: 3
                                    type: string
                                  totalAmountBrl:
                                    description: >-
                                      Amount in BRL (e.g. "50", "50,00", "R$
                                      1.234,56"). Never in cents.
                                    anyOf:
                                      - minLength: 1
                                        type: string
                                      - minimum: 0
                                        type: number
                                  items:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        retailerId:
                                          minLength: 1
                                          type: string
                                        name:
                                          minLength: 1
                                          type: string
                                        amountBrl:
                                          description: >-
                                            Amount in BRL (e.g. "50", "50,00", "R$
                                            1.234,56"). Never in cents.
                                          anyOf:
                                            - minLength: 1
                                              type: string
                                            - minimum: 0
                                              type: number
                                        quantity:
                                          minimum: 1
                                          anyOf:
                                            - format: integer
                                              default: 0
                                              type: string
                                            - minimum: 1
                                              type: integer
                                      required:
                                        - retailerId
                                        - name
                                        - amountBrl
                                        - quantity
                                required:
                                  - referenceId
                                  - totalAmountBrl
                            required:
                              - index
                              - subType
                              - orderDetails
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: payment_request
                                type: string
                              orderDetails:
                                type: object
                                properties:
                                  referenceId:
                                    minLength: 1
                                    description: Unique per message.
                                    type: string
                                  paymentType:
                                    const: br
                                    type: string
                                  pix:
                                    type: object
                                    properties:
                                      code:
                                        minLength: 1
                                        type: string
                                      merchantName:
                                        minLength: 1
                                        type: string
                                      key:
                                        minLength: 1
                                        type: string
                                      keyType:
                                        anyOf:
                                          - const: CPF
                                            type: string
                                          - const: CNPJ
                                            type: string
                                          - const: EMAIL
                                            type: string
                                          - const: PHONE
                                            type: string
                                          - const: EVP
                                            type: string
                                    required:
                                      - code
                                      - merchantName
                                      - key
                                      - keyType
                                  boleto:
                                    type: object
                                    properties:
                                      digitableLine:
                                        minLength: 1
                                        type: string
                                    required:
                                      - digitableLine
                                  paymentLink:
                                    type: object
                                    properties:
                                      uri:
                                        minLength: 1
                                        type: string
                                    required:
                                      - uri
                                  offsiteCardPay:
                                    type: object
                                    properties:
                                      lastFourDigits:
                                        minLength: 4
                                        maxLength: 4
                                        type: string
                                      credentialId:
                                        minLength: 1
                                        type: string
                                    required:
                                      - lastFourDigits
                                      - credentialId
                                  currency:
                                    minLength: 3
                                    maxLength: 3
                                    type: string
                                  totalAmountBrl:
                                    description: >-
                                      Amount in BRL (e.g. "50", "50,00", "R$
                                      1.234,56"). Never in cents.
                                    anyOf:
                                      - minLength: 1
                                        type: string
                                      - minimum: 0
                                        type: number
                                  items:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        retailerId:
                                          minLength: 1
                                          type: string
                                        name:
                                          minLength: 1
                                          type: string
                                        amountBrl:
                                          description: >-
                                            Amount in BRL (e.g. "50", "50,00", "R$
                                            1.234,56"). Never in cents.
                                          anyOf:
                                            - minLength: 1
                                              type: string
                                            - minimum: 0
                                              type: number
                                        quantity:
                                          minimum: 1
                                          anyOf:
                                            - format: integer
                                              default: 0
                                              type: string
                                            - minimum: 1
                                              type: integer
                                      required:
                                        - retailerId
                                        - name
                                        - amountBrl
                                        - quantity
                                required:
                                  - referenceId
                                  - totalAmountBrl
                            required:
                              - index
                              - subType
                              - orderDetails
                    components:
                      type: array
                      items: {}
                  required:
                    - name
                    - language
              required:
                - sessionId
                - to
                - template
              additionalProperties: false
          text/plain:
            schema:
              type: object
              properties:
                sessionId:
                  minLength: 1
                  type: string
                to:
                  minLength: 1
                  type: string
                template:
                  type: object
                  properties:
                    name:
                      minLength: 1
                      type: string
                    language:
                      minLength: 1
                      type: string
                    bodyVariables:
                      type: array
                      items:
                        type: string
                    headerVariable:
                      type: string
                    headerMedia:
                      type: object
                      properties:
                        type:
                          anyOf:
                            - const: image
                              type: string
                            - const: video
                              type: string
                            - const: document
                              type: string
                        url:
                          type: string
                        base64:
                          type: string
                        mimetype:
                          type: string
                      required:
                        - type
                    buttons:
                      type: array
                      items:
                        anyOf:
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: url
                                type: string
                              text:
                                minLength: 1
                                description: Suffix that replaces the {{1}} in the url.
                                type: string
                            required:
                              - index
                              - subType
                              - text
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: copy_code
                                type: string
                              couponCode:
                                minLength: 1
                                type: string
                            required:
                              - index
                              - subType
                              - couponCode
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: flow
                                type: string
                              flowToken:
                                minLength: 1
                                type: string
                              flowActionData:
                                type: object
                                patternProperties:
                                  ^(.*)$: {}
                            required:
                              - index
                              - subType
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: order_details
                                type: string
                              orderDetails:
                                type: object
                                properties:
                                  referenceId:
                                    minLength: 1
                                    description: Unique per message.
                                    type: string
                                  paymentType:
                                    const: br
                                    type: string
                                  pix:
                                    type: object
                                    properties:
                                      code:
                                        minLength: 1
                                        type: string
                                      merchantName:
                                        minLength: 1
                                        type: string
                                      key:
                                        minLength: 1
                                        type: string
                                      keyType:
                                        anyOf:
                                          - const: CPF
                                            type: string
                                          - const: CNPJ
                                            type: string
                                          - const: EMAIL
                                            type: string
                                          - const: PHONE
                                            type: string
                                          - const: EVP
                                            type: string
                                    required:
                                      - code
                                      - merchantName
                                      - key
                                      - keyType
                                  boleto:
                                    type: object
                                    properties:
                                      digitableLine:
                                        minLength: 1
                                        type: string
                                    required:
                                      - digitableLine
                                  paymentLink:
                                    type: object
                                    properties:
                                      uri:
                                        minLength: 1
                                        type: string
                                    required:
                                      - uri
                                  offsiteCardPay:
                                    type: object
                                    properties:
                                      lastFourDigits:
                                        minLength: 4
                                        maxLength: 4
                                        type: string
                                      credentialId:
                                        minLength: 1
                                        type: string
                                    required:
                                      - lastFourDigits
                                      - credentialId
                                  currency:
                                    minLength: 3
                                    maxLength: 3
                                    type: string
                                  totalAmountBrl:
                                    description: >-
                                      Amount in BRL (e.g. "50", "50,00", "R$
                                      1.234,56"). Never in cents.
                                    anyOf:
                                      - minLength: 1
                                        type: string
                                      - minimum: 0
                                        type: number
                                  items:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        retailerId:
                                          minLength: 1
                                          type: string
                                        name:
                                          minLength: 1
                                          type: string
                                        amountBrl:
                                          description: >-
                                            Amount in BRL (e.g. "50", "50,00", "R$
                                            1.234,56"). Never in cents.
                                          anyOf:
                                            - minLength: 1
                                              type: string
                                            - minimum: 0
                                              type: number
                                        quantity:
                                          minimum: 1
                                          anyOf:
                                            - format: integer
                                              default: 0
                                              type: string
                                            - minimum: 1
                                              type: integer
                                      required:
                                        - retailerId
                                        - name
                                        - amountBrl
                                        - quantity
                                required:
                                  - referenceId
                                  - totalAmountBrl
                            required:
                              - index
                              - subType
                              - orderDetails
                          - type: object
                            properties:
                              index:
                                minimum: 0
                                description: >-
                                  Button position in the template, starting at
                                  0.
                                anyOf:
                                  - format: integer
                                    default: 0
                                    type: string
                                  - minimum: 0
                                    description: >-
                                      Button position in the template, starting
                                      at 0.
                                    type: integer
                              subType:
                                const: payment_request
                                type: string
                              orderDetails:
                                type: object
                                properties:
                                  referenceId:
                                    minLength: 1
                                    description: Unique per message.
                                    type: string
                                  paymentType:
                                    const: br
                                    type: string
                                  pix:
                                    type: object
                                    properties:
                                      code:
                                        minLength: 1
                                        type: string
                                      merchantName:
                                        minLength: 1
                                        type: string
                                      key:
                                        minLength: 1
                                        type: string
                                      keyType:
                                        anyOf:
                                          - const: CPF
                                            type: string
                                          - const: CNPJ
                                            type: string
                                          - const: EMAIL
                                            type: string
                                          - const: PHONE
                                            type: string
                                          - const: EVP
                                            type: string
                                    required:
                                      - code
                                      - merchantName
                                      - key
                                      - keyType
                                  boleto:
                                    type: object
                                    properties:
                                      digitableLine:
                                        minLength: 1
                                        type: string
                                    required:
                                      - digitableLine
                                  paymentLink:
                                    type: object
                                    properties:
                                      uri:
                                        minLength: 1
                                        type: string
                                    required:
                                      - uri
                                  offsiteCardPay:
                                    type: object
                                    properties:
                                      lastFourDigits:
                                        minLength: 4
                                        maxLength: 4
                                        type: string
                                      credentialId:
                                        minLength: 1
                                        type: string
                                    required:
                                      - lastFourDigits
                                      - credentialId
                                  currency:
                                    minLength: 3
                                    maxLength: 3
                                    type: string
                                  totalAmountBrl:
                                    description: >-
                                      Amount in BRL (e.g. "50", "50,00", "R$
                                      1.234,56"). Never in cents.
                                    anyOf:
                                      - minLength: 1
                                        type: string
                                      - minimum: 0
                                        type: number
                                  items:
                                    type: array
                                    items:
                                      type: object
                                      properties:
                                        retailerId:
                                          minLength: 1
                                          type: string
                                        name:
                                          minLength: 1
                                          type: string
                                        amountBrl:
                                          description: >-
                                            Amount in BRL (e.g. "50", "50,00", "R$
                                            1.234,56"). Never in cents.
                                          anyOf:
                                            - minLength: 1
                                              type: string
                                            - minimum: 0
                                              type: number
                                        quantity:
                                          minimum: 1
                                          anyOf:
                                            - format: integer
                                              default: 0
                                              type: string
                                            - minimum: 1
                                              type: integer
                                      required:
                                        - retailerId
                                        - name
                                        - amountBrl
                                        - quantity
                                required:
                                  - referenceId
                                  - totalAmountBrl
                            required:
                              - index
                              - subType
                              - orderDetails
                    components:
                      type: array
                      items: {}
                  required:
                    - name
                    - language
              required:
                - sessionId
                - to
                - template
              additionalProperties: false
      responses:
        '200':
          description: Successful response
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'API Key for authentication. Format: <API_KEY>'

````

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