Purechat Python API Docs | dltHub

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

Last updated:

Pure Chat is a live chat platform that provides an embeddable widget and a JavaScript client API for customizing widget behavior and handling chat events. The REST API base URL is `` and No public REST authentication is documented; the client‑side JavaScript API operates in the browser without auth headers..

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 Purechat data in under 10 minutes.


What data can I load from Purechat?

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

ResourceEndpointMethodData selectorDescription
widget_settings(n/a - client JS)GET (client JS)(client‑side object)Widget customization via purechatApi.get/set (no REST endpoint)
events(n/a - client JS)N/A (client events)N/AEvents fired by the JavaScript API (chat:start, chat:end, chatbox:ready, visitor.*:change)
transcript_download(n/a)N/AN/ATranscript download controlled via JS settings (enableTranscriptDownload)
visitors(n/a)N/AN/AVisitor information accessed via purechatApi.get('visitor.*')
operators(n/a)N/AN/AOperator availability accessed through client‑side events

How do I authenticate with the Purechat API?

Pure Chat exposes a browser JavaScript API (purechatApi) when the widget snippet is installed. There is no documented server‑side REST authentication header or token; any server‑side credentials must be obtained by contacting Pure Chat support.

1. Get your credentials

  1. Log in to your Pure Chat account at https://app.purechat.com or https://purechat.com.
  2. No REST API key or token is listed in the public documentation. To obtain server‑side credentials, contact support@purechat.com or your account representative and request access to a private API or webhook documentation.

2. Add them to .dlt/secrets.toml

[sources.purechat_source]

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 Purechat 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 purechat_pipeline.py

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

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

Inspect your pipeline and data:

dlt pipeline purechat_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 chatbox and visitor from the Purechat 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 purechat_source(=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "", "auth": { "type": "", "": , }, }, "resources": [ {"name": "chatbox", "endpoint": {"path": "(client-side purechatApi)"}}, {"name": "visitor", "endpoint": {"path": "(client-side purechatApi)"}} ], } yield from rest_api_resources(config) def get_data() -> None: pipeline = dlt.pipeline( pipeline_name="purechat_pipeline", destination="duckdb", dataset_name="purechat_data", ) load_info = pipeline.run(purechat_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("purechat_pipeline").dataset() sessions_df = data.chatbox.df() print(sessions_df.head())

SQL (DuckDB example):

SELECT * FROM purechat_data.chatbox LIMIT 10;

In a marimo or Jupyter notebook:

import dlt data = dlt.pipeline("purechat_pipeline").dataset() data.chatbox.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 Purechat 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

Auth failures

If your integration expects a REST API key but none is available publicly, contact support@purechat.com to request API access or partner credentials.

Missing REST endpoints / no public API

Pure Chat publicly documents only a client-side JavaScript API. There is no published REST endpoint or documented GET endpoints. Server‑side integrations should request access from Pure Chat support; consider using webhooks (ask support) or exporting chat transcripts via the dashboard as alternatives.

Rate limits and errors

No public rate limit or error response documentation exists. If you receive HTTP errors from any undocumented endpoints, capture the full request/response and contact Pure Chat support including timestamps and request IDs.

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 Purechat?

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