Klaviyo is a digital marketing platform focused on email marketing automation for e-commerce businesses. Klaviyo offers an SMS and email marketing automation platform for e-commerce, and its free account allows for 250 contacts and sending 500 emails.
This TD import allows you to transfer data from your Klaviyo account to Treasure Data.
- Basic knowledge of Treasure Data, including TD Toolbelt
- An account in Klaviyo
- A private API key for your Klaviyo account
- importing from the CLI requires the Ruby Gem for TD Toolbelt.
The static IP address of Treasure Data is the access point and source of the linkage for this Integration. To determine the static IP address, contact your Customer Success representative or Technical support.
To import from Klaviyo, you will need to have an API key associated with your Klaviyo account.
- Using your Klaviyo credentials, login to the https://www.klaviyo.com/login.
- Select Settings.

- Select the Account tab, and then select Create Private API Key.

- Enter the API Key name and select access scopes for your API Key.

- Select Create.
Your first step is to create a new authentication with a set of credentials.
- Select Integrations Hub > Catalog.

- Search for Klaviyo in the Catalog; hover your mouse over the icon and select Create Authentication.

- Ensure that the Credentials tab is selected and then enter your Klaviyo Private API key.
- Select Continue.
- Enter a name for your authentication, and select Done.
- Open TD Console.
- Navigate to Integrations Hub > Authentications.
- Locate the Klaviyo authentication and select New Source.

| Parameter | Description |
|---|---|
| Data Transfer Name | You can define the name of your transfer. |
| Authentication | The authentication name that is used to a transfer. |
- Type a source name in the Data Transfer Name field.
- Select Next.
The Create Source page displays with the Source Table tab selected.

The following table describes the parameters for configuring a source table:
| Parameter | Mandatory | Description |
|---|---|---|
| Data Source | Yes | Specify which data we need to Ingest. Supported values:
|
| Revision | No | API endpoint revision (format: YYYY-MM-DD). For more details, refer to section Appendix A. Recommend stable revision values:
|
| Skip Related Object | No | This checkbox is only visible if the Data Source is Events. To skip getting details on metric and profile objects, the user can get those by making separate configurations and then joining those tables later. |
Incremental | No | This checkbox is only visible if the Data Source is one of these values:
Selecting the checkbox enables incremental data loading with a custom start time-end time. |
Filter By | No | Select which object attribute would be used in time-based filter using the start time and end time:
The availability of this option depends on the data source. |
| Start Time - End Time | No | Request data from Klaviyo for this period. Format: ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss) |
Revision: Leave blank to use the default version, which is managed by the integration.
Skip Related Object: Enable this to improve the performance.
Incremental: When running incremental mode, if start time and/or end time is missing, the connector uses the end time from previous run as new start time, and current system time as end time.
- Select Next.

| Parameter | Type | Mandatory | Default Value | Description |
|---|---|---|---|---|
| Retry Limit | Number | No | 5 | Max retry count per API call. Min: 1, Max: 7 |
| Initial retry time wait | Number | No | 1 | Initial retry interval per API call (second). Min: 1, Max: 10 |
| Max retry wait | Number | No | 300 | Max retry interval per API call (second). Min: 30, Max: 1800 |
| HTTP Connection Timeout | Number | No | 300 | HTTP Connection Timeout (second). Min: 30, Max: 1800 |
| HTTP read timeout | Number | No | 300 | HTTP read timeout (second). Min: 30, Max: 1800 |
| HTTP write timeout | Number | No | 300 | HTTP write timeout (second). Min: 30, Max: 1800 |
- Select Next.

The data that displays in the data preview is approximated from your source. It is not the actual data that is imported.
- To preview your data, select Generate Preview. Optionally, select Next to skip to the next section.
- Verify that the data looks approximately like you expect it to.
- Select Next

In the Storage section specify details for where you want the data to reside in TD:
- Database — Select the database where you want to save your data.
- Table — The destination table where you want to store your imported data
- Method
- Append — Add records to your existing table. (Be aware that data may be duplicated.)
- Always Replace — Always clear your destination table before adding records.
- Replace on new data — If new data is found, then old data will be overwritten by the new data.
- Timestamp-based Partition Key — Select your custom timestamp column used as the partition key.
- Data Storage Timezone — The expected timezone for your database.
In the Schedule section, you can choose when and how often you want to run this query.
- Repeat — Select On or Off.
- Schedule **—**The dropdown list provides these options: @daily (midnight), @hourly,(:00), or Custom cron.
- Delay Transfer **—**You can specify a delay to the execution time.
- Scheduling Timezone
Select Create & Run Now.
After your transfer has run, you can see the results of your transfer in Data Workbench > Databases
You import data from Klaviyo using the TD Toolbelt.
Install the latest TD Tool using Ruby Gem.
$ gem install td
$ td --version
0.16.10There are other install methods. For more information, see Treasure Data Toolbelt.
Create a config.yml configuration file:
in:
type: klaviyo
data_source: lists
api_token: xxx
revision_time: "2022-12-17"
incremental: true
start_time: "2023-06-01T17:06:39.698883"
incremental_field: updated
out:
mode: appendYou can preview the data your config file will pull in:
$ td connector:preview config.yml
+-----------+-----------------------+-------------------------+-------------------------+
| id:string | name:string | created:string | updated:string |
+-----------+-----------------------+-------------------------+-------------------------+
| SPg3aL | chrome_line_name | 2021-08-30 05:35:46 UTC | 2021-08-30 05:35:46 UTC |
| QPg3zL | 100_w_phone_line_name | 2021-08-27 23:49:56 UTC | 2021-08-27 23:49:56 UTC |
+-----------+-----------------------+-------------------------+-------------------------+You can schedule periodic data connector execution for periodic Klaviyo import. By using this feature, you no longer need a cron daemon on your local data center.
A new schedule can be created by using the td connector:create command. The following data needs to be specified:
- Name of the schedule
- The cron-style schedule
- The database and table where their data will be stored
- The Data Connector configuration file is required.
$ td connector:create \
daily_klaviyo_import \
"10 0 * * *" \
sample_db \
sample_table \
config.ymlThe cron parameter also accepts three special options: @hourly, @daily and @monthly. For more details, see Scheduled Jobs.
By default, the schedule is set up in the UTC timezone. You can set the schedule in a timezone using the -tor --timezoneoption. The --timezoneoption supports only extended timezone formats like ‘Asia/Tokyo’, ‘America/Los_Angeles’ etc. Timezone abbreviations like PST and CST are not supported and may lead to unexpected schedules.
You can see the list of currently scheduled entries by entering td connector:list.
$ td connector:list
+----------------------+------------+----------+-------+-----------------+--------------+
| Name | Cron | Timezone | Delay | Database | Table |
+----------------------+------------+----------+-------+-----------------+--------------+
| daily_klaviyo_import | 10 0 * * * | UTC | 0 | sample_database | sample_table |
+----------------------+------------+----------+-------+-----------------+--------------+td connector:show shows the execution setting of a schedule entry.
$ td connector:show daily_klaviyo_import Name : daily_klaviyo_import Cron : 10 0 * * * Timezone : UTC Delay : 0 Database : sample_db Table : sample_tabletd connector:historyshows the execution history of a schedule entry. To investigate the results of each individual execution, use td job:show jobid.
| 577914 | success | 20000 | sample_db | sample_table | 0 | 2015-04-16 00:10:03 +0000 | 152 | | 577872 | success | 20000 | sample_db | sample_table | 0 | 2015-04-15 00:10:04 +0000 | 163 | | 577810 | success | 20000 | sample_db | sample_table | 0 | 2015-04-14 00:10:04 +0000 | 164 | | 577766 | success | 20000 | sample_db | sample_table | 0 | 2015-04-13 00:10:04 +0000 | 155 | | 577710 | success | 20000 | sample_db | sample_table | 0 | 2015-04-12 00:10:05 +0000 | 156 | | 577610 | success | 20000 | sample_db | sample_table | 0 | 2015-04-11 00:10:04 +0000 | 157 | +--------+---------+---------+-----------+--------------+----------+---------------------------+----------+td connector:deleteremoves the schedule.
$ td connector:delete daily_klaviyo_importThe TD Klaviyo connector only supports the "Stable" Klaviyo API. It does not support any "v1-2" legacy APIs nor any deprecated APIs. the "v1-2" legacy APIs are scheduled to end on January 1, 2024.

Klaviyo APIs follow a versioning system that allows for more explicit specification of precise API releases containing backwards-incompatible changes:
New Klaviyo APIs (/api endpoints) do not contain version numbers in their path.
Versions are now formatted with the pattern YYYY-MM-DD, e.g., revision 2022-04-15. In the Klaviyo connector, the revision is a required parameter when you create a new source using the TD Console or the TD Toolbelt.
Klaviyo recommends using the following revisions
Revision Deprecated? Planned retirement date Retired? 2022-10-17Yes ~January 24th, 2024 No 2023-01-24Yes ~February 23rd, 2024 No 2023-02-22No TBD No
- API versioning and deprecation policy: https://developers.klaviyo.com/en/docs/api_versioning_and_deprecation_policy
- API Overview: https://developers.klaviyo.com/en/reference/api_overview