Purchase totals report

distru-report-purchase-totalsRead

Purchase totals over a date range, per vendor or product.

Inputs

Every tool also takes the common inputs.

FieldTypeRequiredDescription
cursorstringNonextCursor of the previous call; keep the other arguments unchanged.
locationIdsstring[]NoPRODUCT only. Received into these locations. Resolve via distru-search-locations.
orderDatetimeobjectNoInclusive. YYYY-MM-DD (whole days, company timezone) or ISO 8601 with a UTC offset. Defaults to the last 30 days.
orderDatetime.endstringNo
orderDatetime.startstringNo
ownerIdsstring[]NoCounts only purchases these users own, not the vendor's or product's owner; deactivated users still count. Resolve via distru-search-users.
vendorGroupIdsstring[]NoVENDOR only. Resolve via distru-search-lookups (type COMPANY_GROUP).
productCategoryIdsstring[]NoPRODUCT only.
productSubcategoryIdsstring[]NoPRODUCT only.
productTagIdsstring[]NoPRODUCT only.
vendorIdsstring[]NoPRODUCT only.
brandIdsstring[]NoPRODUCT only.
productGroupIdsstring[]NoPRODUCT only.
maxRowsLimitintegerNoRows per page. Defaults to 500.
rowsPerenum
VENDORPRODUCT
Yes

Output

This tool returns one of 2 shapes, depending on its inputs.

Presence on a nested field assumes its parent exists.

Result shape 1

FieldTypePresenceDescription
nextCursorstringCan be absentPass as cursor to fetch the next page. Present only when meta.truncated.
metaobjectAlways
meta.reportstringAlways
meta.dateRangestringAlways
meta.rowLimitnumberAlways
meta.offsetnumberAlways
meta.rowCountnumberAlways
meta.totalRowCountnumberAlways
meta.truncatedbooleanAlways
meta.columnsobject[]Always
meta.columns[].keystringAlways
meta.columns[].labelstringAlways
rowsobject[]Always
rows[].namestringAlways
rows[].vendorIdstringAlways
rows[].lastPurchaseDatestringAlways
rows[].purchaseOrderCountstringAlways
rows[].totalPurchasesstringAlways
rows[].productOwnerstringCan be null
rows[].vendorOwnerIdstringCan be null
rows[].categorystringCan be null
rows[].relationshipTypestringCan be null
rows[].customFieldsobject[]Always
rows[].customFields[].keystringAlways
rows[].customFields[].labelstringAlways
rows[].customFields[].valuestringCan be null

Result shape 2

FieldTypePresenceDescription
nextCursorstringCan be absentPass as cursor to fetch the next page. Present only when meta.truncated.
metaobjectAlways
meta.reportstringAlways
meta.dateRangestringAlways
meta.rowLimitnumberAlways
meta.offsetnumberAlways
meta.rowCountnumberAlways
meta.totalRowCountnumberAlways
meta.truncatedbooleanAlways
meta.columnsobject[]Always
meta.columns[].keystringAlways
meta.columns[].labelstringAlways
rowsobject[]Always
rows[].namestringAlways
rows[].productIdstringAlways
rows[].skustringAlways
rows[].quantityPurchasedstringAlways
rows[].totalPurchasedstringAlways
rows[].unitTypestringAlways
rows[].categorystringAlways
rows[].subcategorystringCan be null
rows[].groupstringCan be null
rows[].vendorstringAlways
rows[].vendorIdstringAlways
rows[].ownerstringCan be null
rows[].unitCoststringCan be null
rows[].salePricestringAlways
rows[].wholesalePricestringCan be null
rows[].customFieldsobject[]Always
rows[].customFields[].keystringAlways
rows[].customFields[].labelstringAlways
rows[].customFields[].valuestringCan be null
What the AI reads

Purchase totals over a date range, one row per what rowsPer picks; only non-draft purchases count. VENDOR: each vendor with a purchase in the range, with purchase count and total spend, leaving out purchases the caller's team cannot view; for top vendors or vendor spend. PRODUCT: each product on a purchase, with quantity purchased (in the product's unit type) and total purchased (item quantity × price, summed); for what is bought most or spend by product. PRODUCT attributes are as they are now, not at purchase time; its owner is the product's owner, not the purchase owner ownerIds filters on. Rows come by total spend, highest first. lastPurchaseDate is the vendor's latest purchase across all time, as M/D/YYYY, and can fall outside the range. For the purchases themselves use distru-report-purchase-order-history. Money, quantities and counts are numeric strings. Returns 500 rows by default (maxRowsLimit, up to 5000). When meta.truncated is true more rows exist: repeat the call with the same filters, any date range made explicit so every page covers the same one, and cursor set to nextCursor — or narrow the filters when you need a summary rather than every row.