---
title: "Sync templates from WhatsApp"
method: POST
path: "/v1/templates/sync"
---

# Sync templates from WhatsApp

`POST /v1/templates/sync`

Reconcile this project's templates against WhatsApp. Two things happen per connected WhatsApp Business Account: templates that exist on Meta but not in Zavu are imported (or linked to an existing template with the same name), and the approval status of the templates Zavu already knows about is refreshed from Meta.

This is what to call when a template was created outside Zavu — in Meta Business Manager, or by another tool — or when a `template.status_changed` webhook was missed and a template is stuck in `pending`. Status changes normally arrive by webhook; this endpoint is the recovery path and the only path for a template Zavu never created.

Templates that Meta reports as rejected or disabled are not imported; they are counted in `skipped`. Existing local templates are matched first by Meta template ID, then by name.

By default every sender in the project with a WhatsApp Business Account is synced. Pass `senderId` to sync only that sender's account. The call is synchronous — it waits for Meta and returns what changed — so it can take a few seconds per account. A failure on one account does not fail the request: it is reported in `errors` and the remaining accounts are still synced.

## Request body

- object
  - `senderId` string — Sync only the WhatsApp Business Account attached to this sender. If omitted, every WhatsApp sender in the project is synced.

## Response `200`

Sync completed. Counts are totals across every account synced.

- object
  - `accountsSynced` integer, required — WhatsApp Business Accounts reconciled in this call.
  - `imported` integer, required — Templates that existed on Meta and were created in Zavu by this call.
  - `linked` integer, required — Existing Zavu templates that were matched to a Meta template by name and bound to its Meta ID.
  - `updated` integer, required — Templates whose approval status changed to match Meta.
  - `skipped` integer, required — Meta templates left alone: already linked to a Zavu template, or rejected/disabled on Meta.
  - `errors` string[], required — Problems hit while syncing. Non-empty with a 200 means part of the sync did not complete — the rest still did.

## Other responses

- `400` — No sender in the project has a WhatsApp Business Account connected, or the given sender has none.
- `401` — Unauthorized.
- `404` — Sender not found.

---

[API](https://skmtc.net/zavudev/apis/zavu-unified-messaging-layer-api.md) · [All operations](https://skmtc.net/zavudev/apis/zavu-unified-messaging-layer-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/zavudev/zavu-unified-messaging-layer-api/revisions/4dacdff2adf8/schema)
