Load Heartland retail pos data to DuckDB
Build a Heartland retail pos to DuckDB pipeline with your coding agent. One prompt scaffolds it with the dltHub AI harness, plus the Heartland retail pos API base URL, auth, endpoints, and incremental loading.
Heartland Retail is a POS platform that exposes inventory, customer, order, and sales data through a REST API. Everything needed to build a working Heartland retail pos → 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 Heartland retail pos to DuckDB pipeline
Paste this prompt into Claude, Codex, or Cursor. The agent does the rest.
PromptRunuvx dlthub-init@latestto build a pipeline from Heartland retail pos 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 Heartland retail pos 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.
Heartland retail pos API at a glance
| Base URL | https://{subdomain}.retail.heartland.us/api/ |
| Example endpoint | GET api/items |
| Records found at | results |
| Authentication | all requests require a Bearer token — sent in the Authorization header, prefixed Bearer |
| Pagination | Page-number page size via per_page |
| API reference | https://dev.retail.heartland.us/ |
These values come from the Heartland retail pos API reference — the authoritative source if anything here looks out of date.
How do I authenticate with the Heartland retail pos API?
All requests require an 'Authorization' header containing a 'Bearer' token. This token is either an OAuth 2.0 access token or a manually generated API token from the Heartland Retail dashboard.
1. Get your credentials
- Sign in to your Heartland Retail account. 2. Click your name in the top-right corner of the dashboard and select 'My Account'. 3. Navigate to the 'API' tab (labeled 'API Tokens'). 4. Click 'Generate new token', provide a description, and click 'Generate Token'. 5. Copy the generated token immediately, as it will not be displayed again. 6. For your base URL, use the format 'https://{subdomain}.retail.heartland.us/api/'. If you are unsure of your subdomain, you can perform a one-time lookup by making a GET request to 'https://retail.heartland.us/api/system/host' with your API token in the Authorization header.
2. Add them to .dlt/secrets.toml
[sources.heartland_retail_pos_source] token = "REPLACE_ME"
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 Heartland retail pos data can I load into DuckDB?
These are the Heartland retail pos endpoints dlt can load into DuckDB:
| Resource | Endpoint | Method | Data selector | Description |
|---|---|---|---|---|
| items | /api/items | GET | results | Search items (paginated) |
| customers | /api/customers | GET | results | Search customers (paginated) |
| sales_orders | /api/sales/orders | GET | results | Search sales orders (paginated) |
| purchasing_vendors | /api/purchasing/vendors | GET | results | Search purchase vendors (paginated) |
| payment_types | /api/payment_types | GET | results | Search payment types (paginated) |
How do I load only new Heartland retail pos records?
The Heartland retail pos 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": "items", "endpoint": { "path": "api/items", # 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 Heartland retail pos pipeline look like?
A standard dlt REST API pipeline — the same code you would write by hand, loading /api/system/host and /api/system/whoami from the Heartland retail pos API into DuckDB:
import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def heartland_retail_pos_source(token=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://{subdomain}.retail.heartland.us/api/", "auth": {"type": "bearer", "token": token}, }, "resources": [ {"name": "items", "endpoint": {"path": "api/items", "data_selector": "results"}}, {"name": "customers", "endpoint": {"path": "api/customers", "data_selector": "results"}} ], } yield from rest_api_resources(config) def load_heartland_retail_pos_to_duckdb() -> None: pipeline = dlt.pipeline( pipeline_name="heartland_retail_pos_pipeline", destination="duckdb", dataset_name="heartland_retail_pos_data", ) load_info = pipeline.run(heartland_retail_pos_source()) print(load_info) if __name__ == "__main__": load_heartland_retail_pos_to_duckdb()
Run it with python heartland_retail_pos_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 Heartland retail pos 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("heartland_retail_pos_pipeline").dataset() df = data.items.df() print(df.head())
SQL:
SELECT * FROM heartland_retail_pos_data.items LIMIT 10;
See querying your data with dataset and exploring it in marimo notebooks.
How do I deploy the Heartland retail pos 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 Heartland retail pos 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 Heartland retail pos 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 Heartland retail pos to DuckDB?
Request dlt skills, commands, AGENT.md files, and AI-native context.