Skip to main content

Loading Data from Klaviyo to CockroachDB in Python with dlt

tip

We will be using the dlt PostgreSQL destination to connect to CockroachDB. You can get the connection string for your CockroachDB database as described in the CockroachDB Docs.

Need help deploying these pipelines, or figuring out how to run them in your data stack?

Join our Slack community or book a call with our support engineer Violetta.

Loading data from Klaviyo to CockroachDB using the dlt library is a straightforward process. Klaviyo is a powerful email marketing and automation platform that helps businesses create personalized marketing campaigns, build targeted email lists, design custom email templates, and analyze campaign performance. On the other hand, CockroachDB offers a simple, reliable SQL API and is a distributed, cloud-native database compatible with Kubernetes. By leveraging the open-source Python library dlt, you can efficiently transfer your marketing data from Klaviyo to CockroachDB, enabling better data-driven marketing strategies. For more information on Klaviyo, visit their website.

dlt Key Features

  • Automated maintenance: With schema inference and evolution and alerts, dlt makes maintenance simple. Learn more
  • Run it where Python runs: Compatible with Airflow, serverless functions, notebooks, and more. Learn more
  • User-friendly interface: Offers a declarative interface that is beginner-friendly while empowering senior professionals. Learn more
  • Scalability: Utilizes iterators, chunking, and parallelization for efficient processing of large datasets. Learn more
  • Implicit extraction DAGs: Automatically handles dependencies between data sources and transformations. Learn more

Getting started with your pipeline locally

OpenAPI Source Generator dlt-init-openapi

This walkthrough makes use of the dlt-init-openapi generator cli tool. You can read more about it here. The code generated by this tool uses the dlt rest_api verified source, docs for this are here.

0. Prerequisites

dlt and dlt-init-openapi requires Python 3.9 or higher. Additionally, you need to have the pip package manager installed, and we recommend using a virtual environment to manage your dependencies. You can learn more about preparing your computer for dlt in our installation reference.

1. Install dlt and dlt-init-openapi

First you need to install the dlt-init-openapi cli tool.

pip install dlt-init-openapi

The dlt-init-openapi cli is a powerful generator which you can use to turn any OpenAPI spec into a dlt source to ingest data from that api. The quality of the generator source is dependent on how well the API is designed and how accurate the OpenAPI spec you are using is. You may need to make tweaks to the generated code, you can learn more about this here.

# generate pipeline
# NOTE: add_limit adds a global limit, you can remove this later
# NOTE: you will need to select which endpoints to render, you
# can just hit Enter and all will be rendered.
dlt-init-openapi klaviyo --url https://raw.githubusercontent.com/dlt-hub/openapi-specs/main/open_api_specs/Business/klaviyo.yaml --global-limit 2
cd klaviyo_pipeline
# install generated requirements
pip install -r requirements.txt

The last command will install the required dependencies for your pipeline. The dependencies are listed in the requirements.txt:

dlt>=0.4.12

You now have the following folder structure in your project:

klaviyo_pipeline/
├── .dlt/
│ ├── config.toml # configs for your pipeline
│ └── secrets.toml # secrets for your pipeline
├── rest_api/ # The rest api verified source
│ └── ...
├── klaviyo/
│ └── __init__.py # TODO: possibly tweak this file
├── klaviyo_pipeline.py # your main pipeline script
├── requirements.txt # dependencies for your pipeline
└── .gitignore # ignore files for git (not required)

1.1. Tweak klaviyo/__init__.py

This file contains the generated configuration of your rest_api. You can continue with the next steps and leave it as is, but you might want to come back here and make adjustments if you need your rest_api source set up in a different way. The generated file for the klaviyo source will look like this:

Click to view full file (2143 lines)

from typing import List

import dlt
from dlt.extract.source import DltResource
from rest_api import rest_api_source
from rest_api.typing import RESTAPIConfig


@dlt.source(name="klaviyo_source", max_table_nesting=2)
def klaviyo_source(
api_key: str = dlt.secrets.value,
base_url: str = dlt.config.value,
) -> List[DltResource]:

# source configuration
source_config: RESTAPIConfig = {
"client": {
"base_url": base_url,
"auth": {

"type": "api_key",
"api_key": api_key,
"name": "Authorization",
"location": "header"

},
"paginator": {
"type":
"json_response",
"next_url_path":
"links.next",
},
},
"resources":
[
# Retrieve the account(s) associated with a given private API key. This will return 1 account object within the array. You can use this to retrieve account-specific data (contact information, timezone, currency, Public API key, etc.) or test if a Private API Key belongs to the correct account prior to performing subsequent actions with the API.<br><br>*Rate limits*:<br>Burst: `1/s`<br>Steady: `15/m` **Scopes:** `accounts:read`
{
"name": "get_accounts",
"table_name": "account_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/accounts/",
}
},
# Retrieve a single account object by its account ID. You can only request the account by which the private API key was generated.<br><br>*Rate limits*:<br>Burst: `1/s`<br>Steady: `15/m` **Scopes:** `accounts:read`
{
"name": "get_account",
"table_name": "account_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/accounts/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_accounts",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[account]": "OPTIONAL_CONFIG",

},
}
},
# Returns the ID of the related campaign<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read`
{
"name": "get_campaign_message_relationships_campaign",
"table_name": "campaign",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaign-messages/{id}/relationships/campaign/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter

},
}
},
# Return the related campaign<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read`
{
"name": "get_campaign_message_campaign",
"table_name": "campaign",
"endpoint": {
"data_selector": "data.attributes.audiences.included",
"path": "/api/campaign-messages/{id}/campaign/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[campaign]": "OPTIONAL_CONFIG",

},
}
},
# Returns the IDs of all campaigns associated with the given tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `campaigns:read` `tags:read`
{
"name": "get_tag_relationships_campaigns",
"table_name": "campaign",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tags/{id}/relationships/campaigns/",
"params": {
"id": {
"type": "resolve",
"resource": "get_tags",
"field": "id",
},

},
}
},
# Returns the IDs of all messages associated with the given campaign.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read`
{
"name": "get_campaign_relationships_campaign_messages",
"table_name": "campaign_message",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaigns/{id}/relationships/campaign-messages/",
"params": {
"id": {
"type": "resolve",
"resource": "get_campaigns",
"field": "id",
},

},
}
},
# Return all messages that belong to the given campaign.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read`
{
"name": "get_campaign_campaign_messages",
"table_name": "campaign_message_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaigns/{id}/campaign-messages/",
"params": {
"id": {
"type": "resolve",
"resource": "get_campaigns",
"field": "id",
},

},
}
},
# Retrieve the status of a recipient estimation job triggered with the `Create Campaign Recipient Estimation Job` endpoint.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read`
{
"name": "get_campaign_recipient_estimation_job",
"table_name": "campaign_recipient_estimation_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaign-recipient-estimation-jobs/{id}/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[campaign-recipient-estimation-job]": "OPTIONAL_CONFIG",

},
}
},
# Get the estimated recipient count for a campaign with the provided campaign ID. You can refresh this count by using the `Create Campaign Recipient Estimation Job` endpoint.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read`
{
"name": "get_campaign_recipient_estimation",
"table_name": "campaign_recipient_estimation_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaign-recipient-estimations/{id}/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[campaign-recipient-estimation]": "OPTIONAL_CONFIG",

},
}
},
# Returns some or all campaigns based on filters. A channel filter is required to list campaigns. Please provide either: `?filter=equals(messages.channel,'email')` to list email campaigns, or `?filter=equals(messages.channel,'sms')` to list SMS campaigns.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read`
{
"name": "get_campaigns",
"table_name": "campaign_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaigns/",
}
},
# Get a campaign send job<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read`
{
"name": "get_campaign_send_job",
"table_name": "campaign_send_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaign-send-jobs/{id}/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[campaign-send-job]": "OPTIONAL_CONFIG",

},
}
},
# Get all catalog category bulk create jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_create_categories_jobs",
"table_name": "catalog_category_create_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-category-bulk-create-jobs/",
}
},
# Get all catalog category bulk delete jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_delete_categories_jobs",
"table_name": "catalog_category_delete_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-category-bulk-delete-jobs/",
}
},
# Get a catalog category bulk delete job with the given job ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_delete_categories_job",
"table_name": "catalog_category_delete_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-category-bulk-delete-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_delete_categories_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-category-bulk-delete-job]": "OPTIONAL_CONFIG",

},
}
},
# Get all catalog categories in an account. Catalog categories can be sorted by the following fields, in ascending and descending order: `created` Currently, the only supported integration type is `$custom`, and the only supported catalog type is `$default`. Returns a maximum of 100 categories per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_categories",
"table_name": "catalog_category_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-categories/",
}
},
# Get a catalog category with the given category ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_category",
"table_name": "catalog_category_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-categories/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_catalog_categories",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-category]": "OPTIONAL_CONFIG",

},
}
},
# Get all catalog categories that an item with the given item ID is in. Catalog categories can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 categories per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_item_categories",
"table_name": "catalog_category_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-items/{id}/categories/",
"params": {
"id": {
"type": "resolve",
"resource": "get_catalog_items",
"field": "id",
},

},
}
},
# Get all catalog category bulk update jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_update_categories_jobs",
"table_name": "catalog_category_update_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-category-bulk-update-jobs/",
}
},
# Get all catalog item bulk create jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_create_items_jobs",
"table_name": "catalog_item_create_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-item-bulk-create-jobs/",
}
},
# Get all catalog item bulk delete jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_delete_items_jobs",
"table_name": "catalog_item_delete_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-item-bulk-delete-jobs/",
}
},
# Get a catalog item bulk delete job with the given job ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_delete_items_job",
"table_name": "catalog_item_delete_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-item-bulk-delete-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_delete_items_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-item-bulk-delete-job]": "OPTIONAL_CONFIG",

},
}
},
# Get all catalog items in an account. Catalog items can be sorted by the following fields, in ascending and descending order: `created` Currently, the only supported integration type is `$custom`, and the only supported catalog type is `$default`. Returns a maximum of 100 items per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_items",
"table_name": "catalog_item_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-items/",
}
},
# Get all items in a category with the given category ID. Items can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 items per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_category_items",
"table_name": "catalog_item_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-categories/{id}/items/",
"params": {
"id": {
"type": "resolve",
"resource": "get_catalog_categories",
"field": "id",
},

},
}
},
# Get all catalog item bulk update jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_update_items_jobs",
"table_name": "catalog_item_update_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-item-bulk-update-jobs/",
}
},
# Get all catalog variant bulk create jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_create_variants_jobs",
"table_name": "catalog_variant_create_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-variant-bulk-create-jobs/",
}
},
# Get all catalog variant bulk delete jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_delete_variants_jobs",
"table_name": "catalog_variant_delete_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-variant-bulk-delete-jobs/",
}
},
# Get a catalog variant bulk delete job with the given job ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_delete_variants_job",
"table_name": "catalog_variant_delete_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-variant-bulk-delete-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_delete_variants_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-variant-bulk-delete-job]": "OPTIONAL_CONFIG",

},
}
},
# Get all variants in an account. Variants can be sorted by the following fields, in ascending and descending order: `created` Currently, the only supported integration type is `$custom`, and the only supported catalog type is `$default`. Returns a maximum of 100 variants per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_variants",
"table_name": "catalog_variant_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-variants/",
}
},
# Get a catalog item variant with the given variant ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_variant",
"table_name": "catalog_variant_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-variants/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_catalog_variants",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-variant]": "OPTIONAL_CONFIG",

},
}
},
# Get all variants related to the given item ID. Variants can be sorted by the following fields, in ascending and descending order: `created` Returns a maximum of 100 variants per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_item_variants",
"table_name": "catalog_variant_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-items/{id}/variants/",
"params": {
"id": {
"type": "resolve",
"resource": "get_catalog_items",
"field": "id",
},

},
}
},
# Get all catalog variant bulk update jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_update_variants_jobs",
"table_name": "catalog_variant_update_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-variant-bulk-update-jobs/",
}
},
# Get all catalog categories that a particular item is in. Returns a maximum of 100 categories per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_item_relationships_categories",
"table_name": "category",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-items/{id}/relationships/categories/",
"params": {
"id": {
"type": "resolve",
"resource": "get_catalog_items",
"field": "id",
},
# the parameters below can optionally be configured
# "page[cursor]": "OPTIONAL_CONFIG",

},
}
},
# Gets the coupon relationship associated with the given coupon code id<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `coupons:read`
{
"name": "get_coupon_relationships_coupon_codes",
"table_name": "coupon",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/coupon-codes/{id}/relationships/coupon/",
"params": {
"id": {
"type": "resolve",
"resource": "get_coupon_codes",
"field": "id",
},

},
}
},
# Gets a list of coupon code relationships associated with the given coupon id<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `coupon-codes:read`
{
"name": "get_coupon_code_relationships_coupon",
"table_name": "coupon_code",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/coupons/{id}/relationships/coupon-codes/",
"params": {
"id": {
"type": "resolve",
"resource": "get_coupons",
"field": "id",
},
# the parameters below can optionally be configured
# "page[cursor]": "OPTIONAL_CONFIG",

},
}
},
# Get all coupon code bulk create jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `coupon-codes:read`
{
"name": "get_coupon_code_bulk_create_jobs",
"table_name": "coupon_code_create_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/coupon-code-bulk-create-jobs/",
}
},
# Gets a list of coupon codes associated with a coupon/coupons or a profile/profiles. A coupon/coupons or a profile/profiles must be provided as required filter params.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `coupon-codes:read`
{
"name": "get_coupon_codes",
"table_name": "coupon_code_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/coupon-codes/",
}
},
# Gets a list of coupon codes associated with the given coupon id<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `coupon-codes:read`
{
"name": "get_coupon_codes_for_coupon",
"table_name": "coupon_code_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/coupons/{id}/coupon-codes/",
"params": {
"id": {
"type": "resolve",
"resource": "get_coupons",
"field": "id",
},

},
}
},
# Get all coupons in an account. To learn more, see our [Coupons API guide](https://developers.klaviyo.com/en/docs/use_klaviyos_coupons_api).<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `coupons:read`
{
"name": "get_coupons",
"table_name": "coupon_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/coupons/",
}
},
# Get a specific coupon with the given coupon ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `coupons:read`
{
"name": "get_coupon",
"table_name": "coupon_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/coupons/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_coupons",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[coupon]": "OPTIONAL_CONFIG",

},
}
},
# Get the coupon associated with a given coupon code ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `coupons:read`
{
"name": "get_coupon_for_coupon_code",
"table_name": "coupon_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/coupon-codes/{id}/coupon/",
"params": {
"id": {
"type": "resolve",
"resource": "get_coupon_codes",
"field": "id",
},

},
}
},
# Get all events in an account Requests can be sorted by the following fields: `datetime`, `timestamp` Returns a maximum of 200 events per page.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read`
{
"name": "get_events",
"table_name": "event_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/events/",
}
},
# Get the flow associated with the given action ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow_action_relationships_flow",
"table_name": "flow",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flow-actions/{id}/relationships/flow/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter

},
}
},
# Returns the IDs of all flows associated with the given tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read` `tags:read`
{
"name": "get_tag_relationships_flows",
"table_name": "flow",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tags/{id}/relationships/flows/",
"params": {
"id": {
"type": "resolve",
"resource": "get_tags",
"field": "id",
},

},
}
},
# Get all [relationships](https://developers.klaviyo.com/en/reference/api_overview#relationships) for flow actions associated with the given flow ID. Flow action relationships can be sorted by the following fields, in ascending and descending order: `id`, `status`, `created`, `updated` Use filters to narrow your results. Returns a maximum of 50 flow action relationships per request, which can be paginated with offset pagination. Offset pagination uses the following parameters: `page[size]` and `page[number]`.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow_relationships_flow_actions",
"table_name": "flow_action",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flows/{id}/relationships/flow-actions/",
"params": {
"id": {
"type": "resolve",
"resource": "get_flows",
"field": "id",
},
# the parameters below can optionally be configured
# "filter": "OPTIONAL_CONFIG",
# "page[size]": "50",
# "sort": "OPTIONAL_CONFIG",

},
}
},
# Get the flow action for a flow message with the given message ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow_message_action",
"table_name": "flow_action",
"endpoint": {
"data_selector": "data.attributes.tracking_options.utm_params",
"path": "/api/flow-messages/{id}/flow-action/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[flow-action]": "OPTIONAL_CONFIG",

},
}
},
# Get the [relationship](https://developers.klaviyo.com/en/reference/api_overview#relationships) for a flow message's flow action, given the flow ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow_message_relationships_action",
"table_name": "flow_action",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flow-messages/{id}/relationships/flow-action/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter

},
}
},
# Get all flow actions associated with the given flow ID. Returns a maximum of 50 flows per request, which can be paginated with cursor-based pagination.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow_flow_actions",
"table_name": "flow_action_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flows/{id}/flow-actions/",
"params": {
"id": {
"type": "resolve",
"resource": "get_flows",
"field": "id",
},

},
}
},
# Get all relationships for flow messages associated with the given flow action ID. Returns a maximum of 50 flow message relationships per request, which can be paginated with cursor-based pagination.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow_action_relationships_messages",
"table_name": "flow_message",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flow-actions/{id}/relationships/flow-messages/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "filter": "OPTIONAL_CONFIG",
# "page[cursor]": "OPTIONAL_CONFIG",
# "page[size]": "50",
# "sort": "OPTIONAL_CONFIG",

},
}
},
# Get all flow messages associated with the given action ID. Flow messages can be sorted by the following fields, in ascending and descending order: ascending: `id`, `name`, `created`, `updated` descending: `-id`, `-name`, `-created`, `-updated` Returns a maximum of 50 flows per request, which can be paginated with offset pagination. Offset pagination uses the following parameters: `page[size]` and `page[number]`<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow_action_messages",
"table_name": "flow_message_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flow-actions/{id}/flow-messages/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter

},
}
},
# Get all flows in an account. Returns a maximum of 50 flows per request, which can be paginated with cursor-based pagination.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flows",
"table_name": "flow_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flows/",
}
},
# Get the flow associated with the given action ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow_action_flow",
"table_name": "flow_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flow-actions/{id}/flow/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[flow]": "OPTIONAL_CONFIG",

},
}
},
# Returns a specific message based on a required id.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read`
{
"name": "get_campaign_message",
"table_name": "get_campaign_message_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/campaign-messages/{id}/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[campaign-message]": "OPTIONAL_CONFIG",
# "fields[campaign]": "OPTIONAL_CONFIG",
# "fields[template]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Returns a specific campaign based on a required id.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read`
{
"name": "get_campaign",
"table_name": "get_campaign_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/campaigns/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_campaigns",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[campaign-message]": "OPTIONAL_CONFIG",
# "fields[campaign]": "OPTIONAL_CONFIG",
# "fields[tag]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a catalog category bulk create job with the given job ID. An `include` parameter can be provided to get the following related resource data: `categories`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_create_categories_job",
"table_name": "get_catalog_category_create_job_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/catalog-category-bulk-create-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_create_categories_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-category-bulk-create-job]": "OPTIONAL_CONFIG",
# "fields[catalog-category]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a catalog category bulk update job with the given job ID. An `include` parameter can be provided to get the following related resource data: `categories`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_update_categories_job",
"table_name": "get_catalog_category_update_job_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/catalog-category-bulk-update-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_update_categories_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-category-bulk-update-job]": "OPTIONAL_CONFIG",
# "fields[catalog-category]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a catalog item bulk create job with the given job ID. An `include` parameter can be provided to get the following related resource data: `items`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_create_items_job",
"table_name": "get_catalog_item_create_job_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/catalog-item-bulk-create-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_create_items_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-item-bulk-create-job]": "OPTIONAL_CONFIG",
# "fields[catalog-item]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a specific catalog item with the given item ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_item",
"table_name": "get_catalog_item_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/catalog-items/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_catalog_items",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-item]": "OPTIONAL_CONFIG",
# "fields[catalog-variant]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a catalog item bulk update job with the given job ID. An `include` parameter can be provided to get the following related resource data: `items`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_update_items_job",
"table_name": "get_catalog_item_update_job_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/catalog-item-bulk-update-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_update_items_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-item-bulk-update-job]": "OPTIONAL_CONFIG",
# "fields[catalog-item]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a catalog variant bulk create job with the given job ID. An `include` parameter can be provided to get the following related resource data: `variants`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_create_variants_job",
"table_name": "get_catalog_variant_create_job_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/catalog-variant-bulk-create-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_create_variants_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-variant-bulk-create-job]": "OPTIONAL_CONFIG",
# "fields[catalog-variant]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a catalog variate bulk update job with the given job ID. An `include` parameter can be provided to get the following related resource data: `variants`.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_update_variants_job",
"table_name": "get_catalog_variant_update_job_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/catalog-variant-bulk-update-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_update_variants_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[catalog-variant-bulk-update-job]": "OPTIONAL_CONFIG",
# "fields[catalog-variant]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a coupon code bulk create job with the given job ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `coupon-codes:read`
{
"name": "get_coupon_code_bulk_create_job",
"table_name": "get_coupon_code_create_job_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/coupon-code-bulk-create-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_coupon_code_bulk_create_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[coupon-code-bulk-create-job]": "OPTIONAL_CONFIG",
# "fields[coupon-code]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Returns a Coupon Code specified by the given identifier.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `coupon-codes:read`
{
"name": "get_coupon_code",
"table_name": "get_coupon_code_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/coupon-codes/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_coupon_codes",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[coupon-code]": "OPTIONAL_CONFIG",
# "fields[coupon]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `events:read`
{
"name": "get_event",
"table_name": "get_event_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/events/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_events",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[event]": "OPTIONAL_CONFIG",
# "fields[metric]": "OPTIONAL_CONFIG",
# "fields[profile]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a flow action from a flow with the given flow action ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow_action",
"table_name": "get_flow_action_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/flow-actions/{id}/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[flow-action]": "OPTIONAL_CONFIG",
# "fields[flow-message]": "OPTIONAL_CONFIG",
# "fields[flow]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get the flow message of a flow with the given message ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow_message",
"table_name": "get_flow_message_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/flow-messages/{id}/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[flow-action]": "OPTIONAL_CONFIG",
# "fields[flow-message]": "OPTIONAL_CONFIG",
# "fields[template]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a flow with the given flow ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read`
{
"name": "get_flow",
"table_name": "get_flow_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/flows/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_flows",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[flow-action]": "OPTIONAL_CONFIG",
# "fields[flow]": "OPTIONAL_CONFIG",
# "fields[tag]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a list with the given list ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m`<br><br>Rate limits when using the `additional-fields[list]=profile_count` parameter in your API request:<br>Burst: `1/s`<br>Steady: `15/m`<br><br>To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-02-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `lists:read`
{
"name": "get_list",
"table_name": "get_list_retrieve_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/lists/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_lists",
"field": "id",
},
# the parameters below can optionally be configured
# "additional-fields[list]": "OPTIONAL_CONFIG",
# "fields[list]": "OPTIONAL_CONFIG",
# "fields[tag]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a bulk profile import job with the given job ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `lists:read` `profiles:read`
{
"name": "get_bulk_profile_import_job",
"table_name": "get_profile_import_job_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/profile-bulk-import-jobs/{job_id}/",
"params": {
"job_id": {
"type": "resolve",
"resource": "get_bulk_profile_import_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[list]": "OPTIONAL_CONFIG",
# "fields[profile-bulk-import-job]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get the profile with the given profile ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `profiles:read`
{
"name": "get_profile",
"table_name": "get_profile_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/profiles/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_profiles",
"field": "id",
},
# the parameters below can optionally be configured
# "additional-fields[profile]": "OPTIONAL_CONFIG",
# "fields[list]": "OPTIONAL_CONFIG",
# "fields[profile]": "OPTIONAL_CONFIG",
# "fields[segment]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get a segment with the given segment ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m`<br><br>Rate limits when using the `additional-fields[segment]=profile_count` parameter in your API request:<br>Burst: `1/s`<br>Steady: `15/m`<br><br>To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-02-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `segments:read`
{
"name": "get_segment",
"table_name": "get_segment_retrieve_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/segments/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_segments",
"field": "id",
},
# the parameters below can optionally be configured
# "additional-fields[segment]": "OPTIONAL_CONFIG",
# "fields[segment]": "OPTIONAL_CONFIG",
# "fields[tag]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Retrieve the tag with the given tag ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
{
"name": "get_tag",
"table_name": "get_tag_response_compound_document",
"endpoint": {
"data_selector": "$",
"path": "/api/tags/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_tags",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[tag-group]": "OPTIONAL_CONFIG",
# "fields[tag]": "OPTIONAL_CONFIG",
# "include": "OPTIONAL_CONFIG",

},
}
},
# Get all images in an account.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `images:read`
{
"name": "get_images",
"table_name": "image_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/images/",
}
},
# Get the image with the given image ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `images:read`
{
"name": "get_image",
"table_name": "image_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/images/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_images",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[image]": "OPTIONAL_CONFIG",

},
}
},
# Get import errors for the bulk profile import job with the given ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `profiles:read`
{
"name": "get_bulk_profile_import_job_import_errors",
"table_name": "import_error_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profile-bulk-import-jobs/{id}/import-errors/",
"params": {
"id": {
"type": "resolve",
"resource": "get_bulk_profile_import_jobs",
"field": "id",
},

},
}
},
# Get all items in the given category ID. Returns a maximum of 100 items per request.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `catalogs:read`
{
"name": "get_catalog_category_relationships_items",
"table_name": "item",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/catalog-categories/{id}/relationships/items/",
"params": {
"id": {
"type": "resolve",
"resource": "get_catalog_categories",
"field": "id",
},
# the parameters below can optionally be configured
# "page[cursor]": "OPTIONAL_CONFIG",

},
}
},
# Get list memberships for a profile with the given profile ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `lists:read` `profiles:read`
{
"name": "get_profile_relationships_lists",
"table_name": "list",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profiles/{id}/relationships/lists/",
"params": {
"id": {
"type": "resolve",
"resource": "get_profiles",
"field": "id",
},

},
}
},
# Get list relationship for the bulk profile import job with the given ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `lists:read`
{
"name": "get_bulk_profile_import_job_relationships_lists",
"table_name": "list",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profile-bulk-import-jobs/{id}/relationships/lists/",
"params": {
"id": {
"type": "resolve",
"resource": "get_bulk_profile_import_jobs",
"field": "id",
},

},
}
},
# Returns the IDs of all lists associated with the given tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `lists:read` `tags:read`
{
"name": "get_tag_relationships_lists",
"table_name": "list",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tags/{id}/relationships/lists/",
"params": {
"id": {
"type": "resolve",
"resource": "get_tags",
"field": "id",
},

},
}
},
# Get all lists in an account. Filter to request a subset of all lists. Lists can be filtered by `id`, `name`, `created`, and `updated` fields. Returns a maximum of 10 results per page.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `lists:read`
{
"name": "get_lists",
"table_name": "list_list_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/lists/",
}
},
# Get all profiles within a list with the given list ID. Filter to request a subset of all profiles. Profiles can be filtered by `email`, `phone_number`, `push_token`, and `joined_group_at` fields. Profiles can be sorted by the following fields, in ascending and descending order: `joined_group_at`<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m`<br><br>Rate limits when using the `additional-fields[profile]=predictive_analytics` parameter in your API request:<br>Burst: `10/s`<br>Steady: `150/m`<br><br>To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-02-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `lists:read` `profiles:read`
{
"name": "get_list_profiles",
"table_name": "list_member_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/lists/{id}/profiles/",
"params": {
"id": {
"type": "resolve",
"resource": "get_lists",
"field": "id",
},

},
}
},
# Get list memberships for a profile with the given profile ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `lists:read` `profiles:read`
{
"name": "get_profile_lists",
"table_name": "list_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profiles/{id}/lists/",
"params": {
"id": {
"type": "resolve",
"resource": "get_profiles",
"field": "id",
},

},
}
},
# Get list for the bulk profile import job with the given ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `lists:read`
{
"name": "get_bulk_profile_import_job_lists",
"table_name": "list_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profile-bulk-import-jobs/{id}/lists/",
"params": {
"id": {
"type": "resolve",
"resource": "get_bulk_profile_import_jobs",
"field": "id",
},

},
}
},
# Get a list of related Metrics for an Event<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `metrics:read`
{
"name": "get_event_relationships_metric",
"table_name": "metric",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/events/{id}/relationships/metric/",
"params": {
"id": {
"type": "resolve",
"resource": "get_events",
"field": "id",
},

},
}
},
# Get the metric for an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `metrics:read`
{
"name": "get_event_metric",
"table_name": "metric_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/events/{id}/metric/",
"params": {
"id": {
"type": "resolve",
"resource": "get_events",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[metric]": "OPTIONAL_CONFIG",

},
}
},
# Get all metrics in an account. Requests can be filtered by the following fields: integration `name`, integration `category` Returns a maximum of 200 results per page.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `metrics:read`
{
"name": "get_metrics",
"table_name": "metric_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/metrics/",
}
},
# Get a metric with the given metric ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `metrics:read`
{
"name": "get_metric",
"table_name": "metric_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/metrics/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_metrics",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[metric]": "OPTIONAL_CONFIG",

},
}
},
# Get profile [relationships](https://developers.klaviyo.com/en/reference/api_overview#relationships) for an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `profiles:read`
{
"name": "get_event_relationships_profile",
"table_name": "profile",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/events/{id}/relationships/profile/",
"params": {
"id": {
"type": "resolve",
"resource": "get_events",
"field": "id",
},

},
}
},
# Get profile membership [relationships](https://developers.klaviyo.com/en/reference/api_overview#relationships) for a list with the given list ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `lists:read` `profiles:read`
{
"name": "get_list_relationships_profiles",
"table_name": "profile",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/lists/{id}/relationships/profiles/",
"params": {
"id": {
"type": "resolve",
"resource": "get_lists",
"field": "id",
},
# the parameters below can optionally be configured
# "filter": "OPTIONAL_CONFIG",
# "page[cursor]": "OPTIONAL_CONFIG",
# "page[size]": "20",
# "sort": "OPTIONAL_CONFIG",

},
}
},
# Get profile relationships for the bulk profile import job with the given ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `profiles:read`
{
"name": "get_bulk_profile_import_job_relationships_profiles",
"table_name": "profile",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profile-bulk-import-jobs/{id}/relationships/profiles/",
"params": {
"id": {
"type": "resolve",
"resource": "get_bulk_profile_import_jobs",
"field": "id",
},
# the parameters below can optionally be configured
# "page[cursor]": "OPTIONAL_CONFIG",
# "page[size]": "20",

},
}
},
# Get all profile membership [relationships](https://developers.klaviyo.com/en/reference/api_overview#relationships) for the given segment ID.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `profiles:read` `segments:read`
{
"name": "get_segment_relationships_profiles",
"table_name": "profile",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/segments/{id}/relationships/profiles/",
"params": {
"id": {
"type": "resolve",
"resource": "get_segments",
"field": "id",
},
# the parameters below can optionally be configured
# "filter": "OPTIONAL_CONFIG",
# "page[cursor]": "OPTIONAL_CONFIG",
# "page[size]": "20",
# "sort": "OPTIONAL_CONFIG",

},
}
},
# Get all bulk profile import jobs. Returns a maximum of 100 jobs per request.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `lists:read` `profiles:read`
{
"name": "get_bulk_profile_import_jobs",
"table_name": "profile_import_job_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profile-bulk-import-jobs/",
}
},
# Get the profile associated with an event with the given event ID.<br><br>*Rate limits*:<br>Burst: `350/s`<br>Steady: `3500/m` **Scopes:** `events:read` `profiles:read`
{
"name": "get_event_profile",
"table_name": "profile_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/events/{id}/profile/",
"params": {
"id": {
"type": "resolve",
"resource": "get_events",
"field": "id",
},
# the parameters below can optionally be configured
# "additional-fields[profile]": "OPTIONAL_CONFIG",
# "fields[profile]": "OPTIONAL_CONFIG",

},
}
},
# Get all profiles in an account. Profiles can be sorted by the following fields in ascending and descending order: `id`, `created`, `updated`, `email`, `subscriptions.email.marketing.suppression.timestamp`, `subscriptions.email.marketing.list_suppressions.timestamp`<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m`<br><br>Rate limits when using the `additional-fields[profile]=predictive_analytics` parameter in your API request:<br>Burst: `10/s`<br>Steady: `150/m`<br><br>To learn more about how the `additional-fields` parameter impacts rate limits, check out our [Rate limits, status codes, and errors](https://developers.klaviyo.com/en/v2024-02-15/docs/rate_limits_and_error_handling) guide. **Scopes:** `profiles:read`
{
"name": "get_profiles",
"table_name": "profile_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profiles/",
}
},
# Get profiles for the bulk profile import job with the given ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `profiles:read`
{
"name": "get_bulk_profile_import_job_profiles",
"table_name": "profile_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profile-bulk-import-jobs/{id}/profiles/",
"params": {
"id": {
"type": "resolve",
"resource": "get_bulk_profile_import_jobs",
"field": "id",
},

},
}
},
# Get segment membership relationships for a profile with the given profile ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `profiles:read` `segments:read`
{
"name": "get_profile_relationships_segments",
"table_name": "segment",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profiles/{id}/relationships/segments/",
"params": {
"id": {
"type": "resolve",
"resource": "get_profiles",
"field": "id",
},

},
}
},
# Returns the IDs of all segments associated with the given tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `segments:read` `tags:read`
{
"name": "get_tag_relationships_segments",
"table_name": "segment",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tags/{id}/relationships/segments/",
"params": {
"id": {
"type": "resolve",
"resource": "get_tags",
"field": "id",
},

},
}
},
# Get all segments in an account. Filter to request a subset of all segments. Segments can be filtered by `name`, `created`, and `updated` fields. Returns a maximum of 10 results per page.<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `segments:read`
{
"name": "get_segments",
"table_name": "segment_list_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/segments/",
}
},
# Get all profiles within a segment with the given segment ID. Filter to request a subset of all profiles. Profiles can be filtered by `email`, `phone_number`, `push_token`, and `joined_group_at` fields. Profiles can be sorted by the following fields, in ascending and descending order: `joined_group_at`<br><br>*Rate limits*:<br>Burst: `75/s`<br>Steady: `700/m` **Scopes:** `profiles:read` `segments:read`
{
"name": "get_segment_profiles",
"table_name": "segment_member_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/segments/{id}/profiles/",
"params": {
"id": {
"type": "resolve",
"resource": "get_segments",
"field": "id",
},

},
}
},
# Get segment memberships for a profile with the given profile ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `profiles:read` `segments:read`
{
"name": "get_profile_segments",
"table_name": "segment_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/profiles/{id}/segments/",
"params": {
"id": {
"type": "resolve",
"resource": "get_profiles",
"field": "id",
},

},
}
},
# Returns the IDs of all tags associated with the given campaign.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `campaigns:read` `tags:read`
{
"name": "get_campaign_relationships_tags",
"table_name": "tag",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaigns/{id}/relationships/tags/",
"params": {
"id": {
"type": "resolve",
"resource": "get_campaigns",
"field": "id",
},

},
}
},
# Return the tag IDs of all tags associated with the given flow.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read` `tags:read`
{
"name": "get_flow_relationships_tags",
"table_name": "tag",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flows/{id}/relationships/tags/",
"params": {
"id": {
"type": "resolve",
"resource": "get_flows",
"field": "id",
},

},
}
},
# Returns the tag IDs of all tags associated with the given list.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `lists:read` `tags:read`
{
"name": "get_list_relationships_tags",
"table_name": "tag",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/lists/{id}/relationships/tags/",
"params": {
"id": {
"type": "resolve",
"resource": "get_lists",
"field": "id",
},

},
}
},
# If `related_resource` is `tags`, returns the tag IDs of all tags associated with the given segment ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `segments:read` `tags:read`
{
"name": "get_segment_relationships_tags",
"table_name": "tag",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/segments/{id}/relationships/tags/",
"params": {
"id": {
"type": "resolve",
"resource": "get_segments",
"field": "id",
},

},
}
},
# Returns the tag IDs of all tags inside the given tag group.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
{
"name": "get_tag_group_relationships_tags",
"table_name": "tag",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tag-groups/{id}/relationships/tags/",
"params": {
"id": {
"type": "resolve",
"resource": "get_tag_groups",
"field": "id",
},

},
}
},
# Returns the id of the tag group related to the given tag.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
{
"name": "get_tag_relationships_tag_group",
"table_name": "tag_group",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tags/{id}/relationships/tag-group/",
"params": {
"id": {
"type": "resolve",
"resource": "get_tags",
"field": "id",
},

},
}
},
# List all tag groups in an account. Every account has one default tag group. Tag groups can be filtered by `name`, `exclusive`, and `default`, and sorted by `name` or `id` in ascending or descending order. Returns a maximum of 25 tag groups per request, which can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#pagination).<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
{
"name": "get_tag_groups",
"table_name": "tag_group_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tag-groups/",
}
},
# Retrieve the tag group with the given tag group ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
{
"name": "get_tag_group",
"table_name": "tag_group_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tag-groups/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_tag_groups",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[tag-group]": "OPTIONAL_CONFIG",

},
}
},
# Returns the tag group resource for a given tag ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
{
"name": "get_tag_tag_group",
"table_name": "tag_group_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tags/{id}/tag-group/",
"params": {
"id": {
"type": "resolve",
"resource": "get_tags",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[tag-group]": "OPTIONAL_CONFIG",

},
}
},
# Return all tags that belong to the given campaign.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `campaigns:read` `tags:read`
{
"name": "get_campaign_tags",
"table_name": "tag_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaigns/{id}/tags/",
"params": {
"id": {
"type": "resolve",
"resource": "get_campaigns",
"field": "id",
},

},
}
},
# Return all tags associated with the given flow ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `flows:read` `tags:read`
{
"name": "get_flow_tags",
"table_name": "tag_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flows/{id}/tags/",
"params": {
"id": {
"type": "resolve",
"resource": "get_flows",
"field": "id",
},

},
}
},
# Return all tags associated with the given list ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `lists:read` `tags:read`
{
"name": "get_list_tags",
"table_name": "tag_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/lists/{id}/tags/",
"params": {
"id": {
"type": "resolve",
"resource": "get_lists",
"field": "id",
},

},
}
},
# Return all tags associated with the given segment ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `segments:read` `tags:read`
{
"name": "get_segment_tags",
"table_name": "tag_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/segments/{id}/tags/",
"params": {
"id": {
"type": "resolve",
"resource": "get_segments",
"field": "id",
},

},
}
},
# List all tags in an account. Tags can be filtered by `name`, and sorted by `name` or `id` in ascending or descending order. Returns a maximum of 50 tags per request, which can be paginated with [cursor-based pagination](https://developers.klaviyo.com/en/v2022-10-17/reference/api_overview#pagination).<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
{
"name": "get_tags",
"table_name": "tag_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tags/",
}
},
# Return the tags for a given tag group ID.<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `tags:read`
{
"name": "get_tag_group_tags",
"table_name": "tag_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/tag-groups/{id}/tags/",
"params": {
"id": {
"type": "resolve",
"resource": "get_tag_groups",
"field": "id",
},

},
}
},
# Returns the ID of the related template<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read` `templates:read`
{
"name": "get_campaign_message_relationships_template",
"table_name": "template",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaign-messages/{id}/relationships/template/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter

},
}
},
# Returns the ID of the related template<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `templates:read`
{
"name": "get_flow_message_relationships_template",
"table_name": "template",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flow-messages/{id}/relationships/template/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter

},
}
},
# Return the related template<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `campaigns:read` `templates:read`
{
"name": "get_campaign_message_template",
"table_name": "template_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/campaign-messages/{id}/template/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[template]": "OPTIONAL_CONFIG",

},
}
},
# Return the related template<br><br>*Rate limits*:<br>Burst: `3/s`<br>Steady: `60/m` **Scopes:** `templates:read`
{
"name": "get_flow_message_template",
"table_name": "template_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/flow-messages/{id}/template/",
"params": {
"id": "FILL_ME_IN", # TODO: fill in required path parameter
# the parameters below can optionally be configured
# "fields[template]": "OPTIONAL_CONFIG",

},
}
},
# Get all templates in an account. Filter to request a subset of all templates. Templates can be sorted by the following fields, in ascending and descending order: `id`, `name`, `created`, `updated` Returns a maximum of 10 results per page.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `templates:read`
{
"name": "get_templates",
"table_name": "template_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/templates/",
}
},
# Get a template with the given template ID.<br><br>*Rate limits*:<br>Burst: `10/s`<br>Steady: `150/m` **Scopes:** `templates:read`
{
"name": "get_template",
"table_name": "template_response_object_resource",
"primary_key": "id",
"write_disposition": "merge",
"endpoint": {
"data_selector": "data",
"path": "/api/templates/{id}/",
"params": {
"id": {
"type": "resolve",
"resource": "get_templates",
"field": "id",
},
# the parameters below can optionally be configured
# "fields[template]": "OPTIONAL_CONFIG",

},
}
},
]
}

return rest_api_source(source_config)

2. Configuring your source and destination credentials

info

dlt-init-openapi will try to detect which authentication mechanism (if any) is used by the API in question and add a placeholder in your secrets.toml.

  • If you know your API needs authentication, but none was detected, you can learn more about adding authentication to the rest_api here.
  • OAuth detection currently is not supported, but you can supply your own authentication mechanism as outlined here.

The dlt cli will have created a .dlt directory in your project folder. This directory contains a config.toml file and a secrets.toml file that you can use to configure your pipeline. The automatically created version of these files look like this:

generated config.toml


[runtime]
log_level="INFO"

[sources.klaviyo]
# Base URL for the API
# Production
base_url = "https://a.klaviyo.com"

generated secrets.toml


[sources.klaviyo]
# secrets for your klaviyo source
api_key = "FILL ME OUT" # TODO: fill in your credentials

2.1. Adjust the generated code to your usecase

Further help setting up your source and destinations

At this time, the dlt-init-openapi cli tool will always create pipelines that load to a local duckdb instance. Switching to a different destination is trivial, all you need to do is change the destination parameter in klaviyo_pipeline.py to postgres and supply the credentials as outlined in the destination doc linked below.

  • Read more about setting up the rest_api source in our docs.
  • Read more about setting up the CockroachDB destination in our docs.

3. Running your pipeline for the first time

The dlt cli has also created a main pipeline script for you at klaviyo_pipeline.py, as well as a folder klaviyo that contains additional python files for your source. These files are your local copies which you can modify to fit your needs. In some cases you may find that you only need to do small changes to your pipelines or add some configurations, in other cases these files can serve as a working starting point for your code, but will need to be adjusted to do what you need them to do.

The main pipeline script will look something like this:


import dlt

from klaviyo import klaviyo_source


if __name__ == "__main__":
pipeline = dlt.pipeline(
pipeline_name="klaviyo_pipeline",
destination='duckdb',
dataset_name="klaviyo_data",
progress="log",
export_schema_path="schemas/export"
)
source = klaviyo_source()
info = pipeline.run(source)
print(info)

Provided you have set up your credentials, you can run your pipeline like a regular python script with the following command:

python klaviyo_pipeline.py

4. Inspecting your load result

You can now inspect the state of your pipeline with the dlt cli:

dlt pipeline klaviyo_pipeline info

You can also use streamlit to inspect the contents of your CockroachDB destination for this:

# install streamlit
pip install streamlit
# run the streamlit app for your pipeline with the dlt cli:
dlt pipeline klaviyo_pipeline show

5. Next steps to get your pipeline running in production

One of the beauties of dlt is, that we are just a plain Python library, so you can run your pipeline in any environment that supports Python >= 3.8. We have a couple of helpers and guides in our docs to get you there:

The Deploy section will show you how to deploy your pipeline to

  • Deploy with GitHub Actions: Learn how to deploy your dlt pipeline using GitHub Actions for automated CI/CD. Follow the detailed guide here.
  • Deploy with Airflow and Google Composer: Discover the steps to deploy your dlt pipeline using Airflow and Google Composer. Check out the comprehensive instructions here.
  • Deploy with Google Cloud Functions: Find out how to deploy your dlt pipeline using Google Cloud Functions for a serverless setup. Explore the guide here.
  • Explore other deployment options: There are various methods to deploy your dlt pipeline. Discover more options and detailed guides here.

The running in production section will teach you about:

  • How to Monitor your pipeline: Learn how to effectively monitor your dlt pipeline in production to ensure smooth operation and quick issue resolution. How to Monitor your pipeline
  • Set up alerts: Set up alerts to get notified of any issues or important events in your dlt pipeline, ensuring you can take timely action. Set up alerts
  • Set up tracing: Implement tracing to get detailed insights into the execution of your dlt pipeline, helping you understand and optimize its performance. And set up tracing

Available Sources and Resources

For this verified source the following sources and resources are available

Source Klaviyo

Klaviyo source provides marketing, campaign, flow, and customer data for targeted engagement and analysis.

Resource NameWrite DispositionDescription
flow_action_response_object_resourceappendResponse object for flow actions
categoryappendCategories for organizing items or content
template_response_object_resourceappendResponse object for email templates
coupon_code_response_object_resourceappendResponse object for coupon codes
flow_response_object_resourceappendResponse object for flows
get_flow_message_response_compound_documentappendCompound document for retrieving flow messages
get_segment_retrieve_response_compound_documentappendCompound document for retrieving segments
itemappendIndividual items within a catalog
event_response_object_resourceappendResponse object for events
get_coupon_code_create_job_response_compound_documentappendCompound document for coupon code creation jobs
tag_group_response_object_resourceappendResponse object for tag groups
flow_message_response_object_resourceappendResponse object for flow messages
catalog_category_update_job_response_object_resourceappendResponse object for catalog category update jobs
get_catalog_item_create_job_response_compound_documentappendCompound document for catalog item creation jobs
tag_response_object_resourceappendResponse object for tags
get_flow_response_compound_documentappendCompound document for retrieving flow responses
tag_groupappendGroups of tags for categorizing and organizing content
get_catalog_category_create_job_response_compound_documentappendCompound document for catalog category creation jobs
metricappendMetrics for tracking and analyzing performance
coupon_response_object_resourceappendResponse object for coupons
catalog_category_create_job_response_object_resourceappendResponse object for catalog category creation jobs
catalog_category_delete_job_response_object_resourceappendResponse object for catalog category deletion jobs
catalog_item_update_job_response_object_resourceappendResponse object for catalog item update jobs
campaign_message_response_object_resourceappendResponse object for campaign messages
profile_import_job_response_object_resourceappendResponse object for profile import jobs
get_list_retrieve_response_compound_documentappendCompound document for retrieving lists
campaign_messageappendMessages within a campaign
get_profile_response_compound_documentappendCompound document for retrieving profiles
coupon_codeappendCodes for discount coupons
listappendLists for organizing contacts or items
catalog_variant_create_job_response_object_resourceappendResponse object for catalog variant creation jobs
catalog_variant_delete_job_response_object_resourceappendResponse object for catalog variant deletion jobs
get_tag_response_compound_documentappendCompound document for retrieving tags
campaign_response_object_resourceappendResponse object for campaigns
profile_response_object_resourceappendResponse object for profiles
segmentappendSegments for categorizing and targeting contacts
get_flow_action_response_compound_documentappendCompound document for retrieving flow actions
segment_list_response_object_resourceappendResponse object for segment lists
tagappendTags for categorizing and organizing content
account_response_object_resourceappendResponse object for accounts
catalog_category_response_object_resourceappendResponse object for catalog categories
import_error_response_object_resourceappendResponse object for import errors
list_list_response_object_resourceappendResponse object for list of lists
get_catalog_item_update_job_response_compound_documentappendCompound document for catalog item update jobs
get_catalog_variant_create_job_response_compound_documentappendCompound document for catalog variant creation jobs
segment_member_response_object_resourceappendResponse object for segment members
get_event_response_compound_documentappendCompound document for retrieving events
catalog_item_create_job_response_object_resourceappendResponse object for catalog item creation jobs
coupon_code_create_job_response_object_resourceappendResponse object for coupon code creation jobs
get_campaign_response_compound_documentappendCompound document for retrieving campaign responses
image_response_object_resourceappendResponse object for images
list_response_object_resourceappendResponse object for lists
metric_response_object_resourceappendResponse object for metrics
flow_actionappendActions within a flow
get_profile_import_job_response_compound_documentappendCompound document for profile import jobs
campaignappendMarketing campaigns
flowappendAutomated flows for marketing campaigns
get_catalog_variant_update_job_response_compound_documentappendCompound document for catalog variant update jobs
campaign_recipient_estimation_response_object_resourceappendResponse object for campaign recipient estimation
get_catalog_category_update_job_response_compound_documentappendCompound document for catalog category update jobs
catalog_item_delete_job_response_object_resourceappendResponse object for catalog item deletion jobs
segment_response_object_resourceappendResponse object for segments
profileappendCustomer profiles
catalog_item_response_object_resourceappendResponse object for catalog items
templateappendEmail templates
campaign_send_job_response_object_resourceappendResponse object for campaign send jobs
get_campaign_message_response_compound_documentappendCompound document for retrieving campaign messages
get_catalog_item_response_compound_documentappendCompound document for retrieving catalog items
campaign_recipient_estimation_job_response_object_resourceappendResponse object for campaign recipient estimation jobs
get_coupon_code_response_compound_documentappendCompound document for retrieving coupon codes
couponappendDiscount coupons
list_member_response_object_resourceappendResponse object for list members
flow_messageappendMessages within a flow
catalog_variant_response_object_resourceappendResponse object for catalog variants
catalog_variant_update_job_response_object_resourceappendResponse object for catalog variant update jobs

Additional pipeline guides

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.