Sales order report
distru-report-sales-ordersReadSales order report, one row per order, line item or tax rate.
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. |
| batchIds | string[] | No | Order contains these batches, so LINE_ITEM rows include its other lines. Resolve via distru-search-batches. |
| brandIds | string[] | No | Order contains a product of these brands (on LINE_ITEM, the line's product). Resolve via distru-search-companies, or read it on a distru-search-products row. |
| customerGroupIds | string[] | No | Resolve via distru-search-lookups (type COMPANY_GROUP). |
| customerIds | string[] | No | Resolve via distru-search-companies. |
| deliveryDatetime | object | No | Inclusive. YYYY-MM-DD (whole days, company timezone) or ISO 8601 with a UTC offset. Setting it lifts the orderDatetime default. |
| deliveryDatetime. | string | No | |
| deliveryDatetime. | string | No | |
| dueDatetime | object | No | Inclusive. YYYY-MM-DD (whole days, company timezone) or ISO 8601 with a UTC offset. Payment due date. Setting it lifts the orderDatetime default. |
| dueDatetime. | string | No | |
| dueDatetime. | string | No | |
| matchedWithComplianceTransfer | boolean | No | Order matched to a Metrc transfer. |
| menuIds | string[] | No | Resolve via distru-search-menus. |
| orderDatetime | object | No | Inclusive. YYYY-MM-DD (whole days, company timezone) or ISO 8601 with a UTC offset. Defaults to the last 30 days when no other date filter is set. 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 | |
| orderSources | enum[]LEAFLINKEXTERNAL_BUYERINTERNAL_USERAPI | No | LEAFLINK: has a LeafLink ID; EXTERNAL_BUYER: placed by a buyer user; INTERNAL_USER: has a creator or menu; API: any other. |
| paymentStatuses | enum[]NOT_PAIDPAYINGPAIDOVERPAID | No | |
| productGroupIds | string[] | No | LINE_ITEM only. Resolve via distru-search-lookups (type PRODUCT_GROUP). |
| productIds | string[] | No | Order contains these products, so LINE_ITEM rows include its other lines. Resolve via distru-search-products. |
| sample | enumONLYEXCLUDE | No | LINE_ITEM only. Sample line items. |
| search | string | No | Case-insensitive substring of order number, LeafLink short ID or customer name (name skipped under 2 characters). |
| shippedFromLicenseIds | string[] | No | Resolve via distru-search-licenses. |
| statuses | enum[]CANCELEDCOMPLETEDDELIVEREDDELIVERINGPENDINGPROCESSINGREADY_TO_SHIP | No | Default: every status except CANCELED. Merged orders are never included; their items count on the order they merged into. Canceled orders keep their tax charges: on TAX_RATE list CANCELED only when asked. |
| taxIds | string[] | No | TAX_RATE only. Narrows both the orders counted (those with one of these taxes) and the taxes summed. Resolve via distru-search-lookups (type TAX). |
| total | object | No | Order grand total net of returns, in dollars. |
| total. | number | No | Inclusive. |
| total. | number | No | Inclusive. |
| tradeSamplePackages | enumONLYEXCLUDE | No | LINE_ITEM only. Line items whose package is a trade sample. A line item with no package is dropped either way. |
| productCategoryIds | string[] | No | LINE_ITEM only. |
| productSubcategoryIds | string[] | No | LINE_ITEM only. |
| productTagIds | string[] | No | LINE_ITEM only. |
| vendorIds | string[] | No | LINE_ITEM only. |
| maxRowsLimit | integer | No | Rows per page. Defaults to 500. |
| rowsPer | enumORDERLINE_ITEMTAX_RATE | Yes | ORDER: one row per order. LINE_ITEM: one per line item. TAX_RATE: one per tax name and rate, summed over the matching orders. |
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 | Can be null | |
| 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[]. | enumCANCELEDCOMPLETEDDELIVEREDDELIVERINGPENDINGPROCESSINGREADY_TO_SHIP | Can be null | |
| rows[]. | string | 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[]. | enumAPIEXTERNAL_BUYERINTERNAL_USERLEAFLINK | 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 | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Always | |
| rows[]. | enumCANCELEDCOMPLETEDDELIVEREDDELIVERINGPENDINGPROCESSINGREADY_TO_SHIP | Can be null | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Can be null | |
| rows[]. | string | Always | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | enumAUTONONEOVERRIDE | Always | |
| rows[]. | object | Can be null | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | object | Always | |
| rows[]. | enumAMOUNT_OFFFLAT_PRICEPERCENT_OFF | Always | |
| rows[]. | string | Can be null | |
| rows[]. | boolean | 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[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Can be null | |
| 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 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 | Can be null | |
| rows[]. | string | Can be null | |
| rows[]. | string | Always | |
| rows[]. | object[] | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Always | |
| rows[]. | string | Can be null |
What the AI reads
Sales order report at the grain rowsPer picks. ORDER: dates, customer, status, owner, money totals and payment state, no line items; for listing or totaling orders. LINE_ITEM: each line's product with brand, vendor and batch, its order's dates, status, customer and sales rep, its price tier, and for Metrc companies package and potency in customFields; for what sold on which orders, batch- or package-level sales, samples, and price tiers applied and their discounts, deleted tiers included. TAX_RATE: totalTax per tax name and rate over the matching orders, one name on several rows when charged at several rates; for tax totals and liability (per order: ORDER's taxes). For totals per customer, product or sales rep use distru-report-sales-totals; for invoices distru-report-invoice-history; for cost and margin per line distru-report-cogs; for one order's detail distru-get-sales-order; for a product-by-order quantity grid distru-report-order-fulfillment. LINE_ITEM rows come newest first by order date. Dates come in company timezone and UTC (*Utc), as YYYY-MM-DD HH:MM:SS.ffffff, no offset. ORDER total is net of returns; outstanding is total minus payments. LINE_ITEM quantity is net of returnedQuantity; batchNumber is the package's or Distru batch's number, never the batch name; customer is null on an order with no customer yet; priceTier is the tier as it priced the line, isLive false once edited or deleted; a line's tier discount is (priceBase - orderItemPrice) x quantity; defaultUnitPrice is today's list price. TAX_RATE counts only tax charges; taxRate is a percent ("27.00" is 27%), null for a flat tax; taxType is null for an unnamed charge. Money, quantities and rates 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.