Search API Connector Documentation


Import Klaviyo Data to Google Sheets

In this article, we’ll walk through how to pull API data from Klaviyo into Google Sheets, using the API Connector add-on for Sheets.

The Klaviyo API is very awkwardly designed for reporting, as nearly every request involves first pulling IDs, then running a second (or third…) request to associate those IDs with metrics. This article will give a few examples showing how it works. The good thing is, you only need to set up your requests once and then can automate your reporting.


Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Get Your Klaviyo API Key

  1. From the dashboard, open the account menu in the top right and click Account.
  2. In the account menu, click Settings > API Keys
  3. Click Create Private API Key
  4. You’ll now see your API key. Copy that down as we’ll use it in all our requests.

Part 2: Example – Fetch Contacts in a List

The easiest way to get started with the Klaviyo API is through API Connector’s built-in integration.

  1. Select Klaviyo from the drop-down list of applications
  2. Select the /api/v2/lists to see the available lists in your account
  3. Under parameters, fill in the api_key parameter with your API key
  4. Run the request, and you will get back a table showing all of your lists and their respective IDs.
  5. You can now put those list IDs in a different API request to get all of the contacts in that list. Choose the /api/v2/group/{list_id}/members/all endpoint and enter in a list ID from the list_id field in the prior request.
  6. Click Run. Now you have a spreadsheet of all contacts from that particular list.

Part 3: Example – Fetch Campaign Metrics

For our second example, we’ll pull in some campaign metrics. Unfortunately there’s no simple endpoint to get a report containing standard metrics like open rates, click rates, bounce rates, and so on, for a list of campaigns. Instead we’ll need to fetch our metric IDs, and then pull in metrics one by one. Here’s how it works:

  1. Select the /api/v1/metrics endpoint to get a list of all the metric IDs available in in your Klaviyo account
  2. Now select the /api/v1/metric/{metric_id}/export endpoint to get a report for your metric of interest. Plug in your metric ID and hit Run.

Optionally filter for specific campaigns (e.g. to see click rate for a specific campaign) by using the where parameter, e.g. where = [["$message","=","YOUR_CAMPAIGN_ID"]]

Of course you’ll need to run yet another request to get your campaign IDs… You can use the /campaigns endpoint for that.

Part 4: Create a Custom API Request

Alternatively, you can create a custom request instead of using API Connector’s built-in integration. When you create a custom request, you add your complete URL into the request URL field.


Part 5: Handle Pagination

Klaviyo will generally limit the number of records returned at once, unless you loop through using the parameters shown in their documentation. The specific parameters depend on the endpoint:

Metric endpoints

Metric endpoints use the ‘page’ and ‘count’ parameters:

With API Connector, you can loop through these pages automatically using pagination handling, like this:

  • Pagination type: page parameter
  • Page parameter: page
  • Run until: choose when to stop fetching data

List & segment endpoints

List & segment endpoints use the ‘marker’ cursor:

This would be automated like this:

  • Pagination type: cursor
  • Next token parameter: marker
  • Next token path: marker
  • Run until: choose when to stop fetching data

Part 6: API Documentation

Official API documentation:

Previous Import Jira Data to Google Sheets
Next Import KoBoToolbox Data to Google Sheets

8 thoughts on “Import Klaviyo Data to Google Sheets”

  1. I’d like the query to pick up parameters fromt he spreadsheet.

    At the moment I have to edit the query to to change the data range. I’d like to be able to get the query from a cell in the spreadsheet whenever it’s run, so that the date ranges int he query are different every time it’s run.

  2. Hi Ana – thank you for all your guides. They are very helpful!

    I wanted to pull out performance (transactions and value) from specific flows and all the campaigns.

    With***** I still need to figure out a way to get the data i need.

    I looked at the documentation Klaviyo offers but I was wondering if you had the answer (and maybe others need this too).

    I wish to get: campaign_name, sent_date, total_opens, total_clicks, total_transactions and total_revenue

    • Excellent question. Unfortunately this API doesn’t contain an endpoint to pull out campaign metrics all in one go. I found quite a few people asking similar questions in their forum, for example here. Based on the community manager responses, the only way to do this is through a sequence of API requests, where you pull out metrics one by one and filter on the campaign ID.
      I added a section to this article showing how it works, please check here and let me know if that works for you.

  3. Hi Ana, Thanks for compiling this documentation. I’m extracting all members of a segment via this API call ( which worked for the first 1000 results, but I’m struggling to make the pagination work. It appears that if I use page parameter and run until page count equals 2 or more it just duplicates the data from the first 1000 rows.

    Do you have any idea on how to get access to the next pages?


    • Hey Wouter! It looks like this endpoint uses a different method of pagination (cursor instead of page parameter). I’ve updated the article with the correct pagination settings for getting list and segment members, please check here for instructions and see if that resolves the issue.


Leave a Comment

Table of Contents