APIPurchases by product

Get the Purchases By Product report

GET
/public/v1/reports/purchases-by-product

Returns one row per purchased product, aggregating every non-draft purchase whose date falls in the reported range. Each row carries the product's total quantity purchased and total purchased amount (each purchase item's quantity times its price, summed and rounded to 2 decimal places), alongside the product's current descriptive attributes (SKU, unit type, category, subcategory, group, vendor, owner, unit cost, sale price, and wholesale price). The attribute columns reflect the product as it stands now, not as it was at purchase time.

This is a read-only aggregate. It does not touch inventory, compliance (Metrc/BioTrack), or any purchase records — call it to analyze historical purchasing, not to reconcile a single purchase (use the purchases endpoints for that).

Date filtering, and the range echoed back under meta, are interpreted in the account's configured time zone. When no date filter is provided, the report defaults to the last 30 days. Draft purchases are always excluded; only official purchases are counted.

Every value is returned as it appears in the report's CSV export, with numeric cells returned as strings (currency and comma formatting stripped), matching the rest of the API. Any Product custom fields configured for the company are appended as extra columns (their keys vary per company). 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.

Required permission: reports_permissions_purchases_by_product.

Authorization

Bearer
headerAuthorizationBearer <token>

API token generated in Distru (Settings → Distru API). Send it on every request as Authorization: Bearer YOUR_API_TOKEN.

Query Parameters

order_datetime?string

Restrict the report to purchases dated within this range. Comma-separated pair of ISO8601 timestamps, after,before, interpreted in the account's time zone. Either side may be left empty for an open-ended bound: 2026-01-01T00:00:00Z, includes everything on or after that instant, ,2026-02-01T00:00:00Z everything up to it. When omitted entirely, the report covers the last 30 days.

search?string

Keep only products whose name or SKU matches this text. Omit to include all products.

owner_ids[]?array<string>

Restrict to purchases whose owner (the purchase's assigned sales rep) is one of these users. Repeat the key per id; values are Distru user ids. Multiple ids widen the match (a purchase owned by any listed user is included). Omit to include every owner. This filters the purchases that are aggregated and is unrelated to the product-level owner column in each response row.

location_ids[]?array<string>

Restrict to purchases received into these locations. Repeat the key per id; values are Distru location ids. Multiple ids widen the match. Omit to include every location on the account, archived locations included, so historical purchases against since-deleted locations still appear.

Response Body

The Purchases By Product report

*/*
  1. response

The Purchases By Product report

data*array<>

One row per purchased product matching the filters. Empty array when no non-draft purchases fall in the range.

meta*

Report-level metadata returned alongside the report rows.

Example Request
curl -X GET 'https://app.distru.com/public/v1/reports/purchases-by-product?order_datetime=2026-06-01T00%3A00%3A00Z%2C2026-08-01T00%3A00%3A00Z'
Example Response
{  "data": [    {      "category": "Some category 71",      "group": "Product Group 74",      "name": "Alpha",      "owner": "FirstName968 LastName969",      "product_id": "2d4e6f80-1a3b-4c5d-9e7f-8a9b0c1d2e3f",      "quantity_purchased": "4",      "sale_price": "1.00",      "sku": "sku 170",      "subcategory": "Some subcategory 72",      "total_purchased": "40.00",      "unit_cost": null,      "unit_type": "Gram",      "vendor": "Company 398",      "vendor_id": "9b8a7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",      "wholesale_price": null    }  ],  "meta": {    "columns": [      {        "key": "name",        "label": "Name"      },      {        "key": "product_id",        "label": "Product ID"      },      {        "key": "sku",        "label": "SKU"      },      {        "key": "quantity_purchased",        "label": "Quantity Purchased"      },      {        "key": "total_purchased",        "label": "Total Purchased"      },      {        "key": "unit_type",        "label": "Unit Type"      },      {        "key": "category",        "label": "Category"      },      {        "key": "subcategory",        "label": "Subcategory"      },      {        "key": "group",        "label": "Group"      },      {        "key": "vendor",        "label": "Vendor"      },      {        "key": "vendor_id",        "label": "Vendor ID"      },      {        "key": "owner",        "label": "Owner"      },      {        "key": "unit_cost",        "label": "Unit Cost"      },      {        "key": "sale_price",        "label": "Sale Price"      },      {        "key": "wholesale_price",        "label": "Wholesale Price"      }    ],    "date_range": "May 31, 2026 to Jul 31, 2026",    "report": "purchases_by_product"  }}