---
title: "Get the Purchases By Company report"
method: GET
path: "/public/v1/reports/purchases-by-company"
tags: ["PurchasesByCompany"]
---

# Get the Purchases By Company report

`GET /public/v1/reports/purchases-by-company`

## Request

- Base URL: `https://app.distru.com`
- URL: `https://app.distru.com/public/v1/reports/purchases-by-company`
- Auth: HTTP bearer

Returns 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`.

## Query parameters

- `order_datetime` string
- `search` string
- `company_relationship_group_ids` string[]
- `owner_ids` string[]

## Response `200`

The Purchases By Company report

- PurchasesByCompanyReport: The Purchases By Company report
  - `data` PurchasesByCompanyReportRow[], required: The report rows
    - `category` string: The related company's category, or null when the company has no category set.
    - `last_purchase_date` string: Date of the vendor's most recent non-draft purchase, formatted `M/D/YYYY` in your company's timezone (month and day are not zero-padded, e.g. `8/5/2026`). This is the latest purchase across all time, not limited to the reported date range. An empty string `""` when that purchase has no order date recorded.
    - `name` string, required: The vendor's related company name. Always present.
    - `product_owner` string: Full name of the sales rep assigned to this vendor, or null when no owner is assigned.
    - `purchase_order_count` string, required: Number of non-draft purchases counted for this vendor within the reported date range (and matching the `owner_ids` filter). Always at least 1, since vendors with no qualifying purchases are omitted.
    - `relationship_type` string: The vendor's relationship type name, or null when none is assigned.
    - `total_purchases` string, required: Total amount spent across the counted purchases, in your company's currency, summed over the reported date range (and `owner_ids` filter). Never null; a vendor whose purchases all total zero reports 0.
    - `vendor_id` string, required: The vendor's company ID — the `id` [GET /public/v1/companies](#get-companies) returns.
    - `vendor_owner_id` string: The ID of the sales rep assigned to this vendor — the `id` [GET /public/v1/users](#get-users) returns — or null when no owner is assigned.
  - `meta` PurchasesByCompanyReportMeta, required: Report-level metadata
    - `columns` PurchasesByCompanyReportColumn[], required: Ordered column definitions for the rows in `data`, including any appended CompanyRelationship custom-field columns. Always present.
      - `key` string, required: The key this column appears under on every data row (the slugified label).
      - `label` string, required: The human-readable label of the column.
    - `date_range` string, required: Human-readable label of the date range the report covers, derived from the `order_datetime` filter, or the default last-30-days window when that filter is omitted. Always present.
    - `report` string, required: The report identifier, always `purchases_by_company`.

## Other responses

- `400`: Invalid parameters
- `401`: Missing or invalid API token
- `403`: The API token lacks the required permission, or team restrictions hide the record

## Changes

- **2026-10-07** `e8639f7dafed`: 2 info
  - added the optional property `data/items/vendor_owner_id` to the response with the `200` status
  - added the required property `data/items/vendor_id` to the response with the `200` status

[Operation history](https://skmtc.dev/distru/apis/distru-api/changes/public/v1/reports/purchases-by-company/get.md)

---

[API](https://skmtc.dev/distru/apis/distru-api.md) - [All operations](https://skmtc.dev/distru/apis/distru-api/llms.txt) - [OpenAPI document](https://skmtc.dev/distru/apis/distru-api/revisions/9d851a88e82f?raw)
