Purchase totals report
distru-report-purchase-totalsReadPurchase totals over a date range, per vendor or product.
Inputs
Every tool also takes the common inputs.
| Field | Type | Required | Description |
|---|---|---|---|
| cursor | string | No | nextCursor of the previous call; keep the other arguments unchanged. |
| locationIds | string[] | No | PRODUCT only. Received into these locations. Resolve via distru-search-locations. |
| orderDatetime | object | No | Inclusive. YYYY-MM-DD (whole days, company timezone) or ISO 8601 with a UTC offset. Defaults to the last 30 days. |
| orderDatetime. | string | No | |
| orderDatetime. | string | No | |
| ownerIds | string[] | No | Counts only purchases these users own, not the vendor's or product's owner; deactivated users still count. Resolve via distru-search-users. |
| vendorGroupIds | string[] | No | VENDOR only. Resolve via distru-search-lookups (type COMPANY_GROUP). |
| productCategoryIds | string[] | No | PRODUCT only. |
| productSubcategoryIds | string[] | No | PRODUCT only. |
| productTagIds | string[] | No | PRODUCT only. |
| vendorIds | string[] | No | PRODUCT only. |
| brandIds | string[] | No | PRODUCT only. |
| productGroupIds | string[] | No | PRODUCT only. |
| maxRowsLimit | integer | No | Rows per page. Defaults to 500. |
| rowsPer | enumVENDORPRODUCT | 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
| Field | Type | Presence | Description |
|---|---|---|---|
| nextCursor | string | Can be absent | Pass as cursor to fetch the next page. Present only when meta.truncated. |
| meta | object | Always | |
| meta. | string | Always | |
| meta. | string | Always | |
| meta. | number | Always | |
| meta. | number | Always | |
| meta. | number | Always | |
| meta. | number | Always | |
| meta. | boolean | Always | |
| meta. | object[] | Always | |
| meta. | string | Always | |
| meta. | string | Always | |
| rows | object[] | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | object[] | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Can be null |
Result shape 2
| Field | Type | Presence | Description |
|---|---|---|---|
| nextCursor | string | Can be absent | Pass as cursor to fetch the next page. Present only when meta.truncated. |
| meta | object | Always | |
| meta. | string | Always | |
| meta. | string | Always | |
| meta. | number | Always | |
| meta. | number | Always | |
| meta. | number | Always | |
| meta. | number | Always | |
| meta. | boolean | Always | |
| meta. | object[] | Always | |
| meta. | string | Always | |
| meta. | string | Always | |
| rows | object[] | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Always | |
| rows[]. | string | Can be null | |
| rows[]. | object[] | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Can 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.