Sales totals report
distru-report-sales-totalsReadSales totals over a date range, per customer, product or sales rep.
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. |
| customerGroupIds | string[] | No | CUSTOMER only. Resolve via distru-search-lookups (type COMPANY_GROUP). |
| customerIds | string[] | No | PRODUCT only. Resolve via distru-search-companies. |
| excludeCustomerIds | string[] | No | PRODUCT only. Applied after customerIds. |
| locationIds | string[] | No | PRODUCT only. Line items shipped from 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. If no rows match, check when the last order was with distru-search-sales-orders (sortBy ORDER_DATE DESC, limit 1) before concluding nothing sold: the account may have stopped using Distru orders, or ship only through compliance transfers (distru-report-inventory-transaction-history, transactionTypes COMPLIANCE_PACKAGE_ADDED_TO_TRANSFER). |
| orderDatetime. | string | No | |
| orderDatetime. | string | No | |
| ownerIds | string[] | No | Counts only orders these sales reps own, not the customer's or product's owner. On SALES_REP, the reps ranked: default every active user, and a listed one is ranked even when deactivated. Resolve via distru-search-users. |
| search | string | No | PRODUCT or SALES_REP only. PRODUCT: substring of product name or SKU. SALES_REP: counts only orders whose number, LeafLink short ID or customer name contains it, case-insensitive (name skipped under 2 characters); reps with no match still appear with 0s. |
| shippedFromLicenseIds | string[] | No | PRODUCT only. Resolve via distru-search-licenses. |
| statuses | enum[]PENDINGPROCESSINGREADY_TO_SHIPDELIVERINGDELIVEREDCOMPLETEDCANCELED | No | Default: every status except CANCELED and MERGED. |
| 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 | enumCUSTOMERPRODUCTSALES_REP | Yes |
Output
This tool returns one of 3 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 | Can be null | |
| 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[]. | 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 3
| 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 | Can be null | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | object[] | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Can be null |
What the AI reads
Sales totals over a date range, one row per what rowsPer picks. CUSTOMER: each customer with a matching order, with order count, total received (payments applied) and total sales (order totals net of returns); for top customers or customer spend. PRODUCT: each product sold, with quantity sold, total sales net of returns and the product's attributes; for best sellers and revenue by product. SALES_REP: a leaderboard of every user, including those with no matching orders (0 totals), ranked by total sales, with order count, salesPreTax and totalSales (including tax), both net of returns; an order counts for its owner; for rep performance. Totals are negative when returns exceed sales. CUSTOMER rows come by totalSales, highest first; lastOrderDate is the customer's latest order that wasn't canceled or merged, as M/D/YYYY in the company's timezone, and can fall outside the range; null when all were. For the orders or line items behind a total use distru-report-sales-orders; for quantity per product per order distru-report-order-fulfillment; for cost and margin distru-report-cogs; for a rep's orders distru-search-sales-orders with ownerIds. 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.