Get the Sales By Company report
Changed onReturns one row per customer with its last order date, order count, total received (payments applied to the customer's orders) and total sales (order totals net of returns) over the reported date range. A customer only appears when it has at least one order matching every active filter inside the range — customers with no qualifying order in the window are omitted entirely, so an empty data array is a valid result.
This is a read-only report and has no side effects. It does not touch inventory, compliance (Metrc/BioTrack), or any other entity — it only aggregates existing orders, payments and returns.
Date handling: • When no order_datetime filter is provided, the range defaults to the last 30 days (from the start of the day 30 days ago through the end of today). • The range and all dates are resolved in the API user's own timezone, so day boundaries follow that timezone rather than UTC.
Status handling: • When status is omitted, every status except CANCELED is counted. • Canceled orders are only counted when the status filter explicitly includes CANCELED.
Row ordering: • The report does not accept a sort parameter. By default rows are returned by total_sales descending (highest-selling customer first). • When search is supplied, rows are instead ordered by how closely the customer's name matches the search term.
Every value is returned as it appears in the report's CSV export, with numeric cells returned as strings (currency and percent formatting stripped), matching the rest of the API. Any custom fields configured on the customer relationship are appended as extra columns keyed by their slugified label; those keys are per-company and are also listed in meta.columns. Report-level information (the resolved date range and column definitions) is returned under meta.
Each row also carries the IDs of the records it names — customer_id and customer_owner_id, each right after its name column — so a row can be followed to the company or user endpoints without a name lookup. The CSV export leaves these ID columns out.
Requires the "view the sales by company report" permission on the API key.
Request
- Base URLhttps://app.distru.com
- AuthHTTP bearer
Query parameters
Restricts which orders are counted toward each customer's metrics (order count and totals) to the given statuses. Repeat the key once per value. When omitted, every status except CANCELED is counted; include CANCELED explicitly to count canceled orders. SCREAMING_CASE enum values only.
Bounds which orders are counted to those whose order date falls in this range (inclusive on both ends). A comma-separated pair of ISO8601 datetimes, after,before. Either side may be left blank for an open-ended bound (e.g. 2026-01-01T00:00:00Z, for from-only, or ,2026-02-01T00:00:00Z for until-only). When omitted entirely, defaults to the last 30 days. Bounds are evaluated in the API user's timezone.
Case-insensitive substring match on the customer's company name or legal business name; results are ordered by closeness of match. Omit to return all customers.
Restricts to customers belonging to any one of the given customer group IDs (OR across the list). Each is a Distru ID. Repeat the key once per value, e.g. ?company_relationship_group_ids[]=<id1>&company_relationship_group_ids[]=<id2>. Omit to apply no group filter.
Restricts the counted orders to those whose owner (assigned sales rep) is any one of the given user IDs (OR across the list). Each is a Distru ID. Note this filters the orders, not the customer's assigned owner. Repeat the key once per value. Omit to apply no owner filter.
Response
The Sales By Company report
Changes
- info
added the optional property
//to the response with the status - info
added the required property
//to the response with the status
- info