Load Capsule-crm data to Databricks
Build a Capsule-crm to Databricks pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the Capsule-crm API base URL, auth, endpoints, and incremental loading.
Capsule CRM is a REST API for managing parties, opportunities, and other CRM records. Everything needed to build a working Capsule-crm → Databricks 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 Capsule-crm to Databricks pipeline
Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.
uvx dlthub-init@latest to build a pipeline from Capsule-crm to Databricks and run it on dltHubThat 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 Capsule-crm 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.
Capsule-crm API at a glance
| Base URL | https://api.capsulecrm.com/api/v2 |
| Example endpoint | GET parties |
| Records found at | parties |
| Authentication | All requests require a Bearer token — sent in the Authorization header, prefixed Bearer |
| Also required | Accept |
| Pagination | Page-number via page, next cursor at Link header rel="next" URL (the next page number is encoded in that URL), page size via perPage (default 50, max 100). Capsule uses 1-based page-number pagination, not a cursor or next-page-token parameter. Send perPage to control page size; responses provide RFC 5988 Link headers with rel="next" and rel="prev". For incremental extraction, the documented filter is since (ISO8601), not updatedAt; list parties and list opportunities support since, which returns entities added or updated after the supplied UTC date. Bearer authentication is sent in the Authorization header. |
| Incremental field | updatedAt |
| Record id | id |
| API reference | https://developer.capsulecrm.com/v2/overview/authentication |
These values come from the Capsule-crm API reference — the authoritative source if anything here looks out of date.
How do I authenticate with the Capsule-crm API?
Send the token in the HTTP header Authorization: Bearer {token}. For JSON requests and responses, include Accept: application/json; for requests with a JSON body, also include Content-Type: application/json.
1. Get your credentials
- Sign in to your Capsule account. 2. Open your profile/name menu and choose My Preferences. 3. Open API Authentication. 4. Select Generate new API token and copy the token immediately; Capsule only shows the full token at generation time (later it is truncated). 5. Send it on every request as Authorization: Bearer YOUR_TOKEN, with Accept: application/json. For a multi-user application, use Capsule OAuth 2 instead: authorize at https://api.capsulecrm.com/oauth/authorise, exchange at https://api.capsulecrm.com/oauth/token, and use the returned access token as the bearer token. The v2 API does not use the legacy subdomain/API-key authentication model.
2. Add them to .dlt/secrets.toml
[sources.capsule_crm_source] api_key = "your_capsule_personal_access_token"
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 Capsule-crm data can I load into Databricks?
These are the Capsule-crm endpoints dlt can load into Databricks:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| parties | parties | GET | parties | List parties; supports page, perPage, since, and embed. Response records are under parties. |
| party | parties/{partyId} | GET | party | Retrieve one party by ID. |
| party_search | parties/search | GET | parties | Search parties; supports q, page, perPage, and embed. |
| opportunities | opportunities | GET | opportunities | List opportunities; supports page, perPage, since, and embed. Response records are under opportunities. |
| opportunity | opportunities/{opportunityId} | GET | opportunity | Retrieve one opportunity by ID. |
| party_opportunities | parties/{partyId}/opportunities | GET | opportunities | List opportunities associated with a party; supports page, perPage, and embed. |
| opportunity_parties | opportunities/{opportunityId}/parties | GET | parties | List additional parties associated with an opportunity; supports page, perPage, and embed. |
| party_filter_results | parties/filters/results | POST | parties | Execute a structured party filter; paginated response uses the list-parties format. |
| opportunity_filter_results | opportunities/filters/results | POST | opportunities | Execute a structured opportunity filter; paginated response uses the list-opportunities format. |
How do I load only new Capsule-crm records?
Capsule-crm exposes updatedAt on parties, so dlt can request only the records that changed since the last run. Set it as the cursor_path and dlt tracks the high-water mark for you between runs.
{"name": "parties", "endpoint": { "path": "parties", "data_selector": "parties", "incremental": {"cursor_path": "updatedAt", "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 Capsule-crm pipeline look like?
A standard dlt REST API pipeline — the same code you would write by hand, loading parties and opportunities from the Capsule-crm API into Databricks:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def capsule_crm_source(api_token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://api.capsulecrm.com/api/v2", "auth": {"type": "bearer", "token": api_token}, }, "resources": [ {"name": "parties", "endpoint": {"path": "parties", "data_selector": "parties"}}, {"name": "opportunities", "endpoint": {"path": "opportunities", "data_selector": "opportunities"}} ], } yield from rest_api_resources(config) def load_capsule_crm_to_databricks() -> None: pipeline = dlt.pipeline( pipeline_name="capsule_crm_pipeline", destination="databricks", dataset_name="capsule_crm_data", ) load_info = pipeline.run(capsule_crm_source()) print(load_info) if __name__ == "__main__": load_capsule_crm_to_databricks()
Run it with uv run python capsule_crm_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 Capsule-crm data in Databricks?
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("capsule_crm_pipeline").dataset() df = data.parties.df() print(df.head())
SQL:
SELECT * FROM capsule_crm_data.parties LIMIT 10;
See querying your data with dataset and exploring it in marimo notebooks.
How do I deploy the Capsule-crm to Databricks 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 Capsule-crm loads into governed, documented models.
- Visualize & share — explore data in notebooks and publish live dashboards instead of static screenshots.
What other destinations can I load Capsule-crm data to?
dlt loads into any of these — only the destination argument changes:
| Destination | Example 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 Capsule-crm to Databricks?
Request dlt skills, commands, AGENT.md files, and AI-native context.