> ## Documentation Index
> Fetch the complete documentation index at: https://agnt.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# QuickBooks

> Give your agents the QuickBooks Online Accounting API — query data, manage customers, invoices, bills, payments, and accounts, and run financial reports — through agntdata.

## Overview

The QuickBooks connection lets deployed agents work with QuickBooks Online (Intuit): run **SQL-like queries** across your accounting data; **create, read, and update** customers, invoices, items, vendors, bills, payments, accounts, estimates, sales receipts, credit memos, purchase orders, and journal entries; **delete** transaction entities; read **company info**; run **financial reports** (Profit and Loss, Balance Sheet, Cash Flow, and more); and submit **batch** operations.

* **Base URL**: `https://api.agntdata.dev/v1/connections/quickbooks`
* **QuickBooks auth**: OAuth 2.0 — connect your QuickBooks company once from the dashboard. agntdata attaches a fresh access token (and the required `Accept: application/json` header) to every call, so you never pass an `Authorization` header yourself. The connected company (realm) is encoded in the connection, so you never pass a company id in the path. Access tokens are short-lived and refresh tokens rotate — agntdata handles both in the background.
* **MCP tools**: agents call `connection_quickbooks_*` tools, e.g. `connection_quickbooks_query`, `connection_quickbooks_create_invoice`, `connection_quickbooks_get_report`.

<Note>
  **Reads** go through `query` with a SQL-like statement (`SELECT * FROM Customer WHERE Active = true`) or `get_<entity>` by id. **QuickBooks has no PATCH** — `update_<entity>` is a POST that must include the object's `Id` and its current `SyncToken` (read the entity first to get it); pass `"sparse": true` in the body for a partial update. **Delete tools** exist only for transaction entities (`delete_invoice`, `delete_payment`, `delete_bill`, `delete_estimate`, `delete_salesreceipt`, `delete_creditmemo`, `delete_purchaseorder`, `delete_journalentry`) and are **irreversible** — name-list entities like customers, items, and vendors are made inactive with an update instead.
</Note>

## Setup

<Steps>
  <Step title="Connect QuickBooks">
    In the agntdata dashboard open **Integrations**, pick **QuickBooks**, and click **Connect**. You'll be redirected to Intuit to authorize the company you want to connect and grant the accounting scope.
  </Step>

  <Step title="Pick QuickBooks tools">
    In an agent's Tools panel, add the QuickBooks tools the agent needs — for example `query`, `create_invoice`, `get_report`, and `get_companyinfo`. Destructive delete tools ship too; leave them off an agent you don't want deleting transactions.
  </Step>
</Steps>

## Examples

### Query customers

```bash theme={null}
curl -G "https://api.agntdata.dev/v1/connections/quickbooks/query" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  --data-urlencode "query=SELECT * FROM Customer WHERE Active = true"
```

### Read a customer by id

```bash theme={null}
curl "https://api.agntdata.dev/v1/connections/quickbooks/customer/1" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY"
```

### Create an invoice

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/quickbooks/invoice" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"CustomerRef":{"value":"1"},"Line":[{"Amount":100.0,"DetailType":"SalesItemLineDetail","SalesItemLineDetail":{"ItemRef":{"value":"1"}}}]}'
```

### Update a customer (partial / sparse)

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/quickbooks/customer?operation=update" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"Id":"1","SyncToken":"3","sparse":true,"PrimaryEmailAddr":{"Address":"new@example.com"}}'
```

### Run a Profit and Loss report

```bash theme={null}
curl -G "https://api.agntdata.dev/v1/connections/quickbooks/reports/ProfitAndLoss" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  --data-urlencode "start_date=2024-01-01" \
  --data-urlencode "end_date=2024-12-31" \
  --data-urlencode "accounting_method=Accrual"
```

### Delete an invoice

```bash theme={null}
curl -X POST "https://api.agntdata.dev/v1/connections/quickbooks/invoice?operation=delete" \
  -H "Authorization: Bearer $AGNTDATA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"Id":"130","SyncToken":"0"}'
```
