How to Use the Klaviyo API?

I have been using Klavito API since 2020, and it has opened dozens of opportunities for me. The API provides access to get involved in advanced automation, integration with your favorite third-party tools, and hyper-personalised marketing.

The Klaviyo API supports custom analytics pipelines, allows direct CRM data synchronization, and enables server-side event triggering with minimal setup effort.

Keep on reading, and all required setup, endpoints, and best practices are explained.

What is Klaviyo API?

Klaviyo API is a programmatic interface that allows external systems to exchange data with the Klaviyo marketing platform. Klaviyo API supports customer profile creation, event tracking, list management, and campaign data access. 

Developers use the Klaviyo API to connect websites, mobile applications, backend systems, and custom tools with Klaviyo data models.

v2 (Legacy)

v2 Legacy API is the older Klaviyo API version that uses static endpoints and private API keys for authentication. v2 Legacy API supports basic actions such as event tracking, profile updates, and list management. 

Klaviyo recommends limited use of v2 Legacy API due to long-term maintenance constraints and reduced structural consistency.

v2023-10-15

v2023-10-15 API is the current Klaviyo API version, built on resource-based architecture and stronger authentication standards. v2023-10-15 API supports clearer endpoint definitions, improved data validation, and predictable version control. 

This version aligns with long-term platform stability and scalable data integration practices.

Core Features of Klaviyo API

  • Profile Management: Profile Management allows systems to create, update, and sync customer profile data such as email address, phone number, and custom properties inside Klaviyo.
  • List and Segment Management: List and Segment Management supports adding, removing, and organizing contacts into static lists and dynamic segments based on defined conditions.
  • Event Tracking: Event Tracking records customer actions such as purchases, page views, and form submissions to trigger flows and behavioral campaigns.
  • Webhook Support: Webhook Support sends real-time event notifications from Klaviyo to external systems when specific actions occur.
  • Campaign Analytics: Campaign Analytics provides access to performance data such as sends, opens, clicks, and conversions for reporting and analysis.

Types of API Key

Public API Key

  • Locate Your Key: Access your Public API Key by navigating to Account > Settings > API Keys in your Klaviyo dashboard.
  • Purpose of the Key: Use this key for client-side tracking, such as logging page visits with klaviyo.js or capturing front-end actions like “Add to Cart.”
  • Access Permissions: The Public API Key allows interaction with limited endpoints only:
    • /identify
    • /track
    • /subscribe
  • Visibility and Security: This key is visible in browsers. Do not use it to handle sensitive customer data.
  • Key Maintenance: To ensure security, Klaviyo recommends rotating your Public API Key every 90 days.

Private API Key

  • Locate Your Key: Find your Private API Key under Account > Settings > API Keys in your Klaviyo account.
  • Purpose of the Key: It is suitable for secure server-side environments, including Forebase, AWS, or backend automation tools like Zapier.
  • Access Permissions: The Private API Key allows access to almost all API endpoints, such as:
    • /profiles
    • /events
    • /lists
    • /segments
    • /campaigns
    • /flows
  • Capabilities: Private API Keys support full CRUD operations (Create, Read, Update, Delete) for comprehensive management.
  • Security Guidelines: Never expose Private API Keys in client-side code. You can restrict key scopes to read-only or full access depending on integration needs.

OAuth 2.0

  • Purpose of OAuth 2.0: OAuth 2.0 is designed for developers building apps that connect multiple Klaviyo accounts. It provides secure, permission-based access to user data.
  • Authentication Process: Users log in with their Klaviyo credentials and grant your app a token. This token allows the app to perform API requests on behalf of the user.
  • Security and Scalability: OAuth 2.0 offers higher security and better scalability than traditional API keys, especially for external applications.
  • Implementation: Developers can follow Klaviyo’s OAuth documentation to manage authentication flows, tokens, and permissions efficiently.

Best Use Cases of Klaviyo API

CRM or Loyalty Data Sync

Klaviyo API allows syncing customer profiles, purchase history, and loyalty program points from external CRMs.

How to use:

  1. Access Private API Key under Account > Settings > API Keys.
  2. Use /profiles endpoint to create or update customer data.
  3. Map loyalty points or CRM attributes to Klaviyo custom fields.
  4. Schedule API calls via backend or automation tools like Zapier for real-time updates.

Custom Dashboard Reporting

The API can extract campaign performance, customer behavior, and engagement metrics for custom dashboards.

How to use:

  1. Generate a Private API Key.
  2. Use endpoints like /events, /lists, and /campaigns to fetch data.
  3. Pull data into tools like Google Data Studio or Tableau.
  4. Automate daily or weekly API calls to maintain updated dashboards.

Server‑Side Event Tracking

Track conversions, purchases, and other actions from the server to improve accuracy and reliability.

How to use:

  1. Use a Private API Key in your server environment.
  2. Call /track endpoint to log events such as purchases or form submissions.
  3. Include customer identifiers to match events with existing profiles.
  4. Automate tracking for each relevant server-side action.

Automate SMS Campaigns

Send targeted SMS messages triggered by specific user actions or segments.

How to use:

  1. Use /profiles and /lists endpoints to segment subscribers.
  2. Trigger SMS via /flows or /campaigns endpoints using server-side events.
  3. Automate recurring campaigns or triggered messages through backend scripts.
  4. Monitor responses and engagement via /events endpoint.

Product/Inventory Sync

Keep Klaviyo updated with the latest product details, pricing, and stock levels.

How to use:

  1. Access Private API Key.
  2. Use /catalog or custom endpoints to push product updates.
  3. Schedule automatic updates from your e-commerce platform.
  4. Map product attributes to dynamic tags in emails for personalized campaigns.

Sync Subscription Statuses

Track opt-ins, cancellations, and preference updates in real time.

How to use:

Use /subscribe and /profiles endpoints with Public or Private API Key, depending on the environment.

  1. Update email or SMS subscription status automatically.
  2. Reflect changes in Klaviyo lists or segments for targeted communication.
  3. Ensure opt-out events are logged to comply with privacy rules.

Personalize Emails with Dynamic Tags

Enhance email content by including customer-specific data, like names, products, or loyalty points.

How to use:

  1. Store dynamic data in profile custom fields via API.
  2. Use /profiles or /lists endpoints to update fields programmatically.
  3. Insert dynamic tags in email templates using Klaviyo’s template editor.
  4. Automate updates to ensure emails always reflect the latest user data.

F.A.Q

A developer is recommended for API integration to handle server-side authentication and automate workflows. Non-developers can use low-code tools like Zapier for basic tasks.

V2 is the legacy API with basic endpoints, while V2023-10-15 provides updated endpoints, improved security, and expanded functionality. Newer API versions support advanced features like flows and enhanced event tracking.

Yes, you can use sandbox or test environments to simulate API calls and verify logic without impacting production data. Always use test profiles or staging setups for safety.

Yes, Klaviyo supports webhooks to receive real-time notifications for events such as subscriptions, unsubscribes, and order updates. Webhooks complement API usage for automated workflows.

Use Private API Keys on the server, restrict scopes, rotate keys regularly, and avoid exposing keys in client-side code. Follow OAuth 2.0 for external applications that require access to multiple accounts.

Check Also

  • Klaviyo Vs Brevo

    Different email marketing tools have their own pros and cons. In such a case, if we take Klaviyo vs Brevo, then we can see some interesting comparisons. However, Brevo is famous for its affordability and simplicity to use features, while Klaviyo is famous among e-commerce users due to its e-commerce-based features. But both tools have…

  • Klaviyo Pricing

    Pricing plans are one of the first things that marketers pay attention to. Many tools come with affordable pricing plans, and some have higher pricing tags. For Klaviyo, I have compiled a detailed review with a guide on its pricing plans. Let me explain each plan with its core features. This will help you to…

  • Klaviyo Integration Guide

    Connecting marketing platforms without data loss decides campaign accuracy before the first email is sent. Klaviyo integration solves this issue by centralizing customer data from e-commerce platforms, payment systems, and customer support tools into one marketing database.  Klaviyo supports native integrations with Shopify, WooCommerce, BigCommerce, Magento, and over 300 third-party applications. These integrations sync real-time…

  • Klaviyo F.A.Q

    With my years of experience with Klaviyo, I have created this F.A.Q page. Here you can find all the questions and answers that you may have been looking for for many years. All these answers are based on my personal hands-on experience. Let’s start this session of questions and answers, and let me answer your…