# Purchasing & AP

Source: https://docs.autessa.com/docs/tools/quickbooks/purchasing-ap

> QuickBooks tool types for vendors, bills, and purchase orders.

# Purchasing & AP

Tool types for the accounts-payable side of QuickBooks: vendors, bills, bill payments, and purchase orders.

Every type on this page requires a [QuickBooks connector](/docs/guide/connectors.md); `connectorId` is the ID of that connector. Bill payments here are accounting records (check or credit-card entries in the ledger) — QuickBooks' Payments API on the [Payments](/docs/tools/quickbooks/payments.md) page is receivables-only and plays no role in paying vendors. See the [QuickBooks overview](/docs/tools/quickbooks.md) for connector setup and sandbox behavior.

## Create vendor **TOOL** `QUICKBOOKS_CREATE_VENDOR`

Creates a vendor (supplier) record. Only `displayName` is required and it must be unique across customers, vendors, and employees. Set `vendor1099` and `taxIdentifier` for contractors that need 1099 reporting; if the vendor may already exist, prefer `QUICKBOOKS_GET_OR_CREATE_VENDOR` on the [Workflows](/docs/tools/quickbooks/workflows.md) page.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_CREATE_VENDOR",
  "connectorId": "V1StGXR8Z5",
  "displayName": "@@{vendorName}",
  "companyName": "@@{vendorCompany}",
  "primaryEmailAddr": "@@{vendorEmail}",
  "vendor1099": false
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `displayName` (string) — Required
- `givenName` (string) — Required string value.
- `familyName` (string) — Required string value.
- `companyName` (string) — Required string value.
- `primaryEmailAddr` (string) — Required string value.
- `primaryPhone` (string) — Required string value.
- `mobile` (string) — Required string value.
- `billAddr` (object) — Billing address
- `webAddr` (string) — Required string value.
- `taxIdentifier` (string) — Tax ID for 1099 reporting
- `acctNum` (string) — Account number
- `vendor1099` (boolean) — Is 1099 vendor

## Update vendor **TOOL** `QUICKBOOKS_UPDATE_VENDOR`

Updates an existing vendor identified by `vendorId` — contact details, addresses, 1099 status, or account number. Setting `active` to false soft-deletes the vendor while preserving its transaction history.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_UPDATE_VENDOR",
  "connectorId": "V1StGXR8Z5",
  "vendorId": "@@{vendorId}",
  "primaryEmailAddr": "@@{newEmail}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `vendorId` (string) — Required
- `displayName` (string) — Required string value.
- `givenName` (string) — Required string value.
- `familyName` (string) — Required string value.
- `companyName` (string) — Required string value.
- `primaryEmailAddr` (string) — Required string value.
- `primaryPhone` (string) — Required string value.
- `mobile` (string) — Required string value.
- `billAddr` (object) — Billing address
- `webAddr` (string) — Required string value.
- `taxIdentifier` (string) — Required string value.
- `acctNum` (string) — Required string value.
- `vendor1099` (boolean) — Required boolean value.
- `active` (boolean) — Required boolean value.

## Get vendors **TOOL** `QUICKBOOKS_GET_VENDORS`

Lists vendors with pagination, an optional SQL-like `whereClause`, and an `orderBy`. This is how an agent discovers the `vendorId` the bill and purchase-order tools need; `QUICKBOOKS_SEARCH_VENDOR_BY_NAME` on the [Workflows](/docs/tools/quickbooks/workflows.md) page handles fuzzy name lookups.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_GET_VENDORS",
  "connectorId": "V1StGXR8Z5",
  "maxResults": 50,
  "startPosition": 1,
  "activeOnly": true
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `maxResults` (integer) — Required integer value.
- `startPosition` (integer) — Required integer value.
- `whereClause` (string) — Required string value.
- `orderBy` (string) — Required string value.
- `activeOnly` (boolean) — Required boolean value.

## Get vendor by ID **TOOL** `QUICKBOOKS_GET_VENDOR_BY_ID`

Fetches a single vendor's full record — contact details, balance owed, 1099 status, and the `SyncToken` updates require. Use it to confirm details before entering bills against the vendor.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_GET_VENDOR_BY_ID",
  "connectorId": "V1StGXR8Z5",
  "vendorId": "@@{vendorId}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `vendorId` (string) — Required string value.

## Create bill **TOOL** `QUICKBOOKS_CREATE_BILL`

Enters a bill (a vendor invoice you owe) into accounts payable. `lines` is an array of expense lines — use `DetailType` of `AccountBasedExpenseLineDetail` with an `AccountRef` to book against an expense account, or `ItemBasedExpenseLineDetail` for item purchases. Creating a bill doesn't pay it; that's `QUICKBOOKS_CREATE_BILL_PAYMENT`.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_CREATE_BILL",
  "connectorId": "V1StGXR8Z5",
  "vendorId": "@@{vendorId}",
  "lines": [
    {
      "DetailType": "AccountBasedExpenseLineDetail",
      "Amount": 1200.00,
      "Description": "@@{expenseDescription}",
      "AccountBasedExpenseLineDetail": {
        "AccountRef": { "value": "7" }
      }
    }
  ],
  "dueDate": "@@{dueDate}",
  "docNumber": "@@{billNumber}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `vendorId` (string) — Required - VendorRef
- `lines` (array<object>) — Required - Line items
- `txnDate` (string) — Transaction date
- `dueDate` (string) — Due date
- `docNumber` (string) — Bill number/reference
- `privateNote` (string) — Internal memo
- `apAccountId` (string) — Accounts Payable account

## Update bill **TOOL** `QUICKBOOKS_UPDATE_BILL`

Updates an existing bill identified by `billId` — due date, line items, memo, or vendor reference. Supplying `lines` replaces the whole line array, so include every line the bill should end up with.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_UPDATE_BILL",
  "connectorId": "V1StGXR8Z5",
  "billId": "@@{billId}",
  "dueDate": "@@{newDueDate}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `billId` (string) — Required
- `vendorId` (string) — Required string value.
- `lines` (array<object>) — Bill line items
- `txnDate` (string) — Required string value.
- `dueDate` (string) — Required string value.
- `docNumber` (string) — Required string value.
- `privateNote` (string) — Required string value.

## Delete bill **TOOL** `QUICKBOOKS_DELETE_BILL`

Permanently deletes a bill. Requires the bill's current `syncToken` (fetch it with `QUICKBOOKS_GET_BILL_BY_ID` first) for QuickBooks' optimistic locking, and fails if bill payments are already linked to the bill.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_DELETE_BILL",
  "connectorId": "V1StGXR8Z5",
  "billId": "@@{billId}",
  "syncToken": "@@{syncToken}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `billId` (string) — Required
- `syncToken` (string) — Required for delete

## Get bills **TOOL** `QUICKBOOKS_GET_BILLS`

Lists bills with pagination, filtered by vendor, transaction-date range, or a raw `whereClause` (e.g. `Balance > '0'` for unpaid bills). Use it to find what's outstanding before scheduling payments.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_GET_BILLS",
  "connectorId": "V1StGXR8Z5",
  "maxResults": 50,
  "startPosition": 1,
  "whereClause": "Balance > '0'"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `maxResults` (integer) — Required integer value.
- `startPosition` (integer) — Required integer value.
- `whereClause` (string) — Required string value.
- `vendorId` (string) — Required string value.
- `startDate` (string) — Required string value.
- `endDate` (string) — Required string value.

## Get bill by ID **TOOL** `QUICKBOOKS_GET_BILL_BY_ID`

Fetches one bill in full: line items, balance, linked payments, and the `SyncToken` a delete requires. For the bill plus its vendor's contact details in one call, use `QUICKBOOKS_GET_BILL_WITH_VENDOR` on the [Workflows](/docs/tools/quickbooks/workflows.md) page.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_GET_BILL_BY_ID",
  "connectorId": "V1StGXR8Z5",
  "billId": "@@{billId}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `billId` (string) — Required string value.

## Create bill payment **TOOL** `QUICKBOOKS_CREATE_BILL_PAYMENT`

Records a payment against one or more bills. `payType` is `Check` (requires `bankAccountId`) or `CreditCard` (requires `creditCardAccountId`), and `linkedBills` allocates the total across specific bills by `TxnId`. This books the ledger entry only — it doesn't print checks or move funds.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_CREATE_BILL_PAYMENT",
  "connectorId": "V1StGXR8Z5",
  "vendorId": "@@{vendorId}",
  "totalAmt": 1200.00,
  "payType": "Check",
  "bankAccountId": "35",
  "linkedBills": [
    { "TxnId": "@@{billId}", "Amount": 1200.00 }
  ]
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `vendorId` (string) — Required - VendorRef
- `totalAmt` (number) — Required - Total amount
- `payType` (string) — Required - "Check" or "CreditCard"
- `bankAccountId` (string) — Required for Check payments
- `checkNum` (string · optional) — Check number (optional)
- `creditCardAccountId` (string) — Required for CreditCard payments
- `txnDate` (string) — Transaction date
- `privateNote` (string) — Internal memo
- `linkedBills` (array<object>) — Bills to pay with amounts

## Get bill payments **TOOL** `QUICKBOOKS_GET_BILL_PAYMENTS`

Lists bill-payment records with pagination, filtered by vendor, date range, or a raw `whereClause`. Useful for reconciling what has already been paid to a vendor over a period.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_GET_BILL_PAYMENTS",
  "connectorId": "V1StGXR8Z5",
  "maxResults": 50,
  "startPosition": 1,
  "vendorId": "@@{vendorId}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `maxResults` (integer) — Required integer value.
- `startPosition` (integer) — Required integer value.
- `whereClause` (string) — Required string value.
- `vendorId` (string) — Required string value.
- `startDate` (string) — Required string value.
- `endDate` (string) — Required string value.

## Get bill payment by ID **TOOL** `QUICKBOOKS_GET_BILL_PAYMENT_BY_ID`

Fetches a single bill payment, including the bills it was applied to, the payment type, and the account it was drawn from. Use it to answer "how and when was this bill paid?"

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_GET_BILL_PAYMENT_BY_ID",
  "connectorId": "V1StGXR8Z5",
  "billPaymentId": "@@{billPaymentId}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `billPaymentId` (string) — Required string value.

## Create purchase order **TOOL** `QUICKBOOKS_CREATE_PURCHASE_ORDER`

Creates a purchase order to send to a vendor. Line items use the same expense-line shapes as bills (`ItemBasedExpenseLineDetail` for goods, `AccountBasedExpenseLineDetail` for services); `vendorMemo` appears on the PO the vendor sees. POs are non-posting — they don't hit the ledger until converted to a bill.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_CREATE_PURCHASE_ORDER",
  "connectorId": "V1StGXR8Z5",
  "vendorId": "@@{vendorId}",
  "lines": [
    {
      "DetailType": "ItemBasedExpenseLineDetail",
      "Amount": 500.00,
      "Description": "@@{itemDescription}",
      "ItemBasedExpenseLineDetail": {
        "ItemRef": { "value": "19" },
        "Qty": 10,
        "UnitPrice": 50.00
      }
    }
  ],
  "expectedDate": "@@{expectedDate}",
  "vendorMemo": "@@{vendorMemo}"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `vendorId` (string) — Required - VendorRef
- `lines` (array<object>) — Required - Line items
- `txnDate` (string) — Transaction date
- `expectedDate` (string) — Expected delivery date
- `docNumber` (string) — PO number
- `vendorMemo` (string) — Memo for vendor
- `privateNote` (string) — Internal memo
- `shipAddr` (object) — Ship to address
- `apAccountId` (string) — Accounts Payable account

## Update purchase order **TOOL** `QUICKBOOKS_UPDATE_PURCHASE_ORDER`

Updates an existing purchase order — line items, expected date, memos, or ship-to address. Set `poStatus` to `Closed` once the order is fulfilled so it stops counting as open.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_UPDATE_PURCHASE_ORDER",
  "connectorId": "V1StGXR8Z5",
  "purchaseOrderId": "@@{purchaseOrderId}",
  "poStatus": "Closed"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `purchaseOrderId` (string) — Required
- `vendorId` (string) — Required string value.
- `lines` (array<object>) — PO line items
- `txnDate` (string) — Required string value.
- `expectedDate` (string) — Required string value.
- `docNumber` (string) — Required string value.
- `vendorMemo` (string) — Required string value.
- `privateNote` (string) — Required string value.
- `shipAddr` (object) — Ship to address
- `poStatus` (string) — Open, Closed

## Get purchase orders **TOOL** `QUICKBOOKS_GET_PURCHASE_ORDERS`

Lists purchase orders with pagination, filtered by vendor, date range, `poStatus` (`Open` or `Closed`), or a raw `whereClause`. Use it to review outstanding orders before receiving goods or entering the matching bill.

### Example

```json title="Tool config"
{
  "toolType": "QUICKBOOKS_GET_PURCHASE_ORDERS",
  "connectorId": "V1StGXR8Z5",
  "maxResults": 50,
  "startPosition": 1,
  "poStatus": "Open"
}
```

> This tool type requires a connected external account. Pass the connector's ID as `connectorId` in the tool configuration.

**Configuration fields**

- `connectorId` (string (ID)) — Required string (ID) value. References a connector by ID.
- `maxResults` (integer) — Required integer value.
- `startPosition` (integer) — Required integer value.
- `whereClause` (string) — Required string value.
- `vendorId` (string) — Required string value.
- `startDate` (string) — Required string value.
- `endDate` (string) — Required string value.
- `poStatus` (string) — Open, Closed

## Related

- [Tools overview](/docs/tools.md)
- [QuickBooks overview](/docs/tools/quickbooks.md)
- [Sales & AR](/docs/tools/quickbooks/sales-ar.md)
- [Items, Accounts & Company](/docs/tools/quickbooks/items-accounts-company.md)
- [Reports](/docs/tools/quickbooks/reports.md)
- [Payments](/docs/tools/quickbooks/payments.md)
- [Workflows](/docs/tools/quickbooks/workflows.md)
- [Connectors](/docs/guide/connectors.md)
- [Autessa Payments](/docs/tools/autessa-payments.md)

