> This page is part of the [Customer.io documentation](https://docs.customer.io). For the complete index, see [llms.txt](https://docs.customer.io/llms.txt).
> Last updated: October 19, 2026
> To take actions in Customer.io from an agent, use the [Customer.io CLI](https://docs.customer.io/ai/cli/get-started.md) or the [MCP server](https://docs.customer.io/ai/mcp/get-started.md).

# Understanding reverse ETL integrations

## How it works

Customer.io’s reverse ETL features help you bring in data from your data warehouse without a separate tool. You can connect supported data warehouses and databases to Customer.io, so you can use your data to trigger automations, build audiences, and more. You can also send the data you sync on to other services downstream.

When you set up a reverse ETL integration, you’ll set up one or more *syncs*. This is the kind of [API call](https://docs.customer.io/integrations/data-in/source-spec/incoming-data/) you want to transform your data into (like `track`, `identify`, etc) and the query that returns the data you want to use in Customer.io. Each row returned from the query represents an API method.

You’ll have to create a *sync* for each kind of method or data you want to use in Customer.io or other integrations. We run your query on the interval you choose, as often as every minute, and expose a `last_sync_time` value that you can use to make sure that you only sync data that changed since the previous sync interval.

## Add a reverse ETL or database integration

Before you add an integration, we suggest that you set up a service account or create a user account specifically for Customer.io with read-only access to the tables you want to sync. This helps you ensure the security of your data, and gives you a way to revoke access if you need to.

**Your database or storage bucket must allow connections from the following IP addresses**. If our IP addresses are blocked, we won’t be able to connect to your database.

US Region

EU Region

34.29.50.4

34.22.168.136

35.222.130.209

34.78.194.61

34.122.196.49

104.155.37.221

34.9.152.53

34.78.153.242

34.170.216.131

34.78.94.137

35.222.84.131

34.140.151.135

34.57.129.127

34.62.147.132

1.  Go to *Integrations* and make sure you’re in the **Directory** tab.
2.  Find and select your *Data Warehouse* or *Database*. Make sure it says *Data In*; we offer some data-out integrations for these same data warehouses and databases!
3.  Give your database a name and connect your database to Customer.io

     ![connect your database](https://docs.customer.io/images/cdp-source-mysql.png)

4.  Set up a **Sync**. A sync is the type of data (`identify`, `track`, etc) you want to import from your database and click **Next: Define Query**. You can set up syncs for each type of data you want to import.
    1.  Provide a *Name* and *Description* for the sync. This helps you understand the sync at a glance when you look at your integration’s *Overview* later.
    2.  Select the [type of data](https://docs.customer.io/integrations/data-in/source-spec/incoming-data/) you want to import.
    3.  Set the *Sync Frequency*, indicating how often you want to query your database for new data. You should set the frequency such that sync operations don’t overlap. [Learn more about sync frequency](#sync-frequency).
    4.  Select when you want to start the sync: whether you want to begin importing data immediately, or schedule the sync to start at a later date.

         ![add a sync and determine the data you want to capture](https://docs.customer.io/images/cdp-source-etl-add-sync.png)

5.  Enter the query that selects the data you want to import. Click **Run Query** to preview results and make sure that your query selects the right information.

     ![set up your query to sync the right information](https://docs.customer.io/images/cdp-etl-source-define-query.png)

6.  Click **Enable** to enable your sync.

Now you can connect your database to places outside of Customer.io.

### SSH Tunneling

For added security, we support SSH tunnelling for our [MySQL](https://docs.customer.io/integrations/data-in/connections/reverse-etl/mysql/), [PostgreSQL](https://docs.customer.io/integrations/data-in/connections/reverse-etl/postgresql/), and [Microsoft SQL Server](https://docs.customer.io/integrations/data-in/connections/reverse-etl/microsoft-sql/) integrations.

To set up your tunnel, you’ll generate a public key when you add your database:

1.  Enable SSH tunneling.
2.  Provide the hostname and port of your SSH server.
3.  Click **Generate Public Key** to generate a public key for your SSH server.
4.  Copy the public key to your SSH server and click **Connect**.

 ![connect your database](https://docs.customer.io/images/cdp-source-reverseetl-ssh.png)

#### Rotating SSH Keys

You can return to your integration and generate a new public key for your SSH server at any time.

1.  Go to *Integrations* and select your database in the **Connections** tab.
2.  Go to the **Databases** tab and click the settings icon and go to **Edit**.
3.  Click **Generate Public Key** to generate a new public key and copy the key to your SSH server to continue connecting to your database.

We won’t save or use the key until you click **Save Database**, and we won’t let you save your changes until your database connection is active with the new key.

 ![Generate a new SSH key to rotate out your old public key](https://docs.customer.io/images/cdp-source-reverseetl-ssh-rotate.png)

## Add additional sync models

A *sync* defines the type of call you want to make to Customer.io. Your query that returns the data you want to capture on every interval. Each row returned from the query represents an individual API call.

After you [set up your integration](#add-a-reverse-etl-source), you can add subsequent syncs to extract and transform data into additional calls by going to the **Sync** tab for your integration and clicking **Add sync**.

 ![add a sync](https://docs.customer.io/images/cdp-source-etl-add-sync.png)

### Last sync time: sync only the records you want

We expose a `last_sync_time` variable that you should use in your query to sync only the records that have changed since the last sync. This helps you avoid syncing the same records repeatedly, which can cause each query to take longer and risk sending duplicate information into Customer.io or other places.

We strongly recommend that you index a column in your database representing the date-time each row was last-updated. When you write your query, you should add a `WHERE` clause comparing your “last updated” column to the `{{last_sync_time}}`.

The last sync time is a Unix timestamp representing the date-time when the previous successful sync started. The first time you sync, `{{last_sync_time}}` is `0`, so you sync all records. After that, you only sync records that have changed since the last sync.

```
SELECT id AS userId, email, first_name, created AS created_at
FROM my_people
WHERE UNIX_TIMESTAMP(last_updated) > {{last_sync_time}}
```

### Deduplication using `messageId`

We use a `messageId` to represent operations from your reverse ETL sync. We process the first instance of any operation with a given `messageId` and ignore any operations with the same `messageId` for 12 to 24 hours. Reverse ETL uses the [same deduplication window](https://docs.customer.io/integrations/data-in/source-spec/common-fields/#messageid-deduplicate-calls) as calls that come in through the Pipelines API or one of our SDKs. Events your sync creates get a second, longer check on top of that: we ignore an event that repeats one already in your workspace from the last [30 days](https://docs.customer.io/messaging/people/events/#deduplicating-events).

If your query doesn’t include a `messageId`, we’ll generate one by hashing the sync ID, the sync type, the time you last saved the sync, and every column name and value in the row.

If you include your own, you should ensure that it is capable of deduplicating operations like generated values.

*   For events, you might use a source event ID—something representing a unique event for an individual user. An event’s `messageId` can’t be longer than 191 characters. We drop an event with a longer `messageId`, so it never syncs. If your source ID is longer, hash it.
*   For person, object, or relationship updates, use a hash of the source primary key plus the relevant updated timestamp or payload. Don’t use values like `userId` or `groupId`; these can suppress legitimate later updates during the deduplication window. For example, if you use `userId` as your `messageId`, you’re effectively limited to one update per user per deduplication window.

**If you need to resync data**: edit and save the sync definition to generate new `messageId` values. Otherwise, we’ll consider rows that we already received with the same values to be duplicates, and your resync won’t include them. For person, object, and relationship updates, you can wait more than 24 hours after the last sync instead. For event syncs, saving the sync definition is the practical option, because we deduplicate events in your workspace for 30 days.

### Update existing people without creating new ones

By default, `identify` requests create new people in Customer.io for any `userId` that doesn’t already exist. If you want to update existing people without adding new ones, you can use the `_update` parameter in your query.

```
SELECT
  userId,
  email,
  someAttribute,
  true AS '_update'
FROM
  peopleTable
WHERE
  updatedAt > {{last_sync_time}}
```

### Reserved properties and traits

We automatically treat values that aren’t reserved by our API calls as `traits` or event `properties` depending on the type of call you send, so you don’t have to force your query to return data exactly in the shape our API expects. For example, if you want to set the `email` trait, you can return `user.email AS email`.

**For `identify` or `group` data**, any property other than the following goes in the `traits` object: `userId`, `anonymousId`, `groupId`, `integrations`, `messageId`, `timestamp`, `context`.

**For `track`, `page`, and `screen` data**, any property other than the following goes in the `properties` object: `userId`, `anonymousId`, `event`, `integrations`, `messageId`, `timestamp`, `context`.

These fields correspond to the common fields that we reserve in each API call, and extend to children of these reserved fields. For example, `context.ip` is also reserved. [Learn more about common fields in our APIs](https://docs.customer.io/integrations/data-in/source-spec/common-fields/).

## Nested traits, properties, and relationship attributes

When you set up a sync, you’re essentially propagating the result of a `SELECT` query to the [Pipelines API](https://docs.customer.io/integrations/api/cdp/). Some properties or attributes require you to nest data. Or you might simply want to nest properties based on how you expect them in Customer.io.

Some reverse ETL integrations support dot notation, like `SELECT product AS 'cart.product_name'`. But some, like BigQuery, don’t. You can support nested items in a platform-agnostic syntax using `JSON_OBJECT`. This lets you build an object from items in your query by alternating keys and values in order, e.g. `key, value, key, value`.

For example, if you relate someone to a company (a [custom object](https://docs.customer.io/messaging/objects-data/objects/start/) ), and you want to set attributes for the relationship, you’d nest them inside a `traits.relationshipAttributes` object. But BigQuery doesn’t support dot notation, so here’s how you’d do that:

```
SELECT
   id as groupId,
   name,
   json_object(
      'job_title', job_title,
      'primary_contact', primary_contact
   ) as relationshipAttributes
```

You may need to do the same for other objects, like device context, relationship attributes, and so on. See our [API documentation](https://docs.customer.io/integrations/api/cdp/) for more information about the structure of our payloads and properties you might need to pass as objects.

### Sync Frequency

You can sync data as often as every minute. However, we recommend that you set your sync frequency such that sync operations don’t overlap. If you schedule syncs such that a sync operation is scheduled to start while the previous operation is still we’ll skip the next sync operation.

## Enable and disable syncs

In your integration, you can go into the **Syncs** tab to enable and disable syncs. You can also delete syncs from this tab.

When you **disable** a sync, we stop running the associated query and sending the type of data to the places you’ve connected your integration to—including Customer.io. We don’t delete the sync, so you can re-enable it later.

When you **enable** a sync, we’ll resume the sync. The next sync interval will send all data that has changed since the last sync.

 ![enable or disable a sync](https://docs.customer.io/images/cdp-source-sync-enable.png)

## Errors and sync history

In the **Imports** tab for your integration, we display a row for each sync interval showing the number of successful and unsuccessful rows—where each row represents an individual operation (like an `identify` call or a `track` call). You can click a sync to see errors. Typically errors occur when a row is either missing data or contains data that doesn’t map to the appropriate source call type.

If a sync has errors, the row also includes a *Download* button, so you can download a list of errors.

 ![View your sync history](https://docs.customer.io/images/cdp-etl-source-imports.png)

You can also go to the **Syncs** tab to see the status of your syncs, how often they run, and their last run time. You might use this tab to see if your syncs complete on time or if you need to decrease the frequency of syncs.

The **Data In** tab also shows successful source calls. You can use this to see exactly how your rows map to source calls.

 ![View your sync history](https://docs.customer.io/images/cdp-etl-source-data-in.png)

### Retry behavior

When a sync fails with a temporary error—like a network timeout, a refused connection, or a dropped database connection—we wait a short time and automaticall retry the sync. You don’t need to do anything for these errors.

We don’t retry syncs on non-temporary errors; for these kinds of errors, we wait until the next scheduled interval to try again. These errors include:

*   **Invalid credentials.** If the username, password, or access token for your database is wrong.
*   **Query problems.** These include invalid SQL, a reference to a column or table that doesn’t exist, or a query that returns more rows than [our limits](#result-limits) allow.

### Missing rows

Missing rows are often due to the value you compare to [`last_sync_time`](#last-sync-time-sync-only-the-records-you-want).

```
SELECT id AS userId, email, first_name, created AS created_at, message_id AS messageId
FROM my_people
WHERE UNIX_TIMESTAMP(last_updated) > {{last_sync_time}}
```

If you can, update `last_updated` based on when your syncs start. If you can’t do this, you’ll need to change your query. For example, you could query for results beginning 5 minutes before the previous sync to give yourself a buffer and make sure that your query doesn’t miss results you want to sync:

```
WHERE UNIX_SECONDS(last_updated) >= {{last_sync_time}} - 300
```

We deduplicate rows automatically—either based on a `messageId` you provide or by hashing values in each row. See [Deduplication and full resyncs](#deduplication-and-full-resyncs) for more information. If you’re missing rows, they may have been deduplicated.

## Sync query limits

Name

Details

Limit

Maximum query length

The maximum length allowed for any query.

131,072 characters

`userId` column name length

The maximum length allowed for the userId column name.

191 characters

timestamp column name length

The maximum length for the timestamp column name.

191 characters

Event `messageId` length

The maximum length of the `messageId` on an event. We drop an event with a longer `messageId`.

191 characters

Sync frequency

The shortest possible duration between syncs.

1 minutes

## Result limits

A sync cannot return more than 40 million records and 300 total columns.

Name

Details

Limit

Record count

The maximum number of records a single sync will process. Note: This is the number of records extracted from the warehouse not the limit for the number of records loaded to the integration (for example, new/update/deleted).

40 million records

Column count

The maximum number of columns a single sync will process.

300 columns

Column name length

The maximum length of a record column.

128 characters

Record JSON size

The maximum size for a record when converted to JSON (some of this limit is used by Customer.io).

512 KiB

Column JSON size

The maximum size of any single column value.

128 KiB
