# Klaviyo

Connect Klaviyo as a data source: the public and private API keys it needs, the contacts, lists, segments and events it imports periodically, the real-time contact and flow-event URLs for your Klaviyo flows, how its fields map to Instasent attributes, and how its marketing status is imported as consent.

**Language:** en
**Audience:** platform
**Translation key:** platform.data-sources.connectors.klaviyo
**Search keywords:** Klaviyo, API key, public key, private key, contacts, events, periodic sync, sync frequency, import interval, real-time events, Klaviyo flow, webhook action, lists, segments, connect Klaviyo, Klaviyo integration, Klaviyo consent, email marketing, Klaviyo unsubscribe, SMS opt-out, unsubscribed
**Related pages:** /platform/es/data-sources/connectors/klaviyo, /platform/en/data-sources/connectors, /platform/en/data-sources/managing, /platform/en/consent
**Docs index (every page):** https://docs.instasent.com/llms.txt
**This zone's index:** https://docs.instasent.com/platform/en/llms.txt
**This page:** https://docs.instasent.com/platform/en/data-sources/connectors/klaviyo/ (HTML) · https://docs.instasent.com/platform/en/data-sources/connectors/klaviyo.md (Markdown)
**Other language (es):** https://docs.instasent.com/platform/es/data-sources/connectors/klaviyo.md

Klaviyo is a native connector for email and SMS marketing data. Once connected, it
syncs your Klaviyo contacts and events into Instasent so you can segment and act on
them alongside the rest of your audience.

## How to connect

Klaviyo connects with an **[API key](/platform/en/data-sources/connectors#api-key)**:
you create the keys in Klaviyo first and paste them into Instasent. Klaviyo needs
**two keys** — a **Public API Key** and a **Private API Key**.

> **Warning**: You have to create the API keys in your Klaviyo account **before** connecting. The
> panel won't let you continue without them — the **Connect** step won't advance until
> both keys are filled in.

#### 1. Create the API keys in Klaviyo

In your Klaviyo account settings, create (or copy) your **Public API Key** and a
**Private API Key**.

#### 2. Add the data source

In **Data sources**, select **Add data source** and choose **Klaviyo** from the
Integrations section.

#### 3. Enter your keys and connect

On the **Connect** step, fill in the **Connection name**, the **Public API Key** and
the **Private API Key**, then select **Connect to Klaviyo**.

#### 4. Initial import

The connector imports your existing contacts and events, then keeps importing them
periodically.

![The Klaviyo Connect step with the connection name and the public and private API key fields](/platform/en/data-sources/images/klaviyo--1-connect-step.png)
*The Connect step: enter a connection name, the Public API Key and the Private API Key, then select Connect to Klaviyo.*

After connecting, the wizard continues through **Mapping**, **Merge** and **Tags**, the
same steps as a CSV import.

## What it syncs

- **Contacts** — your Klaviyo profiles, with their identifiers and attributes.
- **Lists and segments** — the Klaviyo lists and segments each contact belongs to.
- **Events** — activity such as purchases, started checkouts and abandoned carts.

Klaviyo doesn't send each change the moment it happens: Instasent imports your Klaviyo
data periodically, and how often depends on your plan. The data source in the panel
says so: *We sync your Klaviyo data into Instasent periodically; how often depends on
your plan.* Lists and segments can lag a little more, because Klaviyo limits how fast
they can be read; Instasent re-reads all your contacts every so often to bring them up
to date, and the data source shows its sync status. The direction is one-way, **from
Klaviyo into Instasent**, and contacts unify by email and phone — see
[unification](/platform/en/data-sources/managing#how-unification-works).

Events imported periodically start your [flows](/platform/en/automations/flows) like
any other event, only up to one import interval after they happened. For a flow that
reacts to something the person has just done, such as an abandoned cart, keep its
first wait longer than that interval; see
[Sources that import their events every so often](/platform/en/automations/flows/templates#sources-that-import-their-events-every-so-often).
For a contact or an event that has to reach Instasent at once, use the real-time URLs
below.

## Real-time updates from your Klaviyo flows

Besides the periodic import, you can have a Klaviyo flow send a contact to Instasent the
moment it reaches a step of that flow. It is optional and set up from Klaviyo. In the
Klaviyo data source, **Setup instructions** shows two sections, each with its **Webhook
URL** and a **Payload sample**; in Klaviyo, add a webhook action to the flow and paste
that URL and payload.

- **Realtime contact update** — when the flow reaches the action, Instasent reads that
  contact's latest data from Klaviyo and updates it. Useful when a contact joins a
  Klaviyo list or changes any data.
- **Realtime flow event** — updates the contact the same way and also records an event
  for them, which can start an Instasent flow straight away. By default it is a flow
  event (`automation_flow`) carrying the values you send, such as the flow's name and a
  link to use in the SMS; you can name another event instead, such as a coupon created
  (`ecommerce_coupon_created`) with its code and percentage.

The payload identifies the contact with Klaviyo's own ID, `{{ person.KlaviyoID }}`:

```json
{
  "contact_id": "{{ person.KlaviyoID }}",
  "event": "automation_flow",
  "parameters": { "name": "Flow name", "id": "SMS-1", "url": "https://url-to-use-in-the-sms.com" }
}
```

Only the contacts and events your Klaviyo flows send this way arrive in real time;
everything else keeps arriving with the periodic import. That is why a flow template that
listens to Klaviyo still shows the import warning and lengthens its first wait even when you
use these URLs: Instasent can't tell which events your Klaviyo flows send. How to add the action in Klaviyo
is in [Klaviyo's guide to webhook actions](https://developers.klaviyo.com/en/docs/how_to_add_a_webhook_action_to_a_flow).

## Field mapping

Klaviyo profile fields map to the matching Instasent attributes (email to `_email`,
phone to `_phone_mobile`, and so on), and events arrive with their parameters. You
confirm the mapping on setup; see
[field mapping](/platform/en/data-sources/managing#field-mapping).

## Consent mapping

Klaviyo keeps each profile's marketing consent separately for **email** and for **SMS**, and
Instasent imports both, each on its own channel: Klaviyo's email consent sets the email
preference, and its SMS consent sets the SMS preference, which also covers RCS.

| Klaviyo consent (email or SMS) | Instasent value on that channel | Meaning            |
| ------------------------------ | ------------------------------- | ------------------ |
| Subscribed                     | `true`                          | Accepted marketing |
| Never subscribed, or no status | `null`                          | No preference      |
| Unsubscribed                   | `false`                         | Declined marketing |

A contact who unsubscribed from SMS or from email in Klaviyo is imported as **declined** on that
channel, so your sends on that channel under the **No opt-out** and **Opt-in** policies leave
them out; a **Basic** send still reaches them, because Basic ignores the marketing preference
(see [Compliance policies](/platform/en/campaigns/compliance-policies)). The opt-out holds even if another data source records the contact as subscribed,
because the opt-out wins when sources disagree; only a choice made in Instasent itself, by the
contact or by your team, overrides it (see [When your sources disagree](/platform/en/consent/marketing-preference-vs-suppression#when-your-sources-disagree)).

The general rules every connector follows are in [How connectors import consent](/platform/en/data-sources/connectors#how-connectors-import-consent).

---

This is one page of the Instasent documentation. For the complete machine-readable index of every guide and API reference, fetch https://docs.instasent.com/llms.txt — start there for full context.
