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

# Retrieve WhatsApp template analytics

> Returns daily YCloud message metrics and, when available, Meta Template Insights
for one WhatsApp template. Authenticate with `X-API-Key`.
`analyticsStatus` describes Meta Template Insights only; it does not describe YCloud metrics.
Dates are interpreted in the WABA timezone, both boundaries are inclusive, and the range
must contain between 1 and 90 calendar days.

The selected template must currently exist under the requested WABA. REST resolves and
validates the template before querying any statistics. A missing template returns `404`,
a template that belongs to another WABA returns `403`, and a template lookup failure returns
`500`; none of these errors returns partial statistics.



## OpenAPI

````yaml /openapi/endpoints/ycloud-api-v2.yaml post /whatsapp/templates/analytics
openapi: 3.0.0
info:
  description: >-
    The [YCloud](https://ycloud.com) API is organized around
    [REST](https://en.wikipedia.org/wiki/Representational_state_transfer). Our
    API is designed to have predictable, resource-oriented URLs, return
    [JSON](https://www.json.org) responses, and use standard HTTP response codes
    and verbs.
  version: v2
  title: YCloud API
  termsOfService: https://ycloud.com/terms-service
  contact:
    email: service@ycloud.com
servers:
  - url: https://api.ycloud.com/v2
    description: Base URL
security:
  - api_key: []
tags:
  - name: Balance
  - name: Contacts
  - name: Custom Events
  - name: Emails
  - name: SMS
  - name: Unsubscribers
  - name: Verify
  - name: Voices
  - name: Webhook Endpoints
  - name: WhatsApp Business Accounts
  - name: WhatsApp Inbound Messages
  - name: WhatsApp Media
  - name: WhatsApp Messages
  - name: WhatsApp Blocked Users
  - name: WhatsApp Groups
  - name: WhatsApp Calling
  - name: WhatsApp Phone Numbers
  - name: WhatsApp Templates
  - name: WhatsApp Flows
  - name: Meta Business Agent
  - name: WhatsApp Group Messages
externalDocs:
  description: Homepage
  url: https://ycloud.com
paths:
  /whatsapp/templates/analytics:
    post:
      tags:
        - WhatsApp Templates
      summary: Retrieve WhatsApp template analytics
      description: >-
        Returns daily YCloud message metrics and, when available, Meta Template
        Insights

        for one WhatsApp template. Authenticate with `X-API-Key`.

        `analyticsStatus` describes Meta Template Insights only; it does not
        describe YCloud metrics.

        Dates are interpreted in the WABA timezone, both boundaries are
        inclusive, and the range

        must contain between 1 and 90 calendar days.


        The selected template must currently exist under the requested WABA.
        REST resolves and

        validates the template before querying any statistics. A missing
        template returns `404`,

        a template that belongs to another WABA returns `403`, and a template
        lookup failure returns

        `500`; none of these errors returns partial statistics.
      operationId: whatsapp_template-analytics
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WhatsappTemplateAnalyticsRequest'
      responses:
        '200':
          description: Successfully retrieved template analytics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsappTemplateAnalytics'
        '400':
          description: The request parameters are invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: The WABA or template is not accessible.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: >-
            The WABA does not exist, or the template selected by either
            supported selector was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: >-
            A required dependency, such as current template resolution or YCloud
            message statistics, could not be retrieved. Meta Template Insights
            failures after successful template validation are returned as a 200
            response with analyticsStatus set to ERROR.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    WhatsappTemplateAnalyticsRequest:
      type: object
      required:
        - wabaId
        - startDate
        - endDate
      properties:
        wabaId:
          type: string
          example: '102012345678901'
        officialTemplateId:
          type: string
          nullable: true
          description: >-
            Official WhatsApp/Meta template ID exposed by the existing template
            REST APIs.
          example: '875432109876543'
        templateName:
          type: string
          nullable: true
          description: >-
            Exact template name. Must be provided together with language when
            officialTemplateId is absent.
          example: order_update
        language:
          type: string
          nullable: true
          description: >-
            Template language code. Must be provided together with templateName
            when officialTemplateId is absent.
          example: en_US
        startDate:
          type: string
          format: date
          description: Inclusive start date interpreted in the WABA timezone.
          example: '2026-07-01'
        endDate:
          type: string
          format: date
          description: >-
            Inclusive end date interpreted in the WABA timezone. The inclusive
            range must not exceed 90 calendar days.
          example: '2026-07-07'
      description: >-
        Specify exactly one template selector: either officialTemplateId alone,
        or templateName together

        with language. officialTemplateId cannot be combined with templateName
        or language.
    WhatsappTemplateAnalytics:
      type: object
      required:
        - wabaId
        - officialTemplateId
        - templateName
        - language
        - timezone
        - analyticsStatus
        - startDate
        - endDate
        - dataPoints
      properties:
        wabaId:
          type: string
          description: WhatsApp Business Account ID.
        officialTemplateId:
          type: string
          nullable: true
          description: >-
            Resolved official WhatsApp/Meta template ID. Successful queries
            resolve a current template; the property remains nullable for
            contract compatibility.
        templateName:
          type: string
          description: Template name used for the statistics query.
        language:
          type: string
          description: Template language used for the statistics query.
        timezone:
          type: string
          description: >-
            IANA timezone resolved from the WABA configuration and used to
            interpret the date range.
        analyticsStatus:
          type: string
          enum:
            - ENABLED
            - NOT_ENABLED
            - UNSUPPORTED_REGION
            - PERMISSION_DENIED
            - NO_DATA
            - ERROR
          description: >-
            Meta Template Insights status only; it does not describe YCloud
            message metrics.

            NO_DATA means the Meta query completed without data for the
            requested date range.

            ERROR indicates that Template Insights are unavailable because of an
            error after the

            current template was successfully resolved and validated.
        startDate:
          type: string
          format: date
          description: Inclusive start date from the request.
        endDate:
          type: string
          format: date
          description: Inclusive end date from the request.
        dataPoints:
          type: array
          description: >-
            One item for every date in the requested range, ordered by date
            ascending. Missing metrics are returned as zero and missing button
            details as an empty array.
          items:
            $ref: '#/components/schemas/WhatsappTemplateAnalyticsDataPoint'
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          $ref: '#/components/schemas/Error'
          description: >-
            Contains the error code and human-readable message for the API
            error.
    WhatsappTemplateAnalyticsDataPoint:
      type: object
      required:
        - date
        - sent
        - delivered
        - failed
        - read
        - clicks
        - uniqueReplies
        - buttonClicks
      properties:
        date:
          type: string
          format: date
        sent:
          type: integer
          format: int64
          description: Number of messages created on this date for the selected template.
        delivered:
          type: integer
          format: int64
          description: Number of those messages that were delivered.
        failed:
          type: integer
          format: int64
          description: Number of those messages whose status is failed or expired.
        read:
          type: integer
          format: int64
          description: Number of those messages that were read.
        clicks:
          type: integer
          format: int64
          description: >-
            Total number of clicks recorded for this template on this date.
            Interpret zero together with analyticsStatus.
        uniqueReplies:
          type: integer
          format: int64
          description: >-
            Number of unique replies recorded for this template on this date.
            This is mapped from Meta replied and is a Meta Template Insights
            metric.
        buttonClicks:
          type: array
          description: >-
            Button click breakdown for this template on this date. Empty when no
            details are available.
          items:
            $ref: '#/components/schemas/WhatsappTemplateAnalyticsButtonClick'
    Error:
      type: object
      required:
        - status
        - code
      properties:
        status:
          type: integer
          format: int32
          pattern: '[45]\d{2}'
          description: >-
            HTTP status code, [RFC 7231, Section
            6](https://datatracker.ietf.org/doc/html/rfc7231#section-6). It
            conveys the HTTP status code used for the convenience of the
            consumer.
          example: 404
        code:
          type: string
          description: >-
            One of a server-defined error codes. Some `4xx` errors that could be
            handled programmatically include an error code that briefly explains
            the error reported.
          example: NOT_FOUND
        message:
          type: string
          description: >-
            A human-readable representation of the error. It is intended as an
            aid to developers and is not suitable for exposure to end users.
          example: The requested resource does not exist.
        target:
          type: string
          description: The target of the error.
          example: ''
        docUrl:
          type: string
          description: A URL to more information about the error.
          example: ''
        requestId:
          type: string
          description: >-
            Each API request has an associated request ID. It conveys the
            response header `YCloud-Request-ID` used for the convenience of the
            consumer.
          example: req_1KjtKI80IKoaJNa6n6p
        whatsappApiError:
          $ref: '#/components/schemas/WhatsappApiError'
          description: >-
            The original error object returned by WhatsApp. See [Handling
            Errors](https://developers.facebook.com/docs/graph-api/guides/error-handling),
            [Cloud API Error
            Codes](https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes).


            Note: This field is returned if we tried to request the WhatsApp
            Business API and got an error response.
        metaBusinessAgentApiError:
          $ref: '#/components/schemas/MetaBusinessAgentApiError'
          description: >-
            Sanitized upstream details returned when a Meta Business Agent
            request fails.
    WhatsappTemplateAnalyticsButtonClick:
      type: object
      required:
        - type
        - buttonContent
        - count
      properties:
        type:
          type: string
          description: >-
            Type of button associated with the clicks. Values may include
            quick_reply_button, unique_url_button, or url_button.
        buttonContent:
          type: string
          description: Button content associated with the clicks.
        count:
          type: integer
          format: int64
          description: Number of clicks for this button entry.
    WhatsappApiError:
      type: object
      description: >-
        The original error object returned by WhatsApp. See [Handling
        Errors](https://developers.facebook.com/docs/graph-api/guides/error-handling),
        [Cloud API Error
        Codes](https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes).
      required:
        - message
        - code
      properties:
        message:
          type: string
          description: A human-readable description of the error.
          example: HSM Template creation failed
        code:
          type: string
          description: An error code.
          example: 200002
        type:
          type: string
          description: Error type.
          example: OAuthException
        is_transient:
          type: boolean
          description: Whether the error is transient.
          example: false
        error_subcode:
          type: string
          description: Additional code about the error.
          example: 2388109
        error_user_msg:
          type: string
          description: >-
            The message to display to the user. The language of the message is
            based on the locale of the API request.
          example: This message template cannot be created.
        error_user_title:
          type: string
          description: >-
            The title of the dialog, if shown. The language of the message is
            based on the locale of the API request.
          example: Message Cannot Be Submitted
        fbtrace_id:
          type: string
          description: >-
            Internal support identifier. When reporting a bug related to a Graph
            API call, include the fbtrace_id to help us find log data for
            debugging.
          example: AVGjJ7ia2zJkrHG
        error_data:
          description: >-
            Additional data about the error. A string or map.

            - For template APIs, this field is a string describing the reason
            for the error.

            - For message APIs, this field is a map with property `details`
            describing the reason for the error.
          oneOf:
            - type: string
            - type: object
              additionalProperties: true
    MetaBusinessAgentApiError:
      type: object
      description: Sanitized details from a failed Meta Business Agent upstream request.
      properties:
        title:
          type: string
        detail:
          type: string
        type:
          type: string
        status:
          type: integer
          format: int32
        requestId:
          type: string
  securitySchemes:
    api_key:
      type: apiKey
      name: X-API-Key
      in: header

````

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