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

# Sync message history to Chatwoot

> Initiates a background sync of WhatsApp message history to Chatwoot.
Messages from the configured number of days will be imported.
This endpoint requires CHATWOOT_ENABLED=true in configuration.




## OpenAPI

````yaml /openapi.yml post /chatwoot/sync
openapi: 3.0.0
info:
  title: WhatsApp API MultiDevice
  version: 9.7.0
  description: |
    This API is used for sending whatsapp via API.

    The web dashboard is a separate project (gowa-ui); the server downloads its
    latest release asset and serves it at `/` (or returns a JSON banner when
    APP_UI_ENABLED=false).

    Device scoping:
    - Send `X-Device-Id` on all device-scoped REST calls.
    - WebSocket: connect to `/ws?device_id=<id>`.
    - WebSocket auth (when basic auth is enabled): browsers cannot set an
      Authorization header on WebSocket connections, so also pass
      `&authorization=<base64(user:pass)>` in the query string. Use TLS in
      production since the credential is visible in the URL.
servers:
  - url: http://localhost:3000
security:
  - basicAuth: []
tags:
  - name: app
    description: Initial Connection to Whatsapp server
  - name: device
    description: Device management for multi-device support
  - name: user
    description: Getting information
  - name: send
    description: Send Message (Text/Image/File/Video).
  - name: message
    description: Message manipulation (revoke/react/update).
  - name: call
    description: Call management (reject incoming calls)
  - name: chat
    description: Chat conversations and messaging
  - name: group
    description: Group setting
  - name: newsletter
    description: newsletter setting
  - name: chatwoot
    description: Chatwoot integration for customer support
paths:
  /chatwoot/sync:
    post:
      tags:
        - chatwoot
      summary: Sync message history to Chatwoot
      description: |
        Initiates a background sync of WhatsApp message history to Chatwoot.
        Messages from the configured number of days will be imported.
        This endpoint requires CHATWOOT_ENABLED=true in configuration.
      operationId: chatwootSyncHistory
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                device_id:
                  type: string
                  description: Device ID to sync (uses CHATWOOT_DEVICE_ID if not specified)
                days_limit:
                  type: integer
                  default: 3
                  description: Number of days of history to sync
                include_media:
                  type: boolean
                  default: true
                  description: Include media attachments in sync
                include_groups:
                  type: boolean
                  default: true
                  description: Include group chats in sync
      responses:
        '200':
          description: Sync initiated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatwootSyncResponse'
        '400':
          description: Bad Request (device not found or Chatwoot not configured)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBadRequest'
        '409':
          description: Sync already in progress
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 409
                  code:
                    type: string
                    example: SYNC_ALREADY_RUNNING
                  message:
                    type: string
                    example: A sync is already in progress for this device
                  results:
                    type: object
                    properties:
                      progress: c0cb89a8-da89-44b1-a4ac-d68e8737e425
components:
  schemas:
    ChatwootSyncResponse:
      type: object
      properties:
        status:
          type: integer
          example: 200
        code:
          type: string
          example: SYNC_STARTED
        message:
          type: string
          example: History sync initiated in background
        results:
          type: object
          properties:
            device_id:
              type: string
              example: my-device-id
            days_limit:
              type: integer
              example: 3
            include_media:
              type: boolean
              example: true
            include_groups:
              type: boolean
              example: true
    ErrorBadRequest:
      type: object
      properties:
        code:
          type: string
          example: 400
          description: HTTP Status Code
        message:
          type: string
          example: field cannot be blank
          description: Detail error message
        results:
          type: object
          example: null
          description: additional data
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic

````

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