Unbounce Python API Docs | dltHub

Build a Unbounce-to-database pipeline in Python using dlt with AI Workbench support for Claude Code, Cursor, and Codex.

Last updated:

Unbounce is a landing page builder and conversion platform that provides a REST API for managing accounts, sub‑accounts, domains, page groups, pages, leads and related resources. The REST API base URL is https://api.unbounce.com and All requests require either an API key (HTTP Basic) or an OAuth 2.0 Bearer token..

dlt is an open-source Python library that handles authentication, pagination, and schema evolution automatically. dlthub provides AI context files that enable code assistants to generate production-ready pipelines. Install with uv pip install "dlt[workspace]" and start loading Unbounce data in under 10 minutes.


What data can I load from Unbounce?

Here are some of the endpoints you can load from Unbounce:

ResourceEndpointMethodData selectorDescription
accounts/accountsGETaccountsRetrieve accounts collection (entry point).
pages/pagesGETpagesRetrieve list of all pages for the authenticated principal.
account_pages/accounts/{account_id}/pagesGETpagesRetrieve pages for specified account.
sub_account_pages/sub_accounts/{sub_account_id}/pagesGETpagesRetrieve pages for a given sub‑account.
page_leads/pages/{page_id}/leadsGETleadsRetrieve leads for a specific page.
leads/leads/{lead_id}GETRetrieve single lead by ID.
domains/domainsGETdomainsRetrieve domains (list).
page_groups/page_groupsGETpage_groupsRetrieve page groups.
users/usersGETusersRetrieve users for account.

How do I authenticate with the Unbounce API?

API keys are sent via HTTP Basic Auth using the API key as the username and an empty password and must include Accept: application/vnd.unbounce.api.v0.4+json. OAuth 2.0 access tokens are sent in the Authorization header as Bearer tokens (Authorization: Bearer ) and also should include the Accept header.

1. Get your credentials

  1. Log in to your Unbounce account. 2) Go to Manage Account → API Access (or use the API Request form if required). 3) Create a new API Key in the UI; copy the API Key. 4) For OAuth apps, register a new OAuth application in the developer portal to receive client_id and client_secret; follow the OAuth flow (GET /oauth/authorize then POST /oauth/token) to exchange code for access_token.

2. Add them to .dlt/secrets.toml

[sources.unbounce_source] api_key = "your_unbounce_api_key_here"

dlt reads this automatically at runtime — never hardcode tokens in your pipeline script. For production environments, see setting up credentials with dlt for environment variable and vault-based options.


How do I set up and run the pipeline?

Set up a virtual environment and install dlt:

uv venv && source .venv/bin/activate uv pip install "dlt[workspace]"

1. Install the dlt AI Workbench:

dlt ai init --agent <your-agent> # <agent>: claude | cursor | codex

This installs project rules, a secrets management skill, appropriate ignore files, and configures the dlt MCP server for your agent. Learn more →

2. Install the rest-api-pipeline toolkit:

dlt ai toolkit rest-api-pipeline install

This loads the skills and context about dlt the agent uses to build the pipeline iteratively, efficiently, and safely. The agent uses MCP tools to inspect credentials — it never needs to read your secrets.toml directly. Learn more →

3. Start LLM-assisted coding:

Use /find-source to load data from the Unbounce API into DuckDB.

The rest-api-pipeline toolkit takes over from here — it reads relevant API documentation, presents you with options for which endpoints to load, and follows a structured workflow to scaffold, debug, and validate the pipeline step by step.

4. Run the pipeline:

python unbounce_pipeline.py

If everything is configured correctly, you'll see output like this:

Pipeline unbounce_pipeline load step completed in 0.26 seconds 1 load package(s) were loaded to destination duckdb and into dataset unbounce_data The duckdb destination used duckdb:/unbounce.duckdb location to store data Load package 1749667187.541553 is LOADED and contains no failed jobs

Inspect your pipeline and data:

dlt pipeline unbounce_pipeline show

This opens the Pipeline Dashboard where you can verify pipeline state, load metrics, schema (tables, columns, types), and query the loaded data directly.


Python pipeline example

This example loads pages and leads from the Unbounce API into DuckDB. It mirrors the endpoint and data selector configuration from the table above:

import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def unbounce_source(api_key=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://api.unbounce.com", "auth": { "type": "http_basic", "api_key": api_key, }, }, "resources": [ {"name": "pages", "endpoint": {"path": "pages", "data_selector": "pages"}}, {"name": "page_leads", "endpoint": {"path": "pages/{page_id}/leads", "data_selector": "leads"}} ], } yield from rest_api_resources(config) def get_data() -> None: pipeline = dlt.pipeline( pipeline_name="unbounce_pipeline", destination="duckdb", dataset_name="unbounce_data", ) load_info = pipeline.run(unbounce_source()) print(load_info)

To add more endpoints, append entries from the resource table to the "resources" list using the same name, path, and data_selector pattern.


How do I query the loaded data?

Once the pipeline runs, dlt creates one table per resource. You can query with Python or SQL.

Python (pandas DataFrame):

import dlt data = dlt.pipeline("unbounce_pipeline").dataset() sessions_df = data.pages.df() print(sessions_df.head())

SQL (DuckDB example):

SELECT * FROM unbounce_data.pages LIMIT 10;

In a marimo or Jupyter notebook:

import dlt data = dlt.pipeline("unbounce_pipeline").dataset() data.pages.df().head()

See how to explore your data in marimo Notebooks and how to query your data in Python with dataset.


What destinations can I load Unbounce data to?

dlt supports loading into any of these destinations — only the destination parameter changes:

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

Change the destination in dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. See the full destinations list.


Troubleshooting

Authentication failures

If using API keys, ensure you send HTTP Basic Auth with the API key as the username and an empty password; include Accept: application/vnd.unbounce.api.v0.4+json. OAuth requests must include Authorization: Bearer <token>. 401 responses indicate invalid or missing credentials.

Rate limiting

Unbounce enforces a rate limit of 500 requests per minute per user account and IP. Responses with HTTP 429 indicate the limit has been exceeded; implement backoff and retry.

Pagination and metadata

List responses return a metadata object (metadata.count, metadata.location) and the records under a named key (e.g., pages, leads). Use the metadata.location for next‑page links if provided; otherwise paginate using supported query parameters from the API docs.

Ensure that the API key is valid to avoid 401 Unauthorized errors. Also, verify endpoint paths and parameters to avoid 404 Not Found errors.


Next steps

Continue your data engineering journey with the other toolkits of the dltHub AI Workbench:

  • data-exploration — Build custom notebooks, charts, and dashboards for deeper analysis with marimo notebooks.
  • dlthub-runtime — Deploy, schedule, and monitor your pipeline in production.
dlt ai toolkit data-exploration install dlt ai toolkit dlthub-runtime install

Was this page helpful?

Community Hub

Need more dlt context for Unbounce?

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