QuickBooks Online Python API Docs | dltHub

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

Last updated:

QuickBooks Online is a RESTful accounting API that provides access to QuickBooks company data (customers, invoices, payments, accounts, items, vendors, purchases, etc.). The REST API base URL is https://quickbooks.api.intuit.com/v3/company and all requests require OAuth 2.0 Bearer tokens (Authorization: Bearer <access_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 QuickBooks Online data in under 10 minutes.


What data can I load from QuickBooks Online?

Here are some of the endpoints you can load from QuickBooks Online:

ResourceEndpointMethodData selectorDescription
customers/{realmId}/customerGETQueryResponse.CustomerList customers (via query or read collection endpoint).
customer/{realmId}/customer/{entityId}GETCustomerRead single customer.
invoices/{realmId}/invoiceGETQueryResponse.InvoiceList invoices (via query).
invoice/{realmId}/invoice/{entityId}GETInvoiceRead single invoice.
accounts/{realmId}/accountGETQueryResponse.AccountList accounts (via query).
items/{realmId}/itemGETQueryResponse.ItemList items.
payments/{realmId}/paymentGETQueryResponse.PaymentList payments.
vendors/{realmId}/vendorGETQueryResponse.VendorList vendors.
query/{realmId}/query?query=select+*+from+GETQueryResponse.Generic SQL-like query endpoint; returns QueryResponse with entity array.
company_info/{realmId}/companyinfo/{realmId}GETCompanyInfoRead company information.

How do I authenticate with the QuickBooks Online API?

QBO uses OAuth 2.0. Obtain a client_id and client_secret from the Intuit Developer dashboard, perform the authorization code flow to get an access_token and refresh_token, then include the access token in the Authorization header: Authorization: Bearer <access_token>. Use Content-Type: application/json and Accept: application/json.

1. Get your credentials

  1. Create an app at https://developer.intuit.com -> My Apps. 2) In your app settings, note Client ID and Client Secret. 3) Configure Redirect URI(s) matching your app. 4) Direct user to Intuit authorization endpoint to obtain authorization code. 5) Exchange authorization code for access_token and refresh_token at Intuit token endpoint. 6) Store access_token (used in Authorization header) and use refresh_token to refresh when expired.

2. Add them to .dlt/secrets.toml

[sources.quickbooks_online_source] client_id = "your_client_id" client_secret = "your_client_secret" refresh_token = "your_refresh_token" realm_id = "your_realm_id"

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 QuickBooks Online 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 quickbooks_online_pipeline.py

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

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

Inspect your pipeline and data:

dlt pipeline quickbooks_online_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 customers and invoices from the QuickBooks Online 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 quickbooks_online_source(client_id=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "https://quickbooks.api.intuit.com/v3/company", "auth": { "type": "bearer", "token": client_id, }, }, "resources": [ {"name": "customers", "endpoint": {"path": "{realmId}/customer", "data_selector": "QueryResponse.Customer"}}, {"name": "invoices", "endpoint": {"path": "{realmId}/invoice", "data_selector": "QueryResponse.Invoice"}} ], } yield from rest_api_resources(config) def get_data() -> None: pipeline = dlt.pipeline( pipeline_name="quickbooks_online_pipeline", destination="duckdb", dataset_name="quickbooks_online_data", ) load_info = pipeline.run(quickbooks_online_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("quickbooks_online_pipeline").dataset() sessions_df = data.customers.df() print(sessions_df.head())

SQL (DuckDB example):

SELECT * FROM quickbooks_online_data.customers LIMIT 10;

In a marimo or Jupyter notebook:

import dlt data = dlt.pipeline("quickbooks_online_pipeline").dataset() data.customers.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 QuickBooks Online 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 you receive 401 Unauthorized or 403 Forbidden, check that Authorization: Bearer <access_token> is present and unexpired. Use the refresh_token to obtain a new access_token. Log intuit_tid from response headers when contacting Intuit support.

Rate limits and throttling

QuickBooks enforces per-realm and per-app limits (examples: 500 requests/minute per realm; 10 req/sec). When throttled you'll receive HTTP 429. Wait (60s recommended) and retry with exponential backoff. Batch and other endpoints have separate limits.

Pagination and max results

Query responses have a maximum entities limit (up to 1000). Use the query endpoint with LIMIT/OFFSET (or repeated queries) to page results. Some collection endpoints support startposition and maxresults parameters.

Common error responses

400 Bad Request — malformed request or invalid query. 401 Unauthorized — invalid/expired token. 403 Forbidden — insufficient scopes or app not connected to realm. 404 Not Found — resource not found. 429 Too Many Requests — rate limit exceeded. 500/502/503 — server errors; retry with backoff.

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 QuickBooks Online?

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