Get the Purchases By Company report
Changed onReturns the Purchases By Company report: one row per vendor (a company relationship where your company buys from a related company) summarizing purchasing activity over a date range. Each row carries the vendor's most recent purchase date, the number of purchases counted, and the total amount spent.
Which vendors appear: • Only vendors with at least one non-draft purchase matching the filters (the date range plus any owner_ids filter) are included; a vendor with no qualifying purchases in the range is omitted entirely. • Draft purchases are never counted, and purchases you lack permission to view (team visibility) are excluded from the counts and totals.
Behaviors worth noting: • last_purchase_date is the vendor's most recent non-draft purchase across all time — it is NOT restricted to the reported date range, so it can fall outside the range you filtered on. • purchase_order_count and total_purchases are computed only over the purchases inside the date range (and matching the owner_ids filter). • When no date filter is provided, the report defaults to the last 30 days. All date bounds are interpreted in your company's timezone.
Every value is returned as it appears in the report's CSV export: numeric cells are returned as strings (currency and comma formatting stripped, matching the rest of the API) and date cells stay formatted strings. Any CompanyRelationship custom fields configured for your company are appended as extra columns on each row and listed in meta.columns. The resolved date range and the report's column definitions are returned under meta.
Each row also carries the IDs of the records it names — vendor_id and vendor_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.
Required permission: reports_permissions_purchases_by_company.
Request
- Base URLhttps://app.distru.com
- AuthHTTP bearer
Query parameters
Restrict the counted purchases to those whose order date falls in this range. The value is two comma-separated ISO8601 timestamps, after,before, and the range is inclusive on both ends. Either side may be left empty for an open-ended range: 2026-01-01T00:00:00Z, counts everything from that instant onward and ,2026-02-01T00:00:00Z everything up to it (both sides empty is rejected). Bounds are evaluated in your company's timezone. When omitted, the report covers the last 30 days. This only bounds the aggregated purchase_order_count and total_purchases — last_purchase_date always reflects the vendor's most recent non-draft purchase regardless of this filter.
Case-insensitive substring match on the vendor's related company name or its legal business name; only vendors that contain the term in either are returned. Omit to list all vendors.
Filter to vendors belonging to any of these vendor group ids (match-any / OR). Each id is a Distru vendor group id. Repeat the bracketed key once per value. Omit or send an empty list to apply no group filter.
Filter the counted purchases to those owned by any of these purchase owners / sales reps (match-any / OR). Each id is a Distru user id. Because this filters the purchases themselves, it also narrows which vendors appear: a vendor is listed only if it has non-draft purchases in the range owned by one of these reps, and its purchase_order_count and total_purchases reflect only those purchases. Repeat the bracketed key once per value. Omit or send an empty list to include all owners.
Response
The Purchases 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