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:
Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.
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.
Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new
First, log in to your Kalviyo account.
In the Dashboard section, click on your company name. Then, in the drop-down menu, click Account:
In the Account page, click the Settings menu, then click the API Keys option:
In the API Keys section, you will find your public API key and the private keys, if you have any.
To create a private API key, click the Create API Key button:
After your API key has been created, rename it by clicking the pencil button next to the No label text:
Complete the label field and then click the Save API Key button:
Your API Key should now be labeled:
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.
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:
For example, if you click the Profiles API, you’ll see a page containing the API authentication method and endpoints for that specific API:
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?api_key=API_KEY
where PERSON_ID is the Klaviyo Person ID and API_KEY is your personal api key.
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:
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?api_key=your_api_key
If you’re following the same example as us, just copy and paste the URL into the Apipheny add-on. But don’t forget to replace your_api_key with the same API key you previously obtained in Step 2.
Headers are not required for this API request, so you can leave those fields blank in Apipheny.
Here’s what your API request will look like in Apipheny if you’re following the same example as us:
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.
Crypto API Tutorials: