Search purchase orders
distru-search-purchase-ordersReadSearches purchase orders (purchases from suppliers) — one row per purchase, not line items.
Inputs
Every tool also takes the common inputs.
| Field | Type | Required | Description |
|---|---|---|---|
| limit | integer | No | Default: 10 |
| cursor | string | No | nextCursor of the previous call; keep the other arguments unchanged. |
| batchIds | string[] | No | Any line item of these batches. Resolve via distru-search-batches. |
| dueDateAfter | string | No | Payment due date, inclusive. YYYY-MM-DD (start of day, company timezone) or ISO 8601 with a UTC offset. |
| dueDateBefore | string | No | Payment due date, inclusive. YYYY-MM-DD (end of day, company timezone) or ISO 8601 with a UTC offset. |
| ids | string[] | No | Drafts need status DRAFT. |
| orderDateAfter | string | No | Inclusive. YYYY-MM-DD (start of day, company timezone) or ISO 8601 with a UTC offset. |
| orderDateBefore | string | No | Inclusive. YYYY-MM-DD (end of day, company timezone) or ISO 8601 with a UTC offset. |
| ownerIds | string[] | No | Resolve via distru-search-users. |
| paymentStatus | enum[]NOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID | No | |
| productIds | string[] | No | Any line item of these products. Resolve via distru-search-products. |
| search | string | No | Case-insensitive substring of purchase number or matched compliance manifest number (manifest only for 4+ char terms). Ranked by purchase number similarity; sortBy ignored. Drafts need status DRAFT. |
| status | enum[]COMPLETEDDELIVERINGDRAFTPARTIALLY_RECEIVEDPENDINGPROCESSING | No | Defaults to every status but DRAFT: drafts come back only when this includes DRAFT. |
| supplierIds | string[] | No | Resolve via distru-search-companies. |
| totalGreaterThanOrEqualTo | number | No | Dollars. |
| totalLessThanOrEqualTo | number | No | Dollars. |
| customFields | object[] | No | Set one of contains, anyOf or onOrAfter/onOrBefore per entry. Records with no value for the field never match. |
| customFields[]. | string | Yes | Resolve via distru-search-custom-fields. |
| customFields[]. | string | No | TEXT: case-insensitive substring. |
| customFields[]. | string[] | No | DROPDOWN, CHECKBOX: any of these options, case-sensitive. |
| customFields[]. | string | No | DATE: YYYY-MM-DD, company timezone. |
| customFields[]. | string | No | DATE: YYYY-MM-DD, company timezone. |
| sortBy | object | No | Default UPDATED_AT DESC. Ignored when search is set. |
| sortBy. | enumASCDESC | Yes | |
| sortBy. | enumDUE_DATEINSERTED_ATORDER_DATEPURCHASE_NUMBERUPDATED_AT | Yes | DUE_DATE = payment due date. Purchases without the sorted date sort last either direction. |
Output
Presence on a nested field assumes its parent exists.
| Field | Type | Presence | Description |
|---|---|---|---|
| hasMore | boolean | Always | |
| nextCursor | string | Can be absent | |
| totalCount | integer | Can be absent | |
| items | object[] | Always | |
| items[]. | string | Always | |
| items[]. | object[] | Always | |
| items[]. | object | Always | |
| items[]. | string | Always | |
| items[]. | string | Always | |
| items[]. | enumCHECKBOXDATEDROPDOWNTEXT | Always | |
| items[]. | string | Can be null | |
| items[]. | string | Always | |
| items[]. | enumCOMPLETEDDELIVERINGDRAFTPARTIALLY_RECEIVEDPENDINGPROCESSING | Always | |
| items[]. | enumNOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID | Always | |
| items[]. | string | Always | |
| items[]. | string | Always | |
| items[]. | string | Can be null | |
| items[]. | string | Can be null | |
| items[]. | string | Always | |
| items[]. | string | Always | |
| items[]. | string | Always | |
| items[]. | string | Can be null | |
| items[]. | enumDELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED | Can be null | |
| items[]. | object | Null or absent | |
| items[]. | string | Always | |
| items[]. | string | Null or absent | |
| items[]. | object | Can be null | |
| items[]. | string | Always | |
| items[]. | string | Always | |
| items[]. | object | Can be null | |
| items[]. | string | Always | |
| items[]. | object | Always | |
| items[]. | string | Always | |
| items[]. | string | Can be null | Manifest number of the matched compliance transfer; null when unmatched. |
What the AI reads
Searches purchase orders (purchases from suppliers) — one row per purchase, not line items. For one purchase's line items, charges and payments, use distru-get-purchase-order (includePayments for payments); for payments across purchases, distru-search-purchase-payments; for a flattened report with CSV-style filters, distru-report-purchase-order-history. intakeLocation is the location the inventory is received into. complianceManifestNumber is the matched compliance manifest number, null when unmatched. A DRAFT may lack supplier, intakeLocation and dates. qbBillId is its QuickBooks bill ID. qbSyncStatus is null unless the company's QuickBooks module is on and connected; PENDING and ERROR are its latest sync's outcome and win over the rest; DELETED_IN_QBO = the bill was deleted in QuickBooks; NOT_SYNCED = it has no QuickBooks bill. Bill payment syncs don't count. qbSyncStatus ERROR: distru-search-quickbooks-activities with purchaseOrderIds gives the error. ERROR or NOT_SYNCED: distru-sync-to-quickbooks pushes it, or says why it can't.