> ## Documentation Index
> Fetch the complete documentation index at: https://kapso-1adbad2d.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get WhatsApp template sync status

> Retrieve the status of WhatsApp template synchronization operations.

**Filtering Options:**
- By specific sync request IDs
- By Business Account ID
- By WhatsApp config ID (automatically resolves to Business Account)
- By customer ID (finds all Business Accounts for customer's configs)

**Default Behavior:**
- Without filters: Returns the latest sync request per Business Account
- With sync_request_ids: Returns those specific sync requests ordered by created_at desc

**Response:**
- Array of sync requests with their current status
- Summary statistics including counts by status and last finished timestamp




## OpenAPI

````yaml api/legacy/openapi-whatsapp.yaml get /whatsapp_templates/sync_status
openapi: 3.0.3
info:
  title: Kapso External API - WhatsApp API
  description: >-
    API for programmatically interacting with Kapso agents, executions, and
    WhatsApp conversations. This specification includes only WhatsApp API
    endpoints.
  version: 1.0.0
  contact:
    name: Kapso Support
servers:
  - url: https://app.kapso.ai/api/v1
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /whatsapp_templates/sync_status:
    get:
      tags:
        - WhatsApp Templates
      summary: Get WhatsApp template sync status
      description: >
        Retrieve the status of WhatsApp template synchronization operations.


        **Filtering Options:**

        - By specific sync request IDs

        - By Business Account ID

        - By WhatsApp config ID (automatically resolves to Business Account)

        - By customer ID (finds all Business Accounts for customer's configs)


        **Default Behavior:**

        - Without filters: Returns the latest sync request per Business Account

        - With sync_request_ids: Returns those specific sync requests ordered by
        created_at desc


        **Response:**

        - Array of sync requests with their current status

        - Summary statistics including counts by status and last finished
        timestamp
      operationId: getWhatsappTemplateSyncStatus
      parameters:
        - name: sync_request_ids
          in: query
          description: Filter by specific sync request IDs (comma-separated)
          schema:
            type: array
            items:
              type: string
              format: uuid
          style: form
          explode: false
          example:
            - sync-run-123abc
            - sync-run-456def
        - name: business_account_id
          in: query
          description: Filter by WhatsApp Business Account ID
          schema:
            type: string
          example: '123456789012345'
        - name: whatsapp_config_id
          in: query
          description: >-
            Filter by WhatsApp config ID (automatically resolves to Business
            Account)
          schema:
            type: string
            format: uuid
          example: config-123abc
        - name: customer_id
          in: query
          description: >-
            Filter by customer ID (finds all Business Accounts for customer's
            production configs)
          schema:
            type: string
            format: uuid
          example: customer-456def
      responses:
        '200':
          description: Sync status retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  sync_requests:
                    type: array
                    description: Array of sync requests matching the filters
                    items:
                      $ref: '#/components/schemas/WhatsappTemplateSyncRun'
                  summary:
                    type: object
                    description: Summary statistics of sync requests
                    properties:
                      total_requests:
                        type: integer
                        description: Total number of sync requests returned
                        example: 3
                      queued:
                        type: integer
                        description: Number of sync requests in queued state
                        example: 1
                      running:
                        type: integer
                        description: Number of sync requests currently running
                        example: 1
                      succeeded:
                        type: integer
                        description: Number of sync requests that succeeded
                        example: 1
                      failed:
                        type: integer
                        description: Number of sync requests that failed
                        example: 0
                      last_finished_at:
                        type: string
                        format: date-time
                        nullable: true
                        description: ISO 8601 timestamp of the most recent finished sync
                        example: '2024-01-15T10:45:00Z'
                      templates_removed:
                        type: integer
                        description: >-
                          Total number of templates removed across all sync
                          requests
                        example: 5
              examples:
                mixed_status:
                  summary: Multiple sync requests with different statuses
                  value:
                    sync_requests:
                      - id: sync-run-123abc
                        business_account_id: '111111111111111'
                        status: succeeded
                        templates_synced: 15
                        templates_created: 5
                        templates_updated: 8
                        templates_removed: 2
                        queued_at: '2024-01-15T10:00:00Z'
                        started_at: '2024-01-15T10:01:00Z'
                        finished_at: '2024-01-15T10:05:00Z'
                        affected_whatsapp_config_ids:
                          - config-111
                          - config-222
                      - id: sync-run-456def
                        business_account_id: '222222222222222'
                        status: running
                        templates_synced: 8
                        templates_created: 3
                        templates_updated: 4
                        templates_removed: 1
                        queued_at: '2024-01-15T10:15:00Z'
                        started_at: '2024-01-15T10:16:00Z'
                        finished_at: null
                        affected_whatsapp_config_ids:
                          - config-333
                      - id: sync-run-789ghi
                        business_account_id: '333333333333333'
                        status: queued
                        templates_synced: 0
                        templates_created: 0
                        templates_updated: 0
                        templates_removed: 0
                        queued_at: '2024-01-15T10:30:00Z'
                        started_at: null
                        finished_at: null
                        affected_whatsapp_config_ids:
                          - config-444
                    summary:
                      total_requests: 3
                      queued: 1
                      running: 1
                      succeeded: 1
                      failed: 0
                      last_finished_at: '2024-01-15T10:05:00Z'
                      templates_removed: 3
                failed_sync:
                  summary: Failed sync request
                  value:
                    sync_requests:
                      - id: sync-run-failed
                        business_account_id: '111111111111111'
                        status: failed
                        templates_synced: 3
                        templates_created: 1
                        templates_updated: 2
                        templates_removed: 0
                        queued_at: '2024-01-15T09:00:00Z'
                        started_at: '2024-01-15T09:01:00Z'
                        finished_at: '2024-01-15T09:02:00Z'
                        error_class: WhatsappApiError
                        error_message: Invalid access token
                        affected_whatsapp_config_ids:
                          - config-111
                    summary:
                      total_requests: 1
                      queued: 0
                      running: 0
                      succeeded: 0
                      failed: 1
                      last_finished_at: '2024-01-15T09:02:00Z'
                      templates_removed: 0
                no_syncs:
                  summary: No sync requests found
                  value:
                    sync_requests: []
                    summary:
                      total_requests: 0
                      queued: 0
                      running: 0
                      succeeded: 0
                      failed: 0
                      last_finished_at: null
                      templates_removed: 0
        '401':
          description: Unauthorized - invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: WhatsApp config or customer not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                config_not_found:
                  summary: WhatsApp config not found
                  value:
                    error: WhatsApp configuration not found
                customer_not_found:
                  summary: Customer not found
                  value:
                    error: Customer not found
components:
  schemas:
    WhatsappTemplateSyncRun:
      type: object
      description: >-
        Represents a WhatsApp template synchronization request grouped by
        Business Account
      properties:
        id:
          type: string
          format: uuid
          example: sync-run-123abc
          description: Unique identifier for the sync run
        business_account_id:
          type: string
          example: '123456789012345'
          description: WhatsApp Business Account ID this sync is for
        anchor_whatsapp_config_id:
          type: string
          format: uuid
          example: config-123abc
          description: Primary WhatsApp config ID used for this sync operation
        status:
          type: string
          enum:
            - queued
            - running
            - succeeded
            - failed
          example: running
          description: Current status of the sync operation
        templates_synced:
          type: integer
          example: 15
          description: Total number of templates synchronized
        templates_created:
          type: integer
          example: 5
          description: Number of new templates created during sync
        templates_updated:
          type: integer
          example: 10
          description: Number of existing templates updated during sync
        templates_removed:
          type: integer
          example: 2
          description: Number of templates removed during sync
        queued_at:
          type: string
          format: date-time
          example: '2024-01-15T10:00:00Z'
          description: When the sync was queued
        started_at:
          type: string
          format: date-time
          nullable: true
          example: '2024-01-15T10:01:00Z'
          description: When the sync started processing
        finished_at:
          type: string
          format: date-time
          nullable: true
          example: '2024-01-15T10:05:00Z'
          description: When the sync completed (success or failure)
        job_id:
          type: string
          nullable: true
          example: job-456def
          description: Background job ID for this sync operation
        error_class:
          type: string
          nullable: true
          example: WhatsappApiError
          description: Error class if sync failed
        error_message:
          type: string
          nullable: true
          example: Invalid access token
          description: Error message if sync failed
        results:
          type: object
          description: Detailed results per WhatsApp config ID
          additionalProperties:
            type: object
            properties:
              templates_synced:
                type: integer
              templates_created:
                type: integer
              templates_updated:
                type: integer
              templates_removed:
                type: integer
          example:
            config-123abc:
              templates_synced: 8
              templates_created: 3
              templates_updated: 4
              templates_removed: 1
            config-456def:
              templates_synced: 7
              templates_created: 2
              templates_updated: 4
              templates_removed: 1
        affected_whatsapp_config_ids:
          type: array
          items:
            type: string
            format: uuid
          example:
            - config-123abc
            - config-456def
          description: List of WhatsApp config IDs affected by this sync
        anchor_whatsapp_config:
          $ref: '#/components/schemas/WhatsappConfig'
          description: The WhatsApp configuration used as anchor for this sync
    Error:
      type: object
      properties:
        error:
          type: string
          example: Resource not found
        status:
          type: integer
          example: 404
        message:
          type: string
          example: The requested resource could not be found
    WhatsappConfig:
      type: object
      description: >
        WhatsApp configuration resource returned by the External API.

        Sensitive write-only fields like `webhook_verify_token`,
        `webhook_destination_url`,

        and `access_token` are intentionally omitted from responses.
      properties:
        id:
          type: string
          example: config-123abc
        name:
          type: string
          example: Client WhatsApp
        display_name:
          type: string
          example: Client WhatsApp (+1234567890)
        phone_number_id:
          type: string
          example: '1234567890'
        business_account_id:
          type: string
          example: '98765432109'
        kind:
          type: string
          enum:
            - production
            - sandbox
          example: production
          description: Configuration environment type
        display_phone_number:
          type: string
          example: +56 9 61461262
          description: Formatted phone number for display purposes
        display_phone_number_normalized:
          type: string
          example: '56961461262'
          description: Normalized phone number without + prefix
        is_coexistence:
          type: boolean
          description: Indicates whether coexistence mode is enabled for this phone number
        webhook_verified_at:
          type: string
          format: date-time
          nullable: true
          description: Timestamp of the last successful webhook verification
        customer_id:
          type: string
          format: uuid
          example: customer-456def
        inbound_processing_enabled:
          type: boolean
          example: true
          description: Whether inbound message processing is enabled for this configuration
        calls_enabled:
          type: boolean
          example: false
          description: Whether voice calling is enabled for this configuration
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key required for all endpoints

````