HomeGuidesAPI Reference
ChangelogHelp CenterCommunityContact Us
Guides
These docs are for v2022-10-17. Click to read the latest docs for v2024-10-15.

Export data from Klaviyo

Learn how to export data from Klaviyo, including how to integrate Klaviyo with a data warehouse.

❗️

This guide refers to Klaviyo's v1/v2 legacy APIs.

We are in the process of updating these guides, please check back later! For more information about the differences between legacy and new APIs, check out the comparison chart and [new API overview] (ref:api_overview).

Data objects

When understanding how to export data from Klaviyo and sync it into another system, it helps to first understand Klaviyo’s data model (i.e., what data Klaviyo collects and how it’s organized). 

Metrics, as the key data object representing a given person’s activity and engagement with your brand and messaging, are the most commonly requested data objects to export from Klaviyo. Metrics are actions represented as timestamped records that include JSON-formatted payloads that can contain an unlimited quantity of key-value pairs, including arrays and further-nested JSON. Klaviyo automatically records Metrics for email, push, and SMS-related activity such as "Received Email", "Opened Email", "Clicked Email", and more. Some other common objects that may be exported include Profiles, Lists, and Unsubscribes.

Exporting data

You can find a complete list of our available APIs for exporting Klaviyo data on our API docs. Here are some of our more frequently used export APIs:

Example: how to export data

Klaviyo exposes data for export through REST APIs associated with these data objects. You can use these to extract information, optionally using parameters to refine the information returned. As an example, a simple curl request to retrieve a list of each unique metric observed in the account via the Klaviyo Metrics API would look like this:

curl https://a.klaviyo.com/api/v1/metrics -G \
  -d api_key=api_key

The GET call returns a JSON object with all the fields of the specified dataset as a reply. In this illustrative example, the account has two unique metrics. The resulting JSON might look like:

{
  "end": 2,
  "object": "$list",
  "page_size": 50,
  "start": 0,
  "total": 3,
  "data": [
    {
      "updated": "2019-02-05 17:31:37",
      "name": "Active on Site",
      "created": "2019-02-05 17:31:37",
      "object": "metric",
      "id": "H7wi5R",
      "integration": {
        "category": "API",
        "object": "integration",
        "id": "7FtS4J",
        "name": "API"
      }
    },
    {
      "updated": "2019-02-05 17:31:37",
      "name": "Viewed Product",
      "created": "2019-02-05 17:31:37",
      "object": "metric",
      "id": "JgV8XH",
      "integration": {
        "category": "API",
        "object": "integration",
        "id": "7FtS4J",
        "name": "API"
      }
    },
    {
      "updated": "2019-10-01 02:57:11",
      "name": "Received Email",
      "created": "2019-10-01 02:57:11",
      "object": "metric",
      "id": "QhG7U2",
      "integration": {
        "category": "Internal",
        "object": "integration",
        "id": "0rG4eQ",
        "name": "Klaviyo"
      }
    }
  ]
}

Use case: integrating Klaviyo with a data warehouse

If you’d like to extract data from Klaviyo to a data warehouse or internal system, the general integration process is as follows:

StepDescription
Specify data to extractDocument the data objects and any filtering criteria that you want to apply when extracting the data. For example, if you are interested in syncing Klaviyo-originated metrics into another system, it would look like:
Data objects: Metrics
Filtering criteria: All Metrics where “integration.name” equals “Klaviyo”
Test and validate API requestsAfter documenting the data to extract, we recommend identifying the Klaviyo API endpoints that return the desired data and using Klaviyo’s sample API requests to fetch and validate the data, then define the logical steps for automation. Using the example above, it might look like this:
Step 1: GET request to https://a.klaviyo.com/api/v1/metrics in order to get a list of all unique metrics.
Step 2: GET request to https://a.klaviyo.com/api/v1/metric/{metric\_id}/export for each metric_id of interest
Map source data to destinationOnce you know the data that you want to extract and how to extract it, you must map Klaviyo’s data structure into your data warehouse or other internal system. Klaviyo’s APIs return JSON formatted data, so if your warehouse or other business system requires another format, you may need to manipulate the output to conform to destination expectations.
Build ETL (or use a pre-built connector)Once you have the specifications for extracting data and mapping it to your target destination, the next step is to author the code that will automate the extract, transfer, and load (ETL) logic. You may benefit from using an open-source tool such as a Singer tap to achieve this.
If you prefer to avoid this step, you may opt for a tool with a pre-built Klaviyo integration such as Segment.com, Stitch Data, or Fivetran.
Perform QAAfter automating the ETL, you will want to validate that data flows through as expected.

Additional resources