Klaviyo is a popular all-in-one email marketing, SMS marketing, web, and push notifications platform.

In this tutorial, I’ll show you how to connect the Klaviyo REST API to Google Sheets in 5 steps:

  1. Install the Apipheny Add-on
  2. Create a Private Klaviyo API Key
  3. Choose a Klaviyo API Endpoint URL
  4. Enter Your Klaviyo API Request into the Apipheny add-on
  5. Run the Klaviyo API request

Step 1.) Install and open the Apipheny add-on for Google Sheets

Apipheny is a free API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to API data sources, easily.

1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install

2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.

In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new

Step 2.) Create a Private Klaviyo API Key

First, log in to your Kalviyo account.

In the Dashboard section, click on your company name. Then, in the drop-down menu, click Settings:

Klaviyo Dashboard
Klaviyo Dashboard

In the Settings page, click the API Keys option, then click the Create Private API Key button:

API keys section
API keys section

In the API Keys section, you will find your public API key and the private keys, if you have any.

Write a name for your API key and select the access level, then click the Create button:

Creating the API key
Creating the API key

Your API key has been created:

API key confirmation
API key confirmation

Now the important part of the step: copy and paste your Klaviyo API key somewhere safe, because you’ll need it in the next steps.

Step 3.) Choose a Klaviyo API endpoint

In this section, I’ll show you how to browse the Klaviyo API documentation to find a Klaviyo API endpoint that retrieves the specific information you need from your Klaviyo account.

If you already know your Klaviyo API URL, or you want to use the same example URL as us, just skip to Step 4.

First, open the Klaviyo API documentation page: https://www.klaviyo.com/docs

In the menu on the left, in the API References section, you’ll see a list of available APIs:

Klaviyo API reference/documentation
Klaviyo API reference

For example, if you click the Profiles API, you’ll see a page containing the API authentication method and endpoints for that specific API:

Example Klaviyo API documentation
Example Klaviyo API documentation

An example endpoint for the Profiles API is the Retrieving a Person’s Attributes endpoint, which retrieves all the data attributes for a person (based on their Klaviyo Person ID). The corresponding API URL for this endpoint is:

https://a.klaviyo.com/api/v1/person/PERSON_ID

where PERSON_ID is the Klaviyo Person ID.

Each endpoint’s documentation contains a descriptive title, a paragraph describing the endpoint’s purpose, the list of arguments it takes and a description of the expected response.

On a separate panel on the right, you should see the HTTP method (GET) and the URL, followed by an example request and its response:

Example Klaviyo endpoint documentation
Example Klaviyo endpoint documentation

Step 4.) Enter Your Klaviyo API Request Into the Apipheny add-on

Okay, we’re in the home stretch. Now we need to enter the Klaviyo API request into the Apipheny add-on.

To do this, go back to your Google Sheet and make sure that the Apipheny add-on is open on the “Import” tab. With the Import Tab open, enter these details into the add-on:

Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) as required by your Klaviyo API endpoint. For this example, we are using the GET method.

API URL: In Step 3, I explained how you can find the Klaviyo API endpoint that you need. Now copy the complete API URL into the Apipheny add-on, where it says API URL Path (JSON / CSV), followed by any GET parameters required for your query.

For this example, we are using the Get Lists endpoint that displays a listing of all of the lists in an account. The corresponding URL for this endpoint is:

https://a.klaviyo.com/api/v2/lists

If you’re following the same example as us, just copy and paste the URL into the Apipheny add-on.

Headers: there are 3 header fields required for this API request. Add 3 header fields in Apipheny and enter the following:

Header 1 key:
Authorization
Header 1 value:

Klaviyo-API-Key your-private-api-key

Note: make sure to replace “your-private-api-key” in the header value above with your actual private API key from your settings.

Header 2 key:
accept
Header 2 value:

application/json

Header 3 key:
revision
Header 3 value:

2024-10-15

Note: these instructions may not always be up to date. Check the API documentation for the latest requirements. For example, the “revision” value (2024-10-15) may have changed. More info: https://developers.klaviyo.com/en/docs/authenticate_

Step 5.) Run the Klaviyo API Request in your Google Sheet

The last step to get data from Klaviyo into Google Sheets is to click the Run button at the bottom of the Apipheny add-on, and then wait for your Klaviyo API data to be imported into your Google Sheet.

After making a successful request to the Klaviyo API, try querying a different Klaviyo API endpoint, or try using one of the more advanced features in the Apipheny add-on.