# Start history sync

> Initiate message history sync from the WhatsApp Business App. This sends a request to the account owner to approve sharing their conversation history. Only available for coexistence accounts with active status.

`POST https://api.zavu.dev/v1/senders/{senderId}/whatsapp-sync/history`

Initiate message history sync from the WhatsApp Business App. This sends a request to the account owner to approve sharing their conversation history. Only available for coexistence accounts with active status.

## Parameters

- `senderId` (path, string, required)

## Responses

### 202

History sync initiated.

- `message` (string, required): Success message.
- `sync` (object, required): WhatsApp coexistence sync status.
  - `isCoexistence` (boolean, required): Whether the account is in coexistence mode.
  - `status` (string, required): WhatsApp account status. One of: `pending_verification`, `pending_registration`, `active`, `disconnected`, `error`.
  - `history` (object, required): History sync status details.
    - `status` (string, required): Status of WhatsApp message history sync. One of: `not_requested`, `pending`, `syncing`, `completed`, `rejected`.
    - `canSync` (boolean, required): Whether history sync can be initiated.
    - `requestedAt` (string<date-time>, nullable): When the sync was last requested.
    - `completedAt` (string<date-time>, nullable): When the sync was completed.
  - `contacts` (object, required): Contacts sync status details.
    - `status` (string, required): Status of WhatsApp contacts sync. One of: `not_requested`, `pending`, `syncing`, `completed`.
    - `canSync` (boolean, required): Whether contacts sync can be initiated.
    - `requestedAt` (string<date-time>, nullable): When the sync was last requested.

### 400

Invalid request.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 401

Unauthorized.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 404

Sender not found.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

## Example

```bash
curl -X POST "https://api.zavu.dev/v1/senders/sender_abc123/whatsapp-sync/history" \
  -H "Authorization: Bearer $ZAVUDEV_API_KEY"
```

```typescript
import Zavudev from "@zavudev/sdk";

const zavu = new Zavudev({ apiKey: process.env.ZAVUDEV_API_KEY });

const result = await zavu.senders.whatsappSync.startHistorySync("sender_abc123");

console.log(result);
```
