Klaviyo API: Complete Guide

Quick Summary:

The Klaviyo API lets you send custom events, sync profile data, and build integrations beyond the pre-built app connections -- essential for anything not covered by Shopify, WooCommerce, or similar native integrations.

What Is the Klaviyo API?

The Klaviyo API is a REST API letting external systems send events, create and update profiles, and manage lists/segments programmatically. This is what powers custom integrations beyond the pre-built ecommerce platform connections -- any system with data relevant to customer behavior can feed it into Klaviyo through the API.

Public vs Private Keys

Key Types

Public API Key:
  Safe for client-side use (browser tracking script)
  Limited to specific write operations

Private API Key:
  Full account access based on scopes granted
  Server-side only, never expose in client code

How to Get Started

  1. Go to Settings → API Keys and generate a private key with the scopes your integration needs.

  2. Review the current API version documentation for the endpoints relevant to your use case.

  3. Build and test event tracking or profile sync in a development environment first.

  4. Implement error handling for rate limits and authentication failures.

  5. Deploy, and monitor via Klaviyo's API logs for unexpected errors.

A Real-World Example

A company's custom-built loyalty program tracks points earned and redeemed outside of any standard ecommerce platform. Using the API, every points transaction is sent to Klaviyo as a custom event, letting the marketing team build segments and flows based on loyalty tier -- data that wouldn't exist in Klaviyo without this custom integration.

🚫 Common Mistake

Exposing a private API key in client-side code (a website's JavaScript, a mobile app bundle). Private keys grant broad account access -- if exposed, anyone can read that key from the browser's network requests or the app's compiled code.

Frequently Asked Questions

Where do I get a Klaviyo API key?

Go to Settings -> API Keys within your Klaviyo account to generate a private API key, which is required for most server-side integration work.

What\'s the difference between a public and private API key?

The public key is safe to expose client-side (used for tracking events from a website), while the private key grants broader account access and must be kept confidential, used only in secure server-side code.

What API version should new integrations use?

New integrations should use the current stable version (Klaviyo's v3 API), since older versions are on a deprecation path and won't receive new features.

Are there rate limits on Klaviyo API calls?

Yes, rate limits apply and vary by endpoint and plan -- high-volume integrations should review current limits and design for graceful handling of rate-limit responses.

Can the API create custom events, not just use pre-built ones?

Yes, custom events can be sent via the API, letting you track business-specific behavior beyond Klaviyo's default ecommerce events.

Can I update profile properties via the API?

Yes, profile creation and updates are core API capabilities, letting external systems keep Klaviyo profiles in sync with data living elsewhere.

Does the API support triggering campaigns programmatically?

Yes, campaign-related endpoints exist, though most day-to-day marketing sends are still typically managed through the Klaviyo UI rather than API-triggered.

What programming languages have official Klaviyo API support?

Klaviyo provides official SDKs for several popular languages, and since it's a REST API, any language capable of making HTTP requests can integrate, officially supported or not.

Why am I getting a 401 error when calling the API?

Almost always an authentication issue -- an invalid, expired, or incorrectly-formatted API key, or missing the required Authorization header format.

Can I use the API to build a fully custom integration beyond Shopify/WooCommerce?

Yes, this is exactly what the API is for -- any platform or custom system can integrate with Klaviyo through the same REST API used by official app integrations.