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

# Klaviyo

> Connect Klaviyo with OAuth to import your existing templates and push AlpacaRelay designs back as HTML templates.

Connecting Klaviyo lets you import templates from your Klaviyo account and push AlpacaRelay designs back out as HTML templates you can use in campaigns and flows.

<Info>
  New to integrations? The [overview](/integrations/overview) explains the import and export flows that are the same for every provider. This page covers what's specific to Klaviyo.
</Info>

## What you need

* A Klaviyo account you can sign in to.
* Permission to authorize apps on that account.

Klaviyo connects with OAuth, so you sign in and approve access rather than pasting a key.

<Warning>
  Don't use a Klaviyo private API key. Private keys are account-wide secrets with far broader access than this integration needs, and AlpacaRelay's connection flow doesn't accept them. Use the OAuth flow below.
</Warning>

## Connect Klaviyo

<Steps>
  <Step title="Open Connected apps">
    Go to **Settings** → **Connected apps**, then click **Connect app**.
  </Step>

  <Step title="Choose Klaviyo">
    Klaviyo's authorization page opens. If you see a form asking for an API key instead, stop — that isn't the intended flow. Reach out to support.
  </Step>

  <Step title="Review and approve the permissions">
    Klaviyo shows exactly what you're granting:

    | Permission      | Why it's needed                                                     |
    | --------------- | ------------------------------------------------------------------- |
    | Read accounts   | Confirms the connection works and shows which account you connected |
    | Read templates  | Lists your templates so you can import them                         |
    | Write templates | Creates and updates templates when you export a design              |

    AlpacaRelay asks for nothing beyond these — no profile, list, segment, or campaign access.
  </Step>

  <Step title="Check the badge">
    Klaviyo appears in your connected apps with a **Connected** badge and your Klaviyo company name.
  </Step>
</Steps>

<Note>
  If AlpacaRelay later adds Klaviyo features that need more access, you'll be asked to reconnect. Klaviyo permissions are fixed at the moment you authorize — a connection made today never silently gains new access.
</Note>

## Export a design to Klaviyo

Save the email, then open **Send to app** from the editor's name dropdown or the **⋯** menu on an email card, and click **Create template** on the Klaviyo row.

The design is pushed as an **HTML template** — Klaviyo's code-based template type, not a drag-and-drop one. That's what preserves the design exactly as you built it. You can use it in a campaign or a flow email like any other Klaviyo template.

**Re-sync** updates the same template in place, so flows already pointing at it pick up the new design.

<Warning>
  Because the export is an HTML template, editing it inside Klaviyo's drag-and-drop editor isn't available — Klaviyo opens it in its code editor. Make design changes in AlpacaRelay and re-sync, rather than editing on both sides.
</Warning>

## Import a template from Klaviyo

Click **Import** when creating an email, choose **Klaviyo** under **Integrations**, and pick a template.

Klaviyo has no folders or tags for templates, so the picker groups them by editor type instead. HTML and code-based templates import most reliably. Klaviyo's API doesn't expose template thumbnails, so rows show names without previews.

Where Klaviyo doesn't return raw HTML for a template, AlpacaRelay renders the template first and imports the result. Templates it can't produce usable HTML for at all are greyed out with the reason on hover.

Klaviyo tags such as `{{ first_name|default:'there' }}` import as literal text. AlpacaRelay doesn't interpret them, so they stay intact and still resolve when Klaviyo sends.

## Troubleshooting

<AccordionGroup>
  <Accordion title="The connection flipped to Needs attention">
    Access was revoked on Klaviyo's side, or the authorization expired. Click **Reconnect** and approve again.
  </Accordion>

  <Accordion title="Klaviyo asked me for an API key">
    That's the wrong connection path — the integration is OAuth-only. Don't paste a private key; contact support instead.
  </Accordion>

  <Accordion title="An exported template won't open in the drag-and-drop editor">
    Expected. Exports are HTML templates, which Klaviyo opens in its code editor. Edit in AlpacaRelay and re-sync.
  </Accordion>

  <Accordion title="A template I can see in Klaviyo isn't in the picker">
    The picker filters by editor type — check the other views. Drag-and-drop templates that expose no usable HTML are listed but greyed out.
  </Accordion>
</AccordionGroup>
