Cost of goods sold report
distru-report-cogsReadCost of goods sold: one row per sold line item on a COMPLETED order that was not fully returned, with price, actual and default cost, profit and margin.
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. |
| deliveryDatetime | object | No | Inclusive. YYYY-MM-DD (whole days, company timezone) or ISO 8601 with a UTC offset. Delivery date of the line item's order. Setting it lifts the orderDatetime default. |
| deliveryDatetime. | string | No | |
| deliveryDatetime. | string | No | |
| orderDatetime | object | No | Inclusive. YYYY-MM-DD (whole days, company timezone) or ISO 8601 with a UTC offset. Defaults to the last 30 days unless deliveryDatetime is set; there is no all-time default, so send a range to widen it. 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 | |
| productCategoryIds | string[] | No | Product category of the rows. ORed with productSubcategoryIds; a listed subcategory of a listed category narrows that category to it. Resolve via distru-search-lookups (type PRODUCT_CATEGORY). |
| productSubcategoryIds | string[] | No | Product subcategory of the rows. See productCategoryIds. Resolve via distru-search-lookups (type PRODUCT_CATEGORY, each row's subcategories). |
| productTagIds | string[] | No | Any of these tags on the product. Resolve via distru-search-lookups (type PRODUCT_TAG). |
| vendorIds | string[] | No | The vendor set on the product, not the company an order was placed with. Resolve via distru-search-companies. |
| brandIds | string[] | No | Product brand of the rows, itself a company. Resolve via distru-search-companies, or read it on a distru-search-products row. |
| productGroupIds | string[] | No | Resolve via distru-search-lookups (type PRODUCT_GROUP). |
| maxRowsLimit | integer | No | Rows per page. Defaults to 500. |
Output
Presence on a nested field assumes its parent exists.
| 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 | Can be null | |
| rows[]. | string | Always | |
| 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[]. | string | Can be null | |
| 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 | 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 |
What the AI reads
Cost of goods sold: one row per sold line item on a COMPLETED order that was not fully returned, with price, actual and default cost, profit and margin. Use for COGS, margins and profit per unit, product, category or brand. For line items without cost use distru-report-sales-orders with rowsPer LINE_ITEM; for sales totals per product use distru-report-sales-totals with rowsPer PRODUCT; for the cost of stock on hand use distru-report-inventory-assets. quantity is net of returns. *Actual uses the traced cost of the inputs that produced the stock; *Default values those inputs at their configured unit cost (the cost type's, else the product's). Cost, profit and margin are null when no cost can be traced; the margins also when totalPrice is 0. marginActual and marginDefault are fractions of totalPrice (0.25 is 25%). finalInput is always "Final" and costOrigin always null. batch is the package's batchNumber for a package-tracked item, else the Distru batch name with its batch number in parentheses when it has one. Sample lines are left out when the company excludes samples from cost reporting. Money, quantity and margin values 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.