No logo available for Clevertap to DuckDB connector icon

Load Clevertap data to DuckDB

Build a Clevertap to DuckDB pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the Clevertap API base URL, auth, endpoints, and incremental loading.

SourceClevertapAPI OverviewDestinationDuckDBIn-process analytical database. The default local destination for dlt pipelines.

CleverTap is a customer engagement and retention platform that provides a REST API for managing user profiles, events, campaigns, and other account data. Everything needed to build a working Clevertap → DuckDB pipeline is on this page: the API's base URL, authentication, endpoints, pagination and incremental field — plus a prompt that hands the whole job to your coding agent.


Build your Clevertap to DuckDB pipeline

Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.

Prompt
Run uvx dlthub-init@latest to build a pipeline from Clevertap to DuckDB and run it on dltHub

That scaffolds a dltHub workspace and installs the dltHub AI harness — the project rules, the secrets-management skill, and the dlt MCP server your agent needs to work safely. From there it reads the Clevertap API, proposes the endpoints to load, then writes, runs and validates the pipeline while you review rather than type. Credentials are inspected through MCP tools, so your agent never reads secrets.toml itself. How the LLM-native workflow works →

Prefer to write it yourself? Every fact the agent uses is below.


Clevertap API at a glance

Base URLhttps://{region}.api.clevertap.com
Example endpointGET 1/events.json
Records found atrecords
Authenticationrequests require X-CleverTap-Account-Id and X-CleverTap-Passcode headers
Also requiredX-CleverTap-Account-Id, X-CleverTap-Passcode, Content-Type
PaginationCursor-based via cursor, next cursor at next_cursor, page size via batch_size (default 10, max 25). For Get User Profiles, pagination uses the opaque query parameter cursor and the response field next_cursor (use next_cursor until it stops appearing). Cursors are valid for 4 days and should not be decoded/modified or stored long-term; each cursor is single-threaded.
API referencehttps://developer.clevertap.com/docs/api-reference

These values come from the Clevertap API reference — the authoritative source if anything here looks out of date.


How do I authenticate with the Clevertap API?

Every API call must include 'X-CleverTap-Account-Id' and 'X-CleverTap-Passcode' headers. The passcode can be an Account Passcode or a User Passcode.

1. Get your credentials

  1. Log into your CleverTap account dashboard. 2. Navigate to Settings > Project > Overview (or Settings > API Credentials). 3. Locate the 'Project ID' (also referred to as Account ID) and the 'Passcode'. 4. If a passcode does not exist, click the '+Passcode' link to generate one. 5. Securely store these values, as they are required for all API authentication headers.

2. Add them to .dlt/secrets.toml

[sources.clevertap_source] clevertap_account_id = "your_project_id_here" clevertap_passcode = "your_passcode_here"

dlt reads this file automatically at runtime. With the harness, the setup-secrets skill prompts you for the values and never handles the raw credential in chat. For production, see setting up credentials with dlt.


What Clevertap data can I load into DuckDB?

These are the Clevertap endpoints dlt can load into DuckDB:

ResourceEndpointMethodData selectorDescription
events1/events.jsonGETrecordsFetches event records using a cursor obtained via POST
user_profiles1/profiles.jsonGETrecordsFetches user profiles using a cursor obtained via POST
campaigns1/targets/list.jsonPOSTtargetsFetches a list of campaigns within a date range

How do I load only new Clevertap records?

The Clevertap API reference does not document a timestamp or sequence field for these endpoints, so there is nothing to advertise here as verified. Pick a field from the endpoints table above that increases with every write, then set it as the cursor_path.

{"name": "events", "endpoint": { "path": "1/events.json", # Replace with a field that increases on every write. "incremental": {"cursor_path": "REPLACE_ME", "initial_value": "2024-01-01T00:00:00Z"}, }}

On the first run dlt loads everything from initial_value; on every run after that it requests only what changed and appends with write_disposition="merge" if you set a primary key. See incremental loading.


What does the generated Clevertap pipeline look like?

A standard dlt REST API pipeline — the same code you would write by hand, loading events and profiles from the Clevertap API into DuckDB:

import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def clevertap_source(api_key=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://{region}.api.clevertap.com", "auth": {"type": "api_key", "api_key": api_key, "name": "passcode"}, }, "resources": [ {"name": "events", "endpoint": {"path": "1/events.json", "data_selector": "records"}}, {"name": "user_profiles", "endpoint": {"path": "1/profiles.json", "data_selector": "records"}} ], } yield from rest_api_resources(config) def load_clevertap_to_duckdb() -> None: pipeline = dlt.pipeline( pipeline_name="clevertap_pipeline", destination="duckdb", dataset_name="clevertap_data", ) load_info = pipeline.run(clevertap_source()) print(load_info) if __name__ == "__main__": load_clevertap_to_duckdb()

Run it with python clevertap_pipeline.py. The agent iterates on this until it loads cleanly — you review and approve, rather than write it from scratch.


How do I query Clevertap data in DuckDB?

dlt creates one table per resource. Query the loaded data with Python or SQL — or ask your agent to, through the MCP server's execute_sql_query tool.

Python (pandas DataFrame):

import dlt data = dlt.pipeline("clevertap_pipeline").dataset() df = data.events.df() print(df.head())

SQL:

SELECT * FROM clevertap_data.events LIMIT 10;

See querying your data with dataset and exploring it in marimo notebooks.


How do I deploy the Clevertap to DuckDB pipeline in production?

The pipeline runs locally, which is ideal for prototyping and one-off analysis. When you need it on a schedule, monitored on every load, and shared with your team, deploy the same dlt code on the dltHub platform — no infrastructure to maintain. The prompt above already ends with "run it on dltHub", so your agent can take it there directly.

  • Deploy & schedule — run the pipeline as a managed job with automatic retries.
  • Monitor — observable job queues, alerting, and load metrics for every run.
  • Transform — promote raw Clevertap loads into governed, documented models.
  • Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.

Book a demo →


What other destinations can I load Clevertap data to?

dlt loads into any of these — only the destination argument changes:

DestinationExample value
PostgreSQL"postgres"
BigQuery"bigquery"
Snowflake"snowflake"
Redshift"redshift"
Databricks"databricks"
Filesystem (S3, GCS, Azure)"filesystem"

Set dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. On the dltHub platform the same pipeline runs against a managed Iceberg lakehouse. See the full destinations list.


Next steps

Was this page helpful?

Community Hub

Need more dlt context for Clevertap to DuckDB?

Request dlt skills, commands, AGENT.md files, and AI-native context.