Advanced KDP is not included in Klaviyo’s standard marketing application, and a subscription is required to access the associated functionality. Head to our billing guide to learn about how to purchase this plan.

Environment setup and connection

Follow these steps to prepare BigQuery for importing data into Klaviyo. You’ll create the required datasets, set up a dedicated service account and key, assign permissions, verify the configuration, and create your first import sync.

For details on how data warehouse import works in Klaviyo, including source data requirements and field mappings, see Understanding data warehouse import in Klaviyo.


1) Create the required datasets

In BigQuery, create 2 datasets in the project you’ll use for Klaviyo. Both datasets must be in the same location. Replace YOUR_PROJECT_ID and YOUR_REGION in the example with your project ID and dataset location, such as us or europe-west1.

sql
CREATE SCHEMA `YOUR_PROJECT_ID.KLAVIYO_IMPORT_FROM_DWH`
OPTIONS(location='YOUR_REGION');

CREATE SCHEMA `YOUR_PROJECT_ID.KLAVIYO_TMP`
OPTIONS(location='YOUR_REGION');
  • KLAVIYO_IMPORT_FROM_DWH: Tables and views in this dataset are available for Klaviyo to read and import.
  • KLAVIYO_TMP: Temporary or staging data used during sync operations.

Create at least 1 table or view containing the data you want to import in KLAVIYO_IMPORT_FROM_DWH. Include a timestamp column that records when each row was added or modified; you’ll select it for change detection when configuring the sync.


2) Create the Klaviyo service account and key

Create or select a Google service account dedicated to this integration, for example klaviyo-data-transfer-user. You’ll download its JSON key and provide it to Klaviyo.

  1. In the Google Cloud console, select the project from step 1, then go to IAM & Admin > Service accounts.
  2. Create a new service account (or select an existing one dedicated to Klaviyo).
  3. Open the Keys tab and select Add key > Create new key. Select JSON and click Create. Store the downloaded key file securely; you’ll need its contents when configuring the connection in Klaviyo.

3) Assign the required permissions

Grant the service account dataset access and permission to run jobs in the project, using the scopes below. You’ll need permission to manage access to these resources, or help from your Google Cloud administrator.

Resource

Required role

Description

KLAVIYO_TMP

BigQuery Data Editor

Allows Klaviyo to create, read, and delete staging tables.

KLAVIYO_IMPORT_FROM_DWH

BigQuery Data Viewer

Allows Klaviyo to read from your tables.

Your Google Cloud project

BigQuery Job User

Allows the service account to run BigQuery jobs, including queries.

sql
-- Replace YOUR_PROJECT_ID and SERVICE_ACCOUNT_EMAIL.
GRANT `roles/bigquery.dataEditor`
ON SCHEMA `YOUR_PROJECT_ID.KLAVIYO_TMP`
TO "serviceAccount:SERVICE_ACCOUNT_EMAIL";

GRANT `roles/bigquery.dataViewer`
ON SCHEMA `YOUR_PROJECT_ID.KLAVIYO_IMPORT_FROM_DWH`
TO "serviceAccount:SERVICE_ACCOUNT_EMAIL";

Run the SQL above as an administrator with permission to grant dataset access. Replace SERVICE_ACCOUNT_EMAIL with the service account’s full email address, for example klaviyo-data-transfer-user@YOUR_PROJECT_ID.iam.gserviceaccount.com. Then grant BigQuery Job User at the project level with the following Google Cloud CLI command:

bash
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
  --member="serviceAccount:SERVICE_ACCOUNT_EMAIL" \
  --role="roles/bigquery.jobUser" \
  --condition=None

4) Verify your setup (optional)

4.1 Confirm the datasets exist

Replace YOUR_PROJECT_ID and YOUR_REGION with the same project and location used in step 1. Run the SQL queries in that location. Replace example table names with an existing table or view in your source dataset.

sql
SELECT schema_name
FROM `YOUR_PROJECT_ID`.`region-YOUR_REGION`.INFORMATION_SCHEMA.SCHEMATA
WHERE schema_name IN ('KLAVIYO_IMPORT_FROM_DWH', 'KLAVIYO_TMP');

4.2 Confirm service account access

Use the service account key to authenticate with the BigQuery CLI or API and run a simple query:

bash
bq --project_id=YOUR_PROJECT_ID \
   --location=YOUR_REGION \
   query --use_legacy_sql=false \
   'SELECT COUNT(*) FROM `YOUR_PROJECT_ID.KLAVIYO_IMPORT_FROM_DWH.some_table`'

4.3 Review explicit dataset permissions

sql
SELECT object_name, privilege_type, grantee
FROM `YOUR_PROJECT_ID`.`region-YOUR_REGION`.INFORMATION_SCHEMA.OBJECT_PRIVILEGES
WHERE object_name = 'KLAVIYO_IMPORT_FROM_DWH'
  AND object_type = 'SCHEMA'
  AND grantee = 'serviceAccount:SERVICE_ACCOUNT_EMAIL';

SELECT object_name, privilege_type, grantee
FROM `YOUR_PROJECT_ID`.`region-YOUR_REGION`.INFORMATION_SCHEMA.OBJECT_PRIVILEGES
WHERE object_name = 'KLAVIYO_TMP'
  AND object_type = 'SCHEMA'
  AND grantee = 'serviceAccount:SERVICE_ACCOUNT_EMAIL';

These queries show only explicit dataset grants, not inherited permissions or the project-level BigQuery Job User grant. Replace SERVICE_ACCOUNT_EMAIL with the full service account email. If you cannot query this metadata, ask your Google Cloud administrator to review the role bindings.

4.4 Validate create/read operations

sql
-- Test create in KLAVIYO_TMP
CREATE TABLE `YOUR_PROJECT_ID.KLAVIYO_TMP.test_permissions` (id INT64);
DROP TABLE `YOUR_PROJECT_ID.KLAVIYO_TMP.test_permissions`;

-- Test select in KLAVIYO_IMPORT_FROM_DWH
SELECT * FROM `YOUR_PROJECT_ID.KLAVIYO_IMPORT_FROM_DWH.some_existing_table` LIMIT 1;

Tip: Run the service account query and create/read tests using the same account and key that you will provide to Klaviyo. Keep a copy of the results for auditing.


5) Connect to BigQuery and create an import sync

Once your BigQuery environment is configured, complete the connection in Klaviyo.

  1. In Klaviyo, open Data management > Syncing under Advanced in the left sidebar.
  2. If you already have a connection, click Create sync. If this is your first connection, go to the next step.
  3. Select Import data from your data warehouse.
  4. Choose Google BigQuery as your data warehouse.
  5. Click Connect to BigQuery.

When prompted, provide the following connection configuration details:

Field

Description

Where to Find It

Project ID

Your Google Cloud Project ID.

Found in the GCP console at the top of the project page.

Region

The location of both required datasets, for example us or europe-west1.

Use the location you selected when creating both datasets in step 1.

Service Account Key

The JSON key file you downloaded for the service account.

Paste the entire contents of the JSON key file you downloaded in step 2.

Test the connection and save the import sync

  1. Click Next to open Test connection, then click Test. Resolve any errors and test again. Once the test succeeds and finds at least 1 table or view, click Next.
  2. On Create sync, name your sync, select the source table or view and the data type, and choose Manual or Schedule run. For a scheduled sync, set the interval, start date, start time, and timezone. Click Next.
  3. On Map properties, select the timestamp column for change detection and complete the required field mappings for your data type. Click Done to save the import connection and sync.

Next step: For a manual import, open the connection and select Run manually from the sync’s action menu. To send Klaviyo data to BigQuery, configure a separate export sync using Understand data warehouse syncing in Klaviyo.


Was this article helpful?
Use this form only for article feedback. Learn how to contact support.

Explore more from Klaviyo

Community
Connect with peers, partners, and Klaviyo experts to find inspiration, share insights, and get answers to all of your questions.
Partners
Hire a Klaviyo-certified expert to help you with a specific task, or for ongoing marketing management.
Support

Access support through your account.

Email support (free trial and paid accounts) Available 24/7

Chat/virtual assistance
Availability varies by location and plan type