No logo available for Brightpearl to DuckDB connector icon

Load Brightpearl data to DuckDB

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

SourceBrightpearlBrightpearl API | Integrate with Brightpearl | Developer DocumentationDestinationDuckDBIn-process analytical database. The default local destination for dlt pipelines.

Brightpearl is a cloud retail operations platform exposing a REST API to manage orders, inventory, products, warehouses and accounting. Everything needed to build a working Brightpearl → 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 Brightpearl 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 Brightpearl 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 Brightpearl 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.


Brightpearl API at a glance

Base URLhttps://{datacenter}.brightpearlconnect.com/public-api/{account-id}
Example endpointGET contact
Records found atresponse
Authenticationall requests require a Bearer token — sent in the Authorization header, prefixed `Bearer }},top_results:}of}
}`
Also requiredbrightpearl-dev-ref, brightpearl-app-ref
PaginationOffset-based page size via pageSize. Brightpearl API uses offset-based pagination for resource searches with 'pageSize' and 'firstResult' query parameters. OPTIONS endpoints are often used to batch requests for large datasets.
Incremental fieldupdatedOn
Record idcontactId
API referencehttps://help.brightpearl.com/s/article/4414330000657

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


How do I authenticate with the Brightpearl API?

All API requests require an OAuth2 Bearer token passed in the Authorization header. Additionally, you must include the 'brightpearl-dev-ref' and 'brightpearl-app-ref' headers in your requests.

1. Get your credentials

To obtain Brightpearl API credentials, follow these steps: 1. Log in to your developer account at https://developer.brightpearl.com/. 2. Navigate to the app management section and create a new instance app. 3. Configure the required settings (such as redirect URIs) based on your application type (Confidential for private servers, Public for other scenarios). 4. Save the app to generate your client_id and client_secret. 5. Ensure the app is added to the relevant Brightpearl accounts as an 'early access' account, and turn the app on via the app store within each target account. 6. Use the Authorization Code Grant flow to perform the approval workflow and obtain an access_token and refresh_token for authorized API calls.

2. Add them to .dlt/secrets.toml

[sources.brightpearl_source] brightpearl_account = "your_account_id" brightpearl_dev_ref = "your_developer_ref" brightpearl_app_ref = "your_app_ref" client_id = "your_client_id" client_secret = "your_client_secret" access_token = "your_access_token" api_domain = "your_api_domain"

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 Brightpearl data can I load into DuckDB?

These are the Brightpearl endpoints dlt can load into DuckDB:

ResourceEndpointMethodData selectorDescription
product/product/{id-set}GETresponseRetrieve a specific set of products.
contact/contact/{id-set}GETresponseRetrieve a specific set of contacts.
order/order/{id-set}GETresponseRetrieve a specific set of orders.
product_search/product-searchGETresultsSearch products based on criteria.
contact_search/contact-searchGETresultsSearch contacts based on criteria.

How do I load only new Brightpearl records?

Brightpearl exposes updatedOn on contact, 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": "contact", "endpoint": { "path": "contact", "data_selector": "response", "incremental": {"cursor_path": "updatedOn", "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 Brightpearl pipeline look like?

A standard dlt REST API pipeline — the same code you would write by hand, loading order and contact-search from the Brightpearl API into DuckDB:

import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def brightpearl_source(access_token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://{datacenter}.brightpearlconnect.com/public-api/{account-id}", "auth": {"type": "bearer", "token": access_token}, }, "resources": [ {"name": "contact", "endpoint": {"path": "contact", "data_selector": "response"}}, {"name": "order", "endpoint": {"path": "order", "data_selector": "results"}} ], } yield from rest_api_resources(config) def load_brightpearl_to_duckdb() -> None: pipeline = dlt.pipeline( pipeline_name="brightpearl_pipeline", destination="duckdb", dataset_name="brightpearl_data", ) load_info = pipeline.run(brightpearl_source()) print(load_info) if __name__ == "__main__": load_brightpearl_to_duckdb()

Run it with python brightpearl_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 Brightpearl 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("brightpearl_pipeline").dataset() df = data.contact.df() print(df.head())

SQL:

SELECT * FROM brightpearl_data.contact LIMIT 10;

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


How do I deploy the Brightpearl 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 Brightpearl 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 Brightpearl 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 Brightpearl to DuckDB?

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