Get the Sales By Product report
Changed onReturns one row per product with its quantity sold and total sales over the reported date range, alongside the product's descriptive attributes (SKU, unit type, category, subcategory, group, vendor, owner, unit cost, sale price, wholesale price, shipped-from license, and UPC). Quantity sold and total sales are aggregated from sales order items over the date range and are net of returns, so a product with more returns than sales can report negative figures. This is a read-only aggregate report; it does not touch inventory, compliance (Metrc/BioTrack), or any order records.
Use this to pull period sales performance broken down by product (for example a monthly or quarterly sell-through summary). It is not the endpoint for line-item detail — it collapses every matching order item into a single per-product total, so you cannot see which orders contributed. Filters combine with AND (a row must satisfy all supplied filters); within a single multi-value filter the values combine with OR.
Date range: when order_datetime is omitted the report covers the last 30 days, resolved in the requesting user's company timezone. Canceled orders are excluded unless the status filter explicitly lists CANCELED.
Response shape: each row is returned as it appears in the report's CSV export. Cells that look numeric (money, quantities) are returned as strings (currency and percent formatting stripped) so they match the rest of the API; everything else is a string too. An optional product attribute the product doesn't have comes back as null (the one exception is sku, which is always a string and is empty rather than null when unset). Because every numeric cell is a string, an all-digit identifier such as a numeric sku or upc comes back as a string, and one that carries a significant leading zero keeps its full display string so the zero isn't lost. Any Product custom fields configured for the company are appended as extra columns keyed by the field's slug, so rows for such companies carry additional keys beyond the documented ones. Report-level information (the resolved human-readable date range and the ordered column definitions) is returned under meta.
Each row also carries the IDs of the records it names — product_id and vendor_id, each right after its name column — so a row can be followed to the product or company endpoints without a name lookup. The CSV export leaves these ID columns out.
Requires the "view the sales by product report" permission.
Request
- Base URLhttps://app.distru.com
- AuthHTTP bearer
Query parameters
Include only sales orders whose status is one of the supplied values. Values are SCREAMING_CASE and combine with OR. Allowed: PENDING, PROCESSING, READY_TO_SHIP, DELIVERING, DELIVERED, COMPLETED, CANCELED. When omitted, every status except CANCELED is included; CANCELED orders are counted only when you list CANCELED here.
Restrict to orders whose order date falls in this range. Format is two ISO8601 datetimes separated by a comma, after,before (inclusive bounds). Leave one side empty to make the range open-ended: 2026-01-01T00:00:00Z, matches everything on or after that instant, and ,2026-02-01T00:00:00Z everything up to it; supplying neither side (a lone comma) is rejected. When the whole parameter is omitted, the report covers the last 30 days resolved in the company's timezone.
Case-insensitive substring match against the product name or SKU; only products matching are included in the report.
Include only sales to these customers, given as public customer (company relationship) IDs. Values combine with OR. Combine with exclude_customer_ids to include-then-exclude.
Exclude sales to these customers, given as public customer (company relationship) IDs. Applied after customer_ids, so a customer listed in both is excluded. Values combine with OR.
Include only orders owned by these sales reps, given as public user IDs. Values combine with OR. When omitted, orders from every sales rep in the company are included (no owner restriction).
Include only order items whose shipped-from location is one of these, given as public location IDs. Values combine with OR. This filter and user_ids are evaluated as a single OR: an order item is kept when its shipped-from location matches location_ids OR its handling user matches user_ids. When both location_ids and user_ids are omitted the report spans every location and user in the company (no location/user restriction); supplying only one of the two turns off the other's default, so passing just location_ids restricts the report purely by location.
Include only order items handled by these users, given as public user IDs. Values combine with OR. Evaluated together with location_ids as a single OR: an order item is kept when its handling user matches user_ids OR its shipped-from location matches location_ids. When both are omitted the report spans every user and location in the company; supplying just user_ids turns off the location default and restricts the report purely by user.
Include only order items shipped from these licenses, given as public license IDs. Values combine with OR.
Response
The Sales By Product report
Changes
- info
added the required property
//to the response with the status - info
added the required property
//to the response with the status
- info