Integration Guide
LightCDP takes data in through three channels - the Public API, Airbyte (or another ELT tool), and File Import. This guide covers four ways to use them: send rows in real time with the Public API, load CSV or JSONL files with the built-in File Import (upload them in the admin panel or let CDP watch a folder in your S3 bucket), export files to S3 and replicate them with Airbyte, or let Airbyte pull data straight from your databases.
Integration Methods
Choose the method that best fits each data source. You can use them side by side for different sources.
| Method | Best For | Latency | Setup Complexity |
|---|---|---|---|
| 1. Public API | Web/mobile apps, POS terminals, microservices that fire events as they happen | Seconds | Low - one HTTP call per batch of up to 1000 rows |
| 2. File Import (built-in) | Analysts and operators loading CSV or JSONL exports, one-off backfills, nightly files dropped in an S3 folder | Minutes (upload); the next scan for a watched folder (hourly or slower) | Low - no code; set up an import source in the admin panel |
| 3. Export / Import (S3 + Airbyte) | Legacy systems, CRMs, ERP batch exports, applications that already produce CSV/file exports | Minutes–hours (scheduled batch) | Medium - export pipeline + one-time Airbyte connector setup |
| 4. Database Pull | Internal databases you own and control - PostgreSQL, MySQL, BigQuery, Snowflake, and more | Minutes–hours (scheduled batch) | Medium - schema mapping view + one-time Airbyte connector setup |
Latency is the time until rows land in raw data. Rows become events on the table's next Transform (every hour when Auto Transform is on, or when you run Transform), and rows from the last ~15 seconds wait for the following run - see Processing Raw Data in CDP Admin.
raw_data table and go through the same pipeline (Raw Data → Events → Source Profiles → Unified Profiles). File Import does not replace Airbyte - it is a third channel next to it.
Method 1 - Public API
Prerequisites
Before you can send data to CDP, make sure you have the following in place:
-
A running CDP instance
CDP must be deployed and reachable. Contact your system administrator to set up your own instance. -
A raw table open to the Public API, and an API key for it
In the admin panel, go to Ingestion > Data Sources (the Raw Data page). If the table does not exist yet, create it with Create table; CDP adds the tracking columns_cdp_raw_idand_cdp_extracted_atfor you. Open the table and, under How data flows through this table, click Add a source > Public API. In Allow an API key to write here, pick an existing key and click Allow, or click Create a new API key, which opens the API Keys page with the Create API Key dialog pre-filled for this table. A table created outside CDP without the tracking columns shows "This table is not set up for it yet - it is missing the CDP tracking columns." and cannot be opened to the API. -
The CDP API base URL for your deployment
This is the host where yourcdp-apiservice is running, for examplehttps://<your-cdp-api-host>. The interactive reference for every public endpoint is served by that host athttps://<your-cdp-api-host>/docs/public.
api_key and secret_key, and the admin API returns them as write_key and write_secret. Keys look like cdp_wk_ followed by 64 hex characters. See Admin Guide > API Keys.
Authentication
CDP uses HTTP Basic Authentication for the Public API. Encode api_key:secret_key as base64
and pass it in the Authorization header with every request.
The header format is:
Authorization: Basic <base64(api_key:secret_key)>
You can generate the base64-encoded credential string from a terminal:
echo -n "your_api_key:your_secret_key" | base64
# Output: eW91cl9hcGlfa2V5OnlvdXJfc2VjcmV0X2tleQ==
The secret may itself contain :; everything after the first colon is treated as the secret.
secret_key in client-side browser code or public repositories. Use server-side code for event tracking. If you need to track events from a browser, build a thin backend proxy that holds the credentials and forwards events to CDP.
Request Body Reference
The ingest and verify endpoints accept a JSON body with these top-level fields:
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
source_table |
string | REQUIRED | 1–255 chars, ^[A-Za-z_][A-Za-z0-9_]*$ |
Name of the target raw_data table. The Public API must be enabled for it in the admin panel: open the table in Ingestion > Data Sources and choose Add a source > Public API. |
rows |
array | REQUIRED | 1–1000 items; each row at most 500 keys; whole body at most 4 MB | Array of row objects. Each object is one row of raw_data.<source_table>. Column names and types must match the table's actual schema. |
is_lenient |
boolean | OPTIONAL | Default false |
Strict by default: a key that matches no column fails the request. Set to true to drop unknown keys instead and get an UnknownColumnsDropped warning. Every other check stays strict. |
Discovering columns and checking a payload
GET /api/public/v1/tables/{source_table}/schema returns columns (name, type, optional),
required_columns, primary_key, sorting_key, partition_key and an
example_body you can send as-is after replacing the placeholder values:
{
"source_table": "my_events",
"columns": [
{ "name": "order_id", "type": "String", "optional": false },
{ "name": "email", "type": "Nullable(String)", "optional": true },
{ "name": "occurred_at", "type": "DateTime64(3)", "optional": false }
],
"required_columns": ["order_id", "occurred_at"],
"primary_key": "occurred_at, order_id",
"sorting_key": "occurred_at, order_id",
"partition_key": null,
"example_body": {
"source_table": "my_events",
"rows": [{ "order_id": "example_string", "email": "example_string", "occurred_at": "2026-08-11 09:30:00.000" }]
}
}
POST /api/public/v1/raw-data/verify takes the same body as the ingest call and writes nothing. It returns
200 with {"valid": true|false, "source_table": ..., "checked": N}, plus errors
(same per-row shape as ColumnValidationFailed) when valid is false, and
warnings in lenient mode. Authentication, scope and table errors (401, 403, 404) are returned the same way as for ingest.
{
"valid": false,
"source_table": "my_events",
"checked": 2,
"errors": [
{ "index": 1, "issues": [ { "path": "order_id", "expected": "String", "got": "missing" } ] }
]
}
source_table has its own columns, read live from ClickHouse; a column you add is accepted within about 10 seconds.
Only key columns are required: a column that is not Nullable and is part of the table's sorting, primary or partition
key must be present and not null. Every other column may be left out and gets its default. Column names are case-sensitive.
A key that matches no column fails the request unless is_lenient is true. Do not send
_cdp_raw_id, _cdp_extracted_at or _cdp_additional_properties - CDP fills or reserves them, and a row that
includes one fails even in lenient mode. Each failing row is reported with its index, so one call shows every problem
(up to 20 rows and 10 issues per row).
Value formats
Each value is checked against the ClickHouse type of its column before anything is written:
| Column type | Accepted JSON value |
|---|---|
String |
A string. Numbers are not converted to text. |
Int8 … Int256, UInt8 … UInt256 |
An integer, or a string of digits. Range-checked for the column's width. |
Float32, Float64 |
A finite number. Numeric strings, NaN and Infinity are rejected. |
Decimal(P,S) |
A string (recommended) or a number, with at most S decimal places. |
Bool |
true / false, or 0 / 1. The string "true" is rejected. |
Date |
"YYYY-MM-DD" |
DateTime, DateTime64(P) |
Send "YYYY-MM-DD HH:MM:SS" or the ISO form with T, optionally with Z or an offset such as +09:00. DateTime takes no fractional seconds; DateTime64(P) takes up to P digits (more is an error, not truncated). Values with an offset are converted to UTC; a value with no offset is taken as UTC, so send an offset if your clock is not UTC. |
UUID |
A 8-4-4-4-12 hex string. |
Nullable(T) |
null, or a valid T. |
Array(T) |
A JSON array of T. |
Map(K,V) |
A JSON object. |
JSON |
A JSON object only - not a JSON-encoded string, array or number. Stored normalized: keys whose value is null or {} are dropped, a key with a dot becomes nested, a mixed array becomes strings, and 1.10 becomes 1.1. To keep a value exactly as sent, use a String column and send the JSON as a string. |
Large numbers: integers past 2^53 and decimals with more than 15 significant digits are stored exactly from the digits
you send (for example 18446744073709551615 into UInt64). JavaScript clients usually round such numbers before
sending, so send them as strings. Inside a JSON column, an integer outside -9223372036854775808 to
18446744073709551615 or a real with more than 15 significant digits is rejected with its full path (for example
payload.score); send it as a JSON string to keep it exactly.
Send Raw Data Rows
Endpoint: POST /api/public/v1/raw-data
Send a JSON body with source_table (a raw_data table with the Public API turned on that your key may write to) and
rows (an array of row objects, up to 1000 per request). Each object is one row of that table.
Include the Authorization header with your base64-encoded api key credentials.
const axios = require('axios');
const CDP_API_URL = 'https://<your-cdp-api-host>';
const CDP_API_KEY = 'your_api_key';
const CDP_API_SECRET = 'your_secret_key';
const credentials = Buffer.from(`${CDP_API_KEY}:${CDP_API_SECRET}`).toString('base64');
async function ingestRows(sourceTable, rows) {
const response = await axios.post(
`${CDP_API_URL}/api/public/v1/raw-data`,
{ source_table: sourceTable, rows },
{
headers: {
'Authorization': `Basic ${credentials}`,
'Content-Type': 'application/json',
},
}
);
return response.data; // { success: true, source_table: '...', accepted: N }
}
// Example: ingest a purchase row
ingestRows('my_events', [{
email: 'user@example.com',
user_id: 'user_123',
order_id: 'ord_789',
amount: '99.99',
currency: 'USD',
occurred_at: new Date().toISOString(),
}]).catch(err => console.error(err.response?.data ?? err.message));
import requests
import base64
from datetime import datetime, timezone
CDP_API_URL = 'https://<your-cdp-api-host>'
CDP_API_KEY = 'your_api_key'
CDP_API_SECRET = 'your_secret_key'
credentials = base64.b64encode(
f'{CDP_API_KEY}:{CDP_API_SECRET}'.encode()
).decode()
def ingest_rows(source_table: str, rows: list) -> dict:
response = requests.post(
f'{CDP_API_URL}/api/public/v1/raw-data',
json={'source_table': source_table, 'rows': rows},
headers={'Authorization': f'Basic {credentials}'},
timeout=10,
)
response.raise_for_status()
return response.json() # {'success': True, 'source_table': '...', 'accepted': N}
# Example: ingest a purchase row
ingest_rows('my_events', [{
'email': 'user@example.com',
'user_id': 'user_123',
'order_id': 'ord_789',
'amount': '99.99',
'currency': 'USD',
'occurred_at': datetime.now(timezone.utc).isoformat(timespec='milliseconds'),
}])
CDP_API_URL="https://<your-cdp-api-host>"
CREDENTIALS=$(echo -n "your_api_key:your_secret_key" | base64)
curl -X POST "${CDP_API_URL}/api/public/v1/raw-data" \
-H "Authorization: Basic ${CREDENTIALS}" \
-H "Content-Type: application/json" \
-d '{
"source_table": "my_events",
"rows": [{
"email": "user@example.com",
"user_id": "user_123",
"order_id": "ord_789",
"amount": "99.99",
"currency": "USD",
"occurred_at": "2026-01-15T10:30:00.000Z"
}]
}'
The samples assume occurred_at is a DateTime64(3) column. A plain DateTime column takes no fractional seconds, so send a value such as "2026-01-15 10:30:00" instead - see Value formats.
Response
A successful request returns HTTP 201 with a JSON body:
{
"success": true,
"source_table": "my_events",
"accepted": 1
}
Rows land in raw_data.<source_table>. They become events once the table is mapped as an event source in
Ingestion > Events: with Auto Transform on (it is off by default), the transform runs every hour; otherwise, run it with
Transform. Rows written in the last ~15 seconds wait for the next run. A 201 means the rows are durably stored
as raw - they are not yet curated events. See Processing Raw Data in CDP Admin.
If you send is_lenient: true and some keys matched no column, those keys are dropped, the rest of each row is stored,
and the 201 response adds one combined warning:
{
"success": true,
"source_table": "my_events",
"accepted": 2,
"warnings": [
{
"code": "UnknownColumnsDropped",
"message": "2 column(s) across 2 row(s) do not exist on raw_data.my_events and were dropped; the rest of each row was kept. Check for a typo in the column names.",
"columns": ["emial", "utm_source"],
"row_count": 2
}
]
}
columns lists up to 20 names (truncated: true beyond that). A row where no key matches any column still fails.
A sample success body is in sample-event-response.json.
Error Handling
The Public API returns standard HTTP error codes. Handle these in your integration.
Error bodies are {"error": "<code>", "message": "..."} (some add details; ValidationError
uses issues instead of message, and a 500 carries only error). There is no status field in the body - use the HTTP status.
Sample bodies for every status are in sample-error-responses.json.
| Status | Error Message | Cause | Fix |
|---|---|---|---|
401 |
Missing Basic credentials. | No Authorization header present |
Add Authorization: Basic ... header to every request |
401 |
Invalid credentials format. | The decoded value has no colon, or the key or secret part is empty | Ensure you encode the string as api_key:secret_key (colon-separated) before base64 encoding |
401 |
Invalid write key. | Key not found, has been revoked or deleted, or the secret does not match | Check on the API Keys page that the key's Status is Active (a revoked or deleted key stops working immediately) |
400 |
ValidationError | Missing or invalid source_table, empty rows, more than 1000 rows, or a row with more than 500 keys; the response lists issues as {path, message, code} |
Ensure source_table and rows are present and within limits |
400 |
ColumnValidationFailed | One or more rows have missing required columns, unknown columns, reserved columns, or type mismatches | Check details.errors in the response body - one entry per failing row, with its index and issues ({path, expected, got}); details.truncated is true when more than 20 rows failed. Call GET /api/public/v1/tables/{source_table}/schema to see the expected column types |
403 |
Forbidden | The key's scope does not include this source_table. The message reads Write key is not allowed to write to source_table "<name>". The same check applies to the schema and verify endpoints |
Open the table in Ingestion > Data Sources, click Add a source > Public API and Allow this key, or on the API Keys page use Edit Scope on the key. A key with no tables selected and Allow all source tables unchecked is blocked for every table |
404 |
SourceTableNotRegistered | source_table does not exist in raw_data, or the table's Public API input is not turned on. Listing the table in a key's scope (for example through Edit Scope) does not turn the input on by itself |
Create the table in Ingestion > Data Sources if needed, then open it and use Add a source > Public API - allowing a key there turns the input on |
409 |
RawTableMissing | The ClickHouse table was dropped after CDP last looked it up | Retry once (CDP clears its cached lookup automatically). If the table is really gone, the retry answers 404 SourceTableNotRegistered: recreate it in Ingestion > Data Sources and make sure the Public API is enabled for it |
502 |
ClickHouseInsertFailed | ClickHouse rejected the insert after validation passed | Retry with exponential backoff; check server logs if the error persists |
500 |
InternalServerError | An unexpected server error. A body over 4 MB or a body that is not valid JSON is also rejected this way today, before authentication is checked | Keep each request under 4 MB and 1000 rows and send valid JSON; retry with backoff only when the body is valid |
Do not retry 400, 401, 403 or 404 - fix the request or configuration instead. Retry 409 once. Retry 502 and other 5xx with backoff. The wrapper below follows these rules around the ingestRows function from the samples above:
async function ingestRowsWithRetry(sourceTable, rows, maxRetries = 3) {
let retried409 = false;
for (let attempt = 1; ; attempt++) {
try {
return await ingestRows(sourceTable, rows);
} catch (err) {
const status = err.response?.status;
// 400, 401, 403, 404: fix the request or configuration, never retry
if ([400, 401, 403, 404].includes(status)) throw err;
// 409 RawTableMissing: retry once
if (status === 409) {
if (retried409) throw err;
retried409 = true;
continue;
}
// 502, other 5xx and network errors: exponential backoff
if (attempt >= maxRetries) throw err;
await new Promise(r => setTimeout(r, Math.pow(2, attempt) * 500));
}
}
}
Retries and duplicates
Each request is all or nothing: if any row fails validation, nothing is written, and a 201 means every row was stored.
There is no idempotency key, so sending the same batch again (for example after a timeout) stores the rows in raw data again; tables
created in CDP keep every copy. The Events stage collapses them: each event is keyed on a hash of its mapped values (or only of the
Dedup Key columns you pick in the mapping), so identical retried rows give one event. If a retried row can differ from the
original - for example a timestamp set at send time - give each row a stable business key such as order_id and select it
as the Dedup Key.
Testing Your Integration
Check your integration end to end with the verify endpoint and the CDP admin panel:
-
Check your payload
CallPOST /api/public/v1/raw-data/verifywith your body; it returnsvalid: trueor the problems, and writes nothing (see Discovering columns and checking a payload). -
Send a test row
Use the cURL example above (or your preferred language) to send a test row to asource_tableyour key may write to. -
Open the CDP admin panel
Navigate to your CDP deployment's admin URL and log in with your admin credentials. -
Check the raw row
Go to Ingestion > Data Sources, open your table and click Data preview to confirm the row appears. -
Turn it into an event
Go to Ingestion > Events. If your table is not listed yet, click Add event source and map it (Data Source, Event Type, Event Timestamp, the columns to keep, and at least one Identity column with its kind), then Save. From the row menu choose Transform, then open the event source to see the new event in its Events card. The full steps are in Processing Raw Data in CDP Admin.
201 response means the rows are durably stored in raw_data.<source_table> and show up in the table's Data preview (Ingestion > Data Sources, open the table) within seconds. They are not yet visible as curated events - that requires the Transform step above.
Method 2 - File Import
File Import is the third channel into raw data, next to the Public API and Airbyte (or another ELT tool). It loads CSV or JSONL files
into a raw_data table without Airbyte and without code. Each import source writes to exactly one table and works in one
of three modes:
- Upload - you upload a file whenever you want to import it.
- Scheduled scan - CDP watches a folder in your S3 bucket on a schedule and imports new files automatically.
- Manual scan - CDP watches a folder but scans only when you click Scan now.
One file is one run, so a bad file never affects another. File Import only writes raw rows. They become events through the table's normal Transform, exactly like API or Airbyte rows.
Set Up an Import Source
-
Open File Import for the table
In Ingestion > Data Sources, open the target table. Under How data flows through this table, click Add a source > File imports, then click Create a new import source in Import sources for this table. This turns File Import on for the table and opens the Data Imports screen with the table pre-selected. -
Register your bucket (watched folders only)
On the File Locations tab, click Add File Location and enter Name, S3 bucket and Region. Folder prefix (optional) and Custom endpoint (optional) are under Advanced options. Enter an Access key ID and Secret access key, or leave both blank to use the server's default role, then use Test connection. One file location per bucket is enough: each import source adds its own folder prefix to the location's prefix, so several sources can watch different folders of the same bucket. CDP needs onlys3:ListBucketands3:GetObject, and it never writes to, moves or deletes anything in your bucket. -
Create the import source
On the Import Sources tab, click New Import Source. Choose Mode, Name, Target table and File format (CSV or JSONL). For scan modes, also pick the File location, an optional Folder prefix (for exampleorders/) and an optional File name pattern (optional): only*and?are supported, matched on the file name. The source scans the location's prefix followed by its folder prefix, sub-folders included; the form shows the Scanned path as you type. For Scheduled scan, pick the Frequency: Every hour, Every N hours, Daily or Weekly, in UTC. Click Create Source. Mode, target table, file format and file location cannot be changed later; create a second source instead. -
Upload a file (Upload mode)
Creating an Upload source opens the upload panel straight away; later, choose Upload file on the source. The upload has three steps:- Pick the file and click Check file. CDP checks the first 256 KB (CSV) or 512 KB (JSONL) against the source's settings before anything is uploaded.
- Review the preview and click Next.
- Click Upload & import.
- A source must be paused before you can edit or delete it.
- A table can have one active scan source and one active upload source at a time.
- Who can do what (default roles): Editor - Data Sources can turn File Import on for a table (
raw_data:manage_event_source) and can create import sources, upload files and scan (file_imports:create). Registering a bucket on the File Locations tab needsfile_locations:create, which is in Editor - Profiles and Admin, so ask one of them if no file location exists yet. - For every tab and action on the Data Imports screen, see Admin Guide > File Imports.
File Formats
The format is declared on the import source. These rules apply to files loaded with File Import:
| Rule | CSV | JSONL |
|---|---|---|
| Extensions | .csv |
.jsonl or .ndjson |
| Structure | Comma-delimited only; the first row must be the header; standard RFC 4180 quoting (quoted fields may contain commas and line breaks; a quote inside is doubled) | One JSON object per line, no header |
| Encoding | UTF-8 with or without BOM, or CP932 (Shift_JIS). File encoding defaults to Auto-detect, which reads only the first 256 KB, so pick CP932 for sources that receive Japanese files. UTF-16 is not supported: save from Excel as "CSV UTF-8" | UTF-8 only |
| Column matching | Header names must match the target column names exactly (case-sensitive, no trimming) unless remapped in Column mapping | Keys are matched to column names per row; a missing key leaves the column at its default. The column list in the preview comes from the first 512 KB, so a key that first appears later is not matched by name |
| Rows | Every row must have as many cells as the header; blank lines are skipped | One object per line |
Both formats
- The format is declared on the source. A file whose extension names the other format (for example
.csvon a JSONL source) is refused; a file with no extension or an unfamiliar one is read normally. - Files must not contain the CDP columns
_cdp_raw_id,_cdp_extracted_ator_cdp_additional_properties. - The file must write every required key column of the table (a non-nullable column in the sorting, primary or partition key).
- Column mapping on the source maps a target column to a differently named file column, and one file column can feed several target columns.
- Unmapped file columns are dropped, or kept as JSON in
_cdp_additional_propertieswhen Collect unmapped columns is on (the table must have that column). - Long numbers keep every digit, under the same rules as the Public API (see Value formats).
Not supported: compressed files, TSV / semicolon / pipe delimiters, Parquet, Avro, Excel files, header-less CSV - use Method 3 (S3 + Airbyte) for those.
Limits: 3 GB per file (a warning above 500 MB), 500 columns or keys, 1 MB per line.
Runs and Rejected Rows
Each file is read once. Rows are checked as they are read and inserted in batches. Import stops at the first invalid row: that row and everything after it is skipped, and you get a downloadable report of every problem found. If the first invalid row comes before anything was written, the file imports zero rows (Rejected). If some batches were already written, those rows stay and the run ends Partially imported.
Every file gets a run on the Runs tab, with one of these statuses:
| Status | Meaning |
|---|---|
| Pending | Waiting in the queue. Only one import runs per table at a time, and up to 3 tables import at once. |
| Reading | The file is being read and checked; nothing has been written yet. |
| Inserting | Rows are being written to the table. |
| Done | Every row was imported. |
| Rejected | A content problem; nothing was imported. |
| Partially imported | Some rows are in and cannot be rolled back. |
| Failed | The file could not be read or written, and nothing was imported. A watched folder picks the file up again on the next scan; an upload must be re-run. |
| Canceled | The run was canceled while it was still Pending; nothing was imported. |
The reject report
rejects.csvfor a CSV source: columns_reject_lineand_reject_reason, then your original columns, so you can fix it in a spreadsheet and upload it again.rejects.jsonlfor a JSONL source: one object per line with_reject_line,_reject_reasonand_raw(the original line).
Download it from the run with Download rejects.csv or Download rejects.jsonl.
Watched folders and re-runs
On a Scheduled scan source, a file modified in the last 3 minutes waits for the next scan. Scan now on a Manual scan source takes it right away. Each file is imported once per source, and a replaced file with new content counts as a new file.
A source scans the file location's prefix followed by the source's own Folder prefix, including every sub-folder below it, and then matches the file name pattern. Changing the file location's prefix moves every source attached to it on its next scan. A source remembers how far it has scanned (Scanned up to in the source's details) and skips files last modified more than 48 hours before that point. If you point a source at a folder of older files (a new folder prefix or pattern), pause it and click Reset cursor in its details: the next scan then considers files of any age, and files already imported are still skipped.
Re-run queues a new run of the same file; its source must be active (not paused). A Done upload cannot be re-run, because the uploaded file was deleted after import. Re-running a Done or Partially imported run writes those rows a second time. Cancel run works only while the run is Pending.
Method 3 - Export / Import via S3 and Airbyte
Applications that cannot make live HTTP calls - legacy POS systems, CRM exports, ERP batch jobs - can export their data as CSV files, upload them to an S3 bucket, and let Airbyte replicate the files into CDP's Raw Data layer on a schedule. CDP acts as the destination in Airbyte; the source application only needs to produce a file.
CDP has no first-party Airbyte integration or wizard - Methods 3 and 4 describe how to point
standard, off-the-shelf Airbyte at CDP's existing ClickHouse raw_data tables yourself. The
transform pipeline does auto-detect Airbyte's (and Fivetran's) marker columns
(_airbyte_extracted_at / _airbyte_raw_id) as an incremental cursor when no
explicit cursor is configured, so this path is well-supported - just not admin-UI-guided. If your files
are CSV or JSONL, you may not need Airbyte at all: the built-in File Import (Method 2)
can take an upload or watch a folder in your S3 bucket directly. Use Airbyte when you need formats or sources
File Import does not read (for example compressed files, TSV, Parquet or Excel files) or already run Airbyte
for other connections.
Architecture
The data flow for export / import via S3 and Airbyte is:
-
Export CSV from your application
Your application periodically exports records in the CDP CSV format described below (daily, hourly, or on-demand). -
Upload to S3
Drop the CSV file into a designated S3 prefix (e.g.s3://your-bucket/cdp-events/pos_system/). This can be automated via a cron job, AWS Lambda, or your application's built-in export scheduler. -
Airbyte syncs to CDP
Airbyte's S3 source connector detects new files under the prefix and replicates them to CDP's ClickHouse Raw Data table. Only new files are transferred on each sync run (incremental). -
CDP processes the data normally
Once rows land in Raw Data, the standard pipeline runs: Raw → Events → Source Profiles → Unified Profiles, exactly the same as rows ingested through the Public API (see Processing Raw Data in CDP Admin).
CSV Format for Airbyte
Each CSV file must include a header row. Columns map to the columns of the target raw_data table; which of them become event fields is decided later by the event-source mapping.
Use UTF-8 encoding, comma delimiters, and double-quote escaping for fields that contain commas or quotes.
Loading the CSV with the built-in File Import instead? Its rules are stricter - see File Formats in Method 2.
| Column | Type | Required | Description |
|---|---|---|---|
| (your table columns) | varies | depends on schema | Column names and types must match the target raw_data table. Open the table in Ingestion > Data Sources and click Columns, or call GET /api/public/v1/tables/{source_table}/schema. |
Example CSV
Column headers must match the raw_data target table exactly. The example below uses a sample purchase table:
email,customer_id,order_id,amount,currency,product_id,occurred_at
alice@example.com,cust_001,txn_001,1200,JPY,prod_abc,2026-01-15T10:30:00Z
bob@example.com,cust_002,txn_002,3400,JPY,prod_xyz,2026-01-15T11:05:00Z
"" (two double-quote characters). This is standard RFC 4180 CSV escaping - most export libraries handle it automatically.
Uploading Files to S3
Organize files in S3 under a dedicated prefix per event source. Using a date-partitioned path makes it easy to reprocess specific time ranges and lets Airbyte detect new files incrementally.
Recommended S3 folder structure
s3://your-bucket/
└── cdp-events/
├── pos_system/
│ ├── 2026/01/15/events_20260115_103000.csv
│ ├── 2026/01/15/events_20260115_110000.csv
│ └── 2026/01/16/events_20260116_090000.csv
└── crm_export/
├── 2026/01/15/contacts_20260115.csv
└── 2026/01/16/contacts_20260116.csv
Uploading via AWS CLI
DATE=$(date -u +%Y/%m/%d)
TIMESTAMP=$(date -u +%Y%m%d_%H%M%S)
aws s3 cp events_export.csv \
"s3://your-bucket/cdp-events/pos_system/${DATE}/events_${TIMESTAMP}.csv"
cdp-events/ prefix. The minimum required permissions are s3:GetObject and s3:ListBucket.
Configuring Airbyte (Export / Import)
Set up one Airbyte connection per event source (or per S3 prefix). The connection maps the S3 source to CDP's ClickHouse Raw Data destination.
Step 1 - Create an S3 Source connector
-
In Airbyte, go to Sources → + New source and search for S3.
-
Fill in the connector settings:
- Bucket:
your-bucket - AWS Region: the region where your bucket lives (e.g.
ap-northeast-1) - Path Pattern:
cdp-events/pos_system/**/*.csv- use**to match date-partitioned sub-folders - File Format: CSV, header row enabled, UTF-8
- AWS Access Key ID / Secret: credentials for the read-only IAM user you created
- Bucket:
-
Click Test and save. Airbyte will list the matched files to confirm connectivity.
Step 2 - Create a ClickHouse Destination connector
-
Go to Destinations → + New destination and search for ClickHouse.
-
Fill in the CDP ClickHouse connection details (ask your CDP administrator):
- Host: ClickHouse host (e.g.
clickhouse.internal) - Port:
8443(HTTPS) or8123(HTTP) - Database:
raw_data - Username / Password: ClickHouse credentials
- SSL: enable for production
- Host: ClickHouse host (e.g.
-
Click Test and save.
Step 3 - Create a Connection
-
Go to Connections → + New connection, select the S3 source and the ClickHouse destination you just created.
-
In the Select streams step, enable the stream that corresponds to your S3 path. Set the sync mode to Incremental | Append so only new files are transferred on each run.
-
In the Destination namespace field, confirm the target database is
raw_dataand the target table matches what CDP expects (ask your administrator for the exact table name). -
Verify the column mapping: Airbyte should map the CSV columns to the corresponding
raw_datatable columns. Column names must match the target table's schema exactly. -
Click Set up connection. Airbyte will run an initial sync immediately.
Scheduling & Monitoring (Export / Import)
Configure Airbyte to sync automatically on a schedule that matches how often your application exports new files.
| Export Frequency | Recommended Airbyte Schedule | Notes |
|---|---|---|
| Daily batch (e.g. nightly CRM export) | Every 24 hours, offset to run 30 min after export completes | Low overhead; data available in CDP by morning |
| Hourly export | Every 1 hour | Near-real-time; good for high-volume transactional systems |
| On-demand / manual | Trigger manually from Airbyte UI or API | Suitable for one-off historical backfills |
Monitoring sync health
Airbyte provides a sync history log for each connection. Watch for:
- Failed syncs - usually caused by malformed CSV rows or ClickHouse connectivity issues. Airbyte will show the error in the sync log.
- Zero records synced - may indicate the S3 path pattern is not matching new files, or no new files were uploaded since the last sync.
- Duplicate rows - if a file is re-uploaded under the same key, Airbyte's incremental mode may skip it. Always use a unique filename per export run (include a timestamp in the filename). If duplicates do land in the raw table, the transform pipeline's deduplication logic handles them during the Raw to Events stage.
Method 4 - Database Pull
If you own a database that already holds the event data you want in CDP - an internal PostgreSQL orders table, a MySQL loyalty system, a BigQuery analytics warehouse - you can connect Airbyte directly to that database. Airbyte queries it on a schedule and pushes the results into CDP's Raw Data layer. No file export step is required.
This approach is sometimes called reverse ETL: instead of your application pushing data to CDP, CDP (via Airbyte) pulls data from your operational store on its own schedule.
Architecture
The data flow for database pull is:
| Supported Source Databases | Airbyte Connector |
|---|---|
| PostgreSQL | Postgres Source |
| MySQL / MariaDB | MySQL Source |
| Microsoft SQL Server | MSSQL Source |
| Google BigQuery | BigQuery Source |
| Snowflake | Snowflake Source |
| Amazon Redshift | Redshift Source |
| MongoDB | MongoDB Source |
Any database with an Airbyte source connector can be used. Check the Airbyte connector catalog for the full list.
Prerequisites
Before Airbyte can connect to your database, two things must be in place on your side: your database host must allow incoming connections from Airbyte's IP addresses, and you must create a dedicated read-only user for Airbyte to authenticate with.
Step 1 - Whitelist Airbyte Cloud IPs
Airbyte Cloud runs all syncs from a fixed set of IP addresses. Add every address in the table below to your database's firewall or security group inbound rules. Always refer to the official Airbyte IP Allow List page for the up-to-date list.
| Cloud | Region | IPs / CIDR |
|---|---|---|
| GCP | us-west-3 |
34.106.109.13134.106.196.16534.106.60.24634.106.229.6934.106.127.13934.106.218.5834.106.115.24034.106.225.141
|
| GCP | us-central-1 | 34.33.7.0/29 |
| AWS | eu-west-3 (France) |
13.37.4.4613.37.142.6035.181.124.238
|
Step 2 - Create a Read-Only Database User
Create a dedicated read-only database user for Airbyte to use. The example below uses PostgreSQL - follow the official Airbyte source connector docs for your specific database:
- PostgreSQL source docs
- MySQL source docs
- SQL Server source docs
- BigQuery source docs
- All source connectors
PostgreSQL example:
-- 1. Create a dedicated user for Airbyte
CREATE USER airbyte_user PASSWORD 'a_strong_password_here';
-- 2. Grant read access to the schema(s) Airbyte will sync
GRANT USAGE ON SCHEMA public TO airbyte_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO airbyte_user;
-- 3. Automatically grant SELECT on any new tables added in the future
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO airbyte_user;
SELECT access only on the specific schema(s) or tables it needs to read.
Configuring Airbyte (Database Pull)
Once your database is reachable from Airbyte and the read-only user exists, set up the source connector, the ClickHouse destination, and a connection between them.
Step 1 - Create a Database Source connector
-
In Airbyte, go to Sources → + New source and search for your database type (e.g. Postgres, MySQL, BigQuery).
-
Fill in your database connection details:
- Host / Port: your database host and port
- Database: the database name
- Schema: the schema(s) to discover (e.g.
public) - Username / Password: the read-only
airbyte_useryou created above - SSL mode: set to
requireor higher for production
-
Click Test and save. Airbyte will connect to your database and discover available tables and views.
Step 2 - Create a ClickHouse Destination connector
If you already set up a ClickHouse destination for Method 3 (Export / Import), reuse it here - the destination is the same CDP ClickHouse instance. Otherwise, follow the ClickHouse destination setup steps in the Export / Import section.
Step 3 - Create a Connection
-
Go to Connections → + New connection, select your database source and the ClickHouse destination.
-
In the Select streams step, choose the tables or views you want to sync. Set the sync mode to Incremental | Append so only new or updated rows are transferred on each run.
-
Set the cursor field to a timestamp column (e.g.
updated_atorcreated_at). Airbyte uses this to track which rows are new since the last sync run. -
In the Destination namespace field, confirm the target database is
raw_dataand verify the column mapping. If you write into an existingraw_datatable, the source columns must match its columns: open it in Ingestion > Data Sources and click Columns. If Airbyte creates the table, it appears on the same screen after the first sync. -
Click Set up connection. Airbyte will run an initial full sync immediately to backfill all existing rows.
Scheduling & Monitoring (Database Pull)
Choose a sync frequency that balances data freshness with the query load placed on your source database. Note that Airbyte Cloud enforces a minimum schedule interval of 60 minutes.
| Data Freshness Need | Recommended Airbyte Schedule | Notes |
|---|---|---|
| Frequent updates (high-volume OLTP) | Every 60 minutes (Airbyte Cloud minimum) | Ensure incremental mode is on and the cursor column is indexed to avoid full-table scans |
| Daily analytics / reporting | Every 24 hours (off-peak hours) | Schedule during low-traffic windows to minimize load on the source DB |
| One-time historical backfill | Trigger manually from Airbyte UI | Run once to import all historical data; then switch to incremental |
Monitoring sync health
In addition to Airbyte's sync history log, watch for:
- Slow queries on the source DB - add an index on your cursor column (e.g.
CREATE INDEX ON orders (updated_at)) to prevent full-table scans on every incremental sync run. - Cursor drift - if your source DB's
updated_atcolumn is not set on every update, some rows may be skipped. Consider using an append-onlycreated_atcursor instead, or triggering a manual full-refresh periodically. - Schema changes in the source DB - if you rename or drop columns in the source table, refresh the Airbyte stream schema to avoid sync failures.
- Zero records synced - if no rows have a cursor value newer than the last sync, Airbyte will report zero records. This is expected when there is no new activity; confirm by checking the source table directly.
Processing Raw Data in CDP Admin
Whichever method you use, the job ends when rows land in a raw_data table. From there, CDP turns them into events and profiles: Raw Data → Events → Source Profiles → Unified Profiles.
-
Check the rows
Go to Ingestion > Data Sources, open the table and click Data preview. -
Map the table
Go to Ingestion > Events and click Add event source. Set:- Data Source: the
event_sourcename your events will carry. - Event Type.
- Event Timestamp: a
DateTimeorDateTime64column. - The columns to keep.
- At least one Identity column, and choose its kind: Email (Trim + lowercase), Phone (Trim + remove spaces - . ( )) or Other (Trim only). Identities are normalized once at transform time; no + or country code is added.
- Data Source: the
-
Transform
From the source's row menu choose Transform (Re-transform all reprocesses everything from scratch). This converts raw rows into events. -
Source profiles
In Unification > Source Profiles, create a merge policy for this Data Source with Create Merge Policy if none exists, then use Build from its row menu. Active policies also build automatically every hour, at about 5 minutes past. -
Unified profiles
In Unification > Unified Profiles, click Build, either from the active policy's menu or on the policy's page. The active policy also builds every hour, at about 10 minutes past.
Turn on Auto Transform for the table and keep its merge policies active, and the pipeline runs every hour by itself: the transform, then source profiles at about 5 minutes past and unified profiles at about 10 minutes past (UTC). Events are assigned to unified profiles after each successful unified build. To run a step right after a sync instead of waiting, an operator can call the admin endpoints the buttons use:
POST /api/admin/v1/events/sources/raw_data/{table}/transform(needsevents:trigger_transform)POST /api/admin/v1/source-matching-rules/{ruleId}/build(needsdata_sources:create)POST /api/admin/v1/unified-matching-rules/{ruleId}/build(needsdata_sources:update)
These calls need an admin session or token whose role has the listed permission, not a write key. If a run is already in progress, they answer 409 instead of starting a second one.