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

> ## Agent Instructions
> Integrating Pilot Status end to end? Follow https://docs.pilotstatus.com.br/guides/integrate-with-ai.md (pt-BR: https://docs.pilotstatus.com.br/pt-BR/guides/integrate-with-ai.md). No step requires contacting support: every credential is shown in the dashboard or in an API response, and a lost one is regenerated, not recovered.
> Webhook signing secret: shown ONCE in the Signing secret window right after creating the webhook on /webhooks, and in the `secret` field of the POST /v1/webhooks response (MCP: webhooks_create). Lost it: Edit Webhook → Generate a new secret, POST /v1/webhooks/{id}/rotate-secret, or webhooks_rotate_secret (the old one stops working at once). Verify `x-pilot-status-signature` = hex HMAC-SHA256 of the raw request body keyed with that secret.
> Meta verify token (number connected with the user's own Meta app credentials): Meta Number Created! window after connecting, then the number's card on Numbers (workspace Owner), or webhook.verifyToken in the POST /v1/numbers/meta response. It is not the webhook signing secret.
> REST auth: `x-api-key: ps_...` header, never Authorization: Bearer. MCP: https://mcp.pilotstatus.com.br/mcp (148 tools, OAuth 2.1 or x-api-key); Code Mode: https://mcp.pilotstatus.com.br/code. Destructive MCP tools return a preview and a confirm_token: show the preview and call again only after the user's explicit yes. Over OAuth, revealing or creating ps_ API keys is workspace Owner only.

# Obtener métricas de la plantilla

> Devuelve los números de entrega e interacción de Meta para una plantilla en los últimos `days` días (7, 30 o 90; por defecto 30): totales de enviados, entregados y leídos, `readRate` (leídos / entregados, `null` cuando no se entregó nada), clics en botones y una serie diaria.

Los datos vienen de la analítica de plantillas de Meta: granularidad diaria, solo los últimos 90 días, y los días más recientes pueden estar todavía completándose. La primera llamada para una WhatsApp Business Account puede activar las métricas de plantillas en esa cuenta en Meta.

Solo las plantillas enviadas a Meta tienen métricas (`409 TEMPLATE_NOT_ON_META` en caso contrario). Meta no ofrece métricas de plantillas para números de WhatsApp Business App / coexistencia (`422 TEMPLATE_INSIGHTS_UNAVAILABLE_SMB`). Mismo acceso que `GET /v1/templates/{id}`: permiso `templates:read` (todos los roles, para claves de cuenta y tokens OAuth); una clave con alcance de número solo ve plantillas de sus números.

**Requiere una clave con alcance de número.**



## OpenAPI

````yaml openapi.es.json GET /v1/templates/{id}/insights
openapi: 3.1.0
info:
  title: Pilot Status API
  version: 1.0.0
  license:
    name: Pilot Status Terms of Service
    url: https://pilotstatus.com.br/terms
  description: >-
    API REST pública de Pilot Status. Autentícate con el encabezado `x-api-key:
    ps_...` (o `x-api-key-id`). URL base: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/templates/{id}/insights:
    get:
      tags:
        - Templates
      summary: Obtener métricas de la plantilla
      description: >-
        Devuelve los números de entrega e interacción de Meta para una plantilla
        en los últimos `days` días (7, 30 o 90; por defecto 30): totales de
        enviados, entregados y leídos, `readRate` (leídos / entregados, `null`
        cuando no se entregó nada), clics en botones y una serie diaria.


        Los datos vienen de la analítica de plantillas de Meta: granularidad
        diaria, solo los últimos 90 días, y los días más recientes pueden estar
        todavía completándose. La primera llamada para una WhatsApp Business
        Account puede activar las métricas de plantillas en esa cuenta en Meta.


        Solo las plantillas enviadas a Meta tienen métricas (`409
        TEMPLATE_NOT_ON_META` en caso contrario). Meta no ofrece métricas de
        plantillas para números de WhatsApp Business App / coexistencia (`422
        TEMPLATE_INSIGHTS_UNAVAILABLE_SMB`). Mismo acceso que `GET
        /v1/templates/{id}`: permiso `templates:read` (todos los roles, para
        claves de cuenta y tokens OAuth); una clave con alcance de número solo
        ve plantillas de sus números.


        **Requiere una clave con alcance de número.**
      operationId: get_templates_id_insights
      parameters:
        - name: id
          in: path
          required: true
          description: Id de la plantilla (no se acepta el nombre).
          schema:
            type: string
          example: tpl_01HZX...
        - name: days
          in: query
          required: false
          description: >-
            Ventana en días: `7`, `30` o `90`. Por defecto `30`. Cualquier otro
            valor devuelve `400 INVALID_DAYS`.
          schema:
            type: integer
            enum:
              - 7
              - 30
              - 90
            default: 30
          example: 30
      responses:
        '200':
          description: Métricas de la plantilla
          content:
            application/json:
              schema:
                type: object
                required:
                  - templateId
                  - template
                  - days
                  - totals
                  - readRate
                  - clicks
                  - daily
                properties:
                  templateId:
                    type: string
                    description: Id de la plantilla.
                  template:
                    type: object
                    description: >-
                      El nombre, estado, categoría, idioma y puntuación de
                      calidad de Meta de la plantilla.
                    properties:
                      name:
                        type: string
                      status:
                        type: string
                        description: >-
                          Estado de la plantilla en Meta. `"UNKNOWN"` cuando ni
                          Meta ni la copia local informan uno.
                      category:
                        type: string
                      language:
                        type: string
                        description: >-
                          Idioma de la plantilla. `""` (cadena vacía) cuando ni
                          Meta ni la copia local informan uno.
                      qualityScore:
                        type:
                          - string
                          - 'null'
                        description: >-
                          Puntuación de calidad de Meta (p. ej. `GREEN`,
                          `YELLOW`, `RED`), o `null` cuando Meta no la ha
                          calificado.
                  days:
                    type: integer
                    enum:
                      - 7
                      - 30
                      - 90
                    description: La ventana utilizada.
                  totals:
                    type: object
                    description: Sumas en la ventana.
                    properties:
                      sent:
                        type: integer
                        description: Mensajes enviados.
                      delivered:
                        type: integer
                        description: Mensajes entregados.
                      read:
                        type: integer
                        description: Mensajes leídos.
                  readRate:
                    type:
                      - number
                      - 'null'
                    description: >-
                      `read / delivered`, de 0 a 1. `null` cuando `delivered` es
                      0.
                  clicks:
                    type: array
                    description: >-
                      Clics en botones durante la ventana, una entrada por
                      botón.
                    items:
                      type: object
                      properties:
                        type:
                          type: string
                          description: >-
                            Tipo de botón informado por Meta (p. ej.
                            `quick_reply_button`, `url_button`).
                        buttonContent:
                          type: string
                          description: Texto del botón (o URL) tal como lo informa Meta.
                        count:
                          type: integer
                          description: Clics.
                  daily:
                    type: array
                    description: >-
                      Una entrada por día de la ventana, del más antiguo al más
                      reciente.
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                          format: date
                          description: Día (UTC), `YYYY-MM-DD`.
                        sent:
                          type: integer
                          description: Mensajes enviados.
                        delivered:
                          type: integer
                          description: Mensajes entregados.
                        read:
                          type: integer
                          description: Mensajes leídos.
              example:
                templateId: tpl_01HZX...
                template:
                  name: boas_vindas
                  status: APPROVED
                  category: UTILITY
                  language: pt_BR
                  qualityScore: GREEN
                days: 7
                totals:
                  sent: 1240
                  delivered: 1198
                  read: 873
                readRate: 0.7287
                clicks:
                  - type: quick_reply_button
                    buttonContent: Quero saber mais
                    count: 112
                  - type: url_button
                    buttonContent: https://exemplo.com.br/oferta
                    count: 64
                daily:
                  - date: '2026-10-22'
                    sent: 180
                    delivered: 175
                    read: 130
                  - date: '2026-10-23'
                    sent: 172
                    delivered: 166
                    read: 121
                  - date: '2026-10-24'
                    sent: 190
                    delivered: 184
                    read: 139
                  - date: '2026-10-25'
                    sent: 160
                    delivered: 155
                    read: 110
                  - date: '2026-10-26'
                    sent: 178
                    delivered: 171
                    read: 124
                  - date: '2026-10-27'
                    sent: 185
                    delivered: 180
                    read: 129
                  - date: '2026-10-28'
                    sent: 175
                    delivered: 167
                    read: 120
        '400':
          description: '`days` no es 7, 30 ni 90'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - INVALID_DAYS
              example:
                error: days must be one of 7, 30 or 90. | days deve ser 7, 30 ou 90.
                code: INVALID_DAYS
        '401':
          description: Encabezado `x-api-key` / `x-api-key-id` ausente o inválido
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unauthorized
        '403':
          description: >-
            Clave de workspace/cuenta o token OAuth sin `x-whatsapp-number-id`
            (`TENANT_SCOPE_NOT_ALLOWED`), un rol de usuario sin `templates:read`
            (`PERMISSION_DENIED`), o un número fuera de un permiso OAuth
            (`NUMBER_NOT_IN_GRANT`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              examples:
                TENANT_SCOPE_NOT_ALLOWED:
                  value:
                    error: >-
                      This endpoint acts on a single WhatsApp number: send the
                      x-whatsapp-number-id header naming the number to act on
                      (its id or instance id from GET /v1/numbers) | Este
                      endpoint atua sobre um único número de WhatsApp: envie o
                      header x-whatsapp-number-id indicando o número desejado (o
                      id dele ou o id da instância, obtidos em GET /v1/numbers)
                    code: TENANT_SCOPE_NOT_ALLOWED
                PERMISSION_DENIED:
                  value:
                    error: >-
                      Your workspace role does not allow this action
                      (templates:read).
                    code: PERMISSION_DENIED
        '404':
          description: Plantilla no encontrada en el alcance de la clave
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - TEMPLATE_NOT_FOUND
              example:
                error: Template not found. | Template não encontrado.
                code: TEMPLATE_NOT_FOUND
        '409':
          description: >-
            La plantilla no está en Meta, o no hay ningún número de Meta
            conectado para su WhatsApp Business Account
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - TEMPLATE_NOT_ON_META
                      - NO_META_NUMBER_FOR_WABA
              examples:
                TEMPLATE_NOT_ON_META:
                  summary: Template not submitted to Meta
                  value:
                    error: >-
                      This template was not submitted to Meta, so it has no
                      insights. | Este template não foi enviado à Meta, então
                      não tem insights.
                    code: TEMPLATE_NOT_ON_META
                NO_META_NUMBER_FOR_WABA:
                  summary: No Meta number for the template's WABA
                  value:
                    error: >-
                      No connected Meta number on this template's WABA.
                      Reconnect a number to view insights. | Nenhum número Meta
                      conectado na WABA deste template. Reconecte um número para
                      ver os insights.
                    code: NO_META_NUMBER_FOR_WABA
        '422':
          description: Meta no ofrece métricas para esta cuenta, o rechazó la solicitud
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - TEMPLATE_INSIGHTS_UNAVAILABLE_SMB
                      - META_REJECTED
              examples:
                TEMPLATE_INSIGHTS_UNAVAILABLE_SMB:
                  summary: WhatsApp Business App / coexistence account
                  value:
                    error: >-
                      Meta does not provide template insights for WhatsApp
                      Business App (SMB / coexistence) accounts. | A Meta não
                      oferece insights de template para contas do WhatsApp
                      Business App (SMB / coexistência).
                    code: TEMPLATE_INSIGHTS_UNAVAILABLE_SMB
                META_REJECTED:
                  summary: Meta rejected the request
                  value:
                    error: >-
                      Meta rejected the template insights request: (#100)
                      Invalid parameter | A Meta recusou o pedido de insights do
                      template.
                    code: META_REJECTED
        '429':
          description: Límite de solicitudes excedido
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Too many requests
        '500':
          description: Error interno
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - INTERNAL_ERROR
              example:
                error: Internal server error | Erro interno do servidor
                code: INTERNAL_ERROR
        '503':
          description: 'Meta no está disponible temporalmente: vuelve a intentarlo más tarde'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
                    enum:
                      - META_UNAVAILABLE
              example:
                error: >-
                  Meta is unavailable right now. Try again in a few minutes. | A
                  Meta está indisponível no momento. Tente novamente em alguns
                  minutos.
                code: META_UNAVAILABLE
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Tu API key ps_
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: Id de la API key (alternativa a x-api-key)

````

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