Back

Klaviyo API Essential Guide

Aug 11, 20246 minute read

What type of API does Klaviyo provide?

API Type

  • Klaviyo uses a REST API with JSON:API specification

Key Features

  • JSON:API provides many benefits similar to GraphQL, while maintaining the familiarity of REST
  • Supports relationships between resources, allowing efficient querying of related data
  • Offers filtering capabilities using JSON:API syntax
  • Provides versioning and deprecation policies

Authentication

  • Uses private API keys for /api endpoints
  • Uses public API keys (company ID) for /client endpoints
  • Supports OAuth for tech partners integrating with Klaviyo

Documentation and Tools

  • Provides OpenAPI specification
  • Offers SDKs and a Postman workspace for testing API calls
  • Provides detailed documentation on JSON:API features, filtering, and other capabilities

Best Practices

  • Use API scopes to restrict access for third parties using private API keys
  • Refer to the API comparison chart when transitioning from deprecated v1/v2 endpoints to new API endpoints
  • Review the updated API versioning and deprecation policy for effective API usage management

Does the Klaviyo API have webhooks?

Klaviyo Webhooks

Yes, the official Klaviyo API does have webhooks. Klaviyo supports both receiving and sending webhooks.

Types of Events You Can Subscribe To

Klaviyo offers several webhook topics you can subscribe to, including:

  • list/subscribe
  • checkout/started
  • order/created

These are some examples seen in the API response for listing webhooks.

Key Points to Consider

  1. Klaviyo primarily receives data via webhooks from Klaviyo-built integrations.

  2. For custom integrations, you may need to use Zapier or another intermediary service to send data to Klaviyo.

  3. Klaviyo has recently added the ability to add webhook actions to Flows, allowing you to trigger events in other applications when a flow is triggered.

  4. There is an API endpoint for managing webhooks, including creating, listing, and deleting webhooks.

Best Practices

  1. Use the Klaviyo API documentation to explore available endpoints and functionality.

  2. Consider using Klaviyo Partners for custom integrations or complex setups.

  3. When working with webhooks, ensure you're using the correct content type headers (e.g., 'Content-Type: application/json').

  4. Be aware that while Klaviyo can receive data via webhooks, sending data from Klaviyo via webhooks may have limitations or require specific setups.

In summary, Klaviyo does offer webhook functionality, both for receiving data and, more recently, for sending data as part of Flows. The types of events you can subscribe to include list subscriptions, checkout events, and order creations, among others. For custom integrations, you may need to combine webhook usage with API calls or use intermediary services like Zapier.

Rate Limits and other limitations

Based on the search results provided, I don't have specific information about the API Rate Limits of the Klaviyo API. The search result doesn't contain any usable information as it appears to be an error message.

However, I can provide some general information about API rate limits and best practices:

What are API Rate Limits?

API rate limits are restrictions placed on the number of requests a client can make to an API within a specified time frame. These limits are implemented to:

  • Prevent abuse of the API
  • Ensure fair usage among all users
  • Protect the API's infrastructure from being overwhelmed

Key Points to Consider

  • Rate limits are typically expressed as a number of requests per time period (e.g., 100 requests per minute)
  • Different endpoints within an API may have different rate limits
  • Rate limits can be applied on a per-user, per-application, or per-IP basis

Best Practices

  1. Check the API documentation: Always refer to the official API documentation for specific rate limit information.

  2. Implement rate limiting in your code: Design your application to respect the API's rate limits.

  3. Use caching: Implement caching strategies to reduce the number of API calls you need to make.

  4. Handle rate limit errors gracefully: Implement proper error handling for when you hit rate limits.

  5. Use bulk operations: If available, use bulk endpoints to reduce the number of individual API calls.

To get accurate information about Klaviyo's API rate limits, I recommend checking their official API documentation or contacting their support team directly.

Latest API Version

Based on the search results provided, here are the key points regarding the most recent version of the Klaviyo API:

Latest API Version

The most recent version of the Klaviyo API uses a date-based versioning system. The latest stable version is not explicitly stated, but it appears to be a date in the format YYYY-MM-DD [1].

Key Points to Consider

  1. Klaviyo has introduced new and improved APIs, which are available alongside the legacy v1/v2 APIs [1].

  2. The v1/v2 legacy APIs are scheduled to retire on June 30, 2024 [2].

  3. Klaviyo uses "revisions" for versioning, which are formatted as ISO 8601 dates (e.g., 2023-12-15) [2].

  4. Developers can specify the API version they want to use by including a "revision" header in their API requests [2].

  5. Beta versions of new APIs are available with the suffix ".pre" (e.g., 2024-02-15.pre) [2].

  6. Klaviyo provides developers 2 years to update their apps and integrations before a revision is retired [2].

Best Practices

  1. Use the latest stable version for new integrations and API usage [2].

  2. Regularly check the Klaviyo developer documentation for updates and new versions.

  3. Plan to migrate from v1/v2 APIs to the new date-versioned APIs before the retirement date [2].

  4. Monitor API usage and review which versions your applications are using [2].

  5. Subscribe to the Klaviyo developer newsletter to receive important updates about API changes [2].

In summary, while the exact latest version number is not provided, Klaviyo has moved to a date-based versioning system for their new APIs. Developers should use the most recent stable date version and plan to migrate from v1/v2 APIs before June 30, 2024.

How to get a Klaviyo developer account and API Keys?

To get a developer account for Klaviyo and create an API integration, follow these steps:

1. Create a Klaviyo Account

First, you need to create a Klaviyo account if you don't already have one:

  1. Go to the Klaviyo website (www.klaviyo.com)
  2. Click on the "Get Started" or "Sign Up" button
  3. Follow the registration process to create your account

2. Create a Test Account (Optional)

If you want to test your integration without affecting your main account, you can create a test account:

  1. Log in to your Klaviyo account
  2. Navigate to the account settings
  3. Look for an option to create a test or sandbox account

3. Obtain API Credentials

To use the Klaviyo API, you'll need to obtain your API credentials:

  1. Log in to your Klaviyo account
  2. Go to the account settings or developer section
  3. Look for "API Keys" or "API Credentials"
  4. Generate a new API key if necessary
  5. Make sure to securely store your API key, as it will be needed for authentication

4. Familiarize Yourself with Klaviyo's API Documentation

Before starting your integration:

  1. Visit the Klaviyo Developers website (developers.klaviyo.com)
  2. Review the API documentation, including the API overview and specific endpoints you'll be using
  3. Check out the getting started guide for developers

5. Choose Your Integration Method

Klaviyo offers multiple ways to integrate:

  • Use Klaviyo's SDKs for web and mobile platforms
  • Directly use the REST API
  • Implement server-side or client-side integration depending on your needs

6. Start Developing

With your API credentials and knowledge of the API:

  1. Set up your development environment
  2. Install any necessary libraries or SDKs
  3. Begin implementing your integration, starting with authentication
  4. Test your integration thoroughly

What can you do with the Klaviyo API?

Based on the information provided in the search results, here is a list of data models you can interact with using the Klaviyo API, along with what is possible for each:

Profiles

  • Represent people using email or customer ID as primary identifier
  • Support custom profile properties with various data types (strings, integers, floats, dates, booleans, arrays/lists, JSON)
  • Can be added to or removed from lists and segments
  • Can be created, updated, and retrieved via API

Metrics and Events

  • Events are actions undertaken by Profiles, represented as timestamped records with JSON-formatted payloads
  • Metrics are groupings for Events of the same name
  • Can record any type of timestamped action (client-side or server-side)
  • Can include associated information
  • Can be created and retrieved via API

Catalogs and Web Feeds

  • Represent products or product-like records (e.g., physical stores)
  • Can be referenced in message templates
  • Can be synced automatically via native integration, JSON web feed, or Catalogs API
  • Can be created, updated, and retrieved via API

Lists and Segments

  • Organize profiles into static lists and dynamic segments
  • Profiles can be assigned membership to multiple lists or no lists
  • Can be created and managed via API

Campaigns

  • Create and execute messaging campaigns sent to target audiences defined as lists or segments
  • Can be created in the UI or via API

Templates

  • Store content and design of messaging campaigns
  • Can contain HTML, CSS, and dynamic tags or logic using Django syntax
  • Can be created, updated, and retrieved via API

Coupons

  • Can be managed using the Coupons API
  • Collect and sync email and SMS consent via API

Forms

  • Custom trigger popup or flyout forms
  • Track form activity using JavaScript

Webhooks

  • Add webhook actions to flows
  • Work with system webhooks

This list covers the main data models and interactions possible with the Klaviyo API. Each of these models offers various operations such as creating, reading, updating, and in some cases, deleting data. The API also supports features like filtering, sorting, pagination, and relationship management between different data models.