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

# Connect Klaviyo

> Sync Mailkick emails to Klaviyo Templates

This integration lets you **push your Mailkick email HTML** to **Klaviyo Templates**.

## Prerequisites

* You must be a **workspace admin**.
* You need a **Klaviyo account**.

## Step 1 — Connect Klaviyo

1. Open **Settings → Integrations**
2. Select **Klaviyo**
3. Click **Connect with Klaviyo**
4. You will be redirected to Klaviyo to authorize the application
5. Once authorized, you'll see "Klaviyo Connected" in Mailkick

## Step 2 — Sync an email

1. Open an email in the editor
2. Click **Export**
3. Click **Sync to Klaviyo**

After a successful sync, you'll get a Klaviyo editor link like:

* `https://www.klaviyo.com/email-editor/{template_id}/edit`

## How sync works

When you sync an email to Klaviyo:

1. **First sync** → Creates a new Template
2. **Subsequent syncs** → Updates the existing template (idempotent via content hash)
3. **Template deleted on Klaviyo** → Mailkick automatically recreates it

<Info>
  Mailkick uses content hashing to avoid unnecessary API calls. If the HTML hasn't changed, no update is sent.
</Info>

## Using Klaviyo variables

Klaviyo Templates support **Django-style** variables. In your email, you can use:

```django theme={null}
Hello {{ first_name|default:"there" }},

Your order #{{ order_id }} has been shipped!
```

These variables will be resolved when you send via Klaviyo Flows or Campaigns.

## Common issues

| Error                    | Cause                      | Solution                                                     |
| ------------------------ | -------------------------- | ------------------------------------------------------------ |
| `klaviyo_not_configured` | Integration not connected  | Click "Connect with Klaviyo" in Settings → Integrations      |
| `klaviyo_sync_failed`    | API error or expired token | Try disconnecting and reconnecting the integration           |
| `klaviyo_http_401`       | Token expired              | Disconnect and reconnect the integration                     |
| `klaviyo_http_403`       | Insufficient permissions   | Ensure your Klaviyo user has permissions to manage templates |
