Search invoices

distru-search-invoicesRead

Searches invoices — one row per invoice with totals, the amount paid, credit applied and the remaining balance, not line items.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
limitintegerNoDefault: 10
cursorstringNonextCursor of the previous call; keep the other arguments unchanged.
customerIdsstring[]NoResolve via distru-search-companies.
dueDateAfterstringNoInclusive. YYYY-MM-DD (start of day, company timezone) or ISO 8601 with a UTC offset.
dueDateBeforestringNoInclusive. YYYY-MM-DD (end of day, company timezone) or ISO 8601 with a UTC offset.
idsstring[]No
invoiceDateAfterstringNoInclusive. YYYY-MM-DD (start of day, company timezone) or ISO 8601 with a UTC offset.
invoiceDateBeforestringNoInclusive. YYYY-MM-DD (end of day, company timezone) or ISO 8601 with a UTC offset.
ownerIdsstring[]NoSales rep. Resolve via distru-search-users.
paidGreaterThanOrEqualTonumberNoDollars.
paidLessThanOrEqualTonumberNoDollars.
paymentStatusenum[]
NOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID
No
productIdsstring[]NoAny line item of these products. Resolve via distru-search-products.
salesOrderStatusenum[]
CANCELEDCOMPLETEDDELIVEREDDELIVERINGMERGEDPENDINGPROCESSINGREADY_TO_SHIP
No
searchstringNoCase-insensitive substring of invoice number. Ranked by similarity; sortBy ignored.
totalGreaterThanOrEqualTonumberNoDollars.
totalLessThanOrEqualTonumberNoDollars.
voidStatusenum
NOT_VOIDEDANYVOIDED
NoVoided invoices (sales order canceled) are no longer owed. Default NOT_VOIDED, or ANY when ids is set.
customFieldsobject[]NoSet one of contains, anyOf or onOrAfter/onOrBefore per entry. Records with no value for the field never match.
customFields[].customFieldIdstringYesResolve via distru-search-custom-fields.
customFields[].containsstringNoTEXT: case-insensitive substring.
customFields[].anyOfstring[]NoDROPDOWN, CHECKBOX: any of these options, case-sensitive.
customFields[].onOrAfterstringNoDATE: YYYY-MM-DD, company timezone.
customFields[].onOrBeforestringNoDATE: YYYY-MM-DD, company timezone.
sortByobjectNoDefault UPDATED_AT DESC. Ignored when search is set.
sortBy.directionenum
ASCDESC
Yes
sortBy.fieldenum
DUE_DATEINSERTED_ATINVOICE_DATEINVOICE_NUMBERREMAINING_AMOUNTTOTALUPDATED_AT
YesREMAINING_AMOUNT: total minus payments.

Output

Presence on a nested field assumes its parent exists.

FieldTypePresence
hasMorebooleanAlways
nextCursorstringCan be absent
totalCountintegerCan be absent
itemsobject[]Always
items[].idstringAlways
items[].customFieldsobject[]Always
items[].customFields[].customFieldobjectAlways
items[].customFields[].customField.idstringAlways
items[].customFields[].customField.namestringAlways
items[].customFields[].customField.fieldTypeenum
CHECKBOXDATEDROPDOWNTEXT
Always
items[].customFields[].valuestringCan be null
items[].invoiceNumberstringAlways
items[].paymentStatusenum
NOT_PAIDOVER_PAIDPAIDPARTIALLY_PAID
Always
items[].totalstringAlways
items[].paidstringAlways
items[].creditsAppliedstringCan be null
items[].remainingAmountstringAlways
items[].qbInvoiceIdstringCan be null
items[].qbSyncStatusenum
DELETED_IN_QBOERRORNOT_SYNCEDPARTIALLY_SYNCEDPENDINGSYNCED
Can be null
items[].voidedAtstringCan be null
items[].invoiceDatestringAlways
items[].dueDatestringAlways
items[].createdDatestringAlways
items[].updatedDatestringAlways
items[].customerobjectNull or absent
items[].customer.idstringAlways
items[].customer.namestringNull or absent
items[].ownerobjectCan be null
items[].owner.idstringAlways
items[].owner.profileobjectAlways
items[].owner.profile.fullNamestringAlways
items[].salesOrderobjectCan be null
items[].salesOrder.idstringAlways
items[].salesOrder.orderNumberstringAlways
items[].billingLocationobjectCan be null
items[].billingLocation.idstringAlways
items[].billingLocation.namestringAlways
What the AI reads

Searches invoices — one row per invoice with totals, the amount paid, credit applied and the remaining balance, not line items. Use it to find the sales order or customer behind an invoice or to check payment status and totals live. For one invoice's line items and charges, use distru-get-invoice; for a flattened report with revenue/source breakdowns, distru-report-invoice-history; for line items across invoices, pass the returned salesOrder.orderNumber as the search filter to distru-report-sales-orders with rowsPer LINE_ITEM. For the payments received against an invoice, use distru-search-invoice-payments invoiceIds. A voided invoice keeps its totals and payment status on the row but is no longer owed; voidStatus leaves them out by default. salesOrder is null if the caller lacks access to the underlying order. qbSyncStatus ERROR: distru-search-quickbooks-activities with invoiceIds gives the error. ERROR or NOT_SYNCED: distru-sync-to-quickbooks pushes it, or says why it can't.