---
title: "Get the Sales Order History report"
method: GET
path: "/public/v1/reports/sales-order-history"
tags: ["SalesOrderHistory"]
---

# Get the Sales Order History report

`GET /public/v1/reports/sales-order-history`

## Request

- Base URL: `https://app.distru.com`
- URL: `https://app.distru.com/public/v1/reports/sales-order-history`
- Auth: HTTP bearer

Returns one row per sales order — its dates, customer, status, owner, and monetary totals (paid, outstanding, subtotal, taxes, discounts, charges, returns, and grand total). This is a read-only report: it never creates, changes, or deletes orders, inventory, payments, or compliance records, and has no effect on Metrc or BioTrack. Use it to reconcile order value and payment state across a date window; do not use it to fetch a single order's line items (use the Orders endpoints for that).

When no `order_datetime` filter is supplied the report defaults to orders whose order date falls in the last 30 days. All other date filters (`delivery_datetime`, `due_datetime`, `created_datetime`, `updated_datetime`) have no default — omitting them applies no bound on that field. Multiple filters combine with AND; repeated values within one array filter combine with OR.

This endpoint is not paginated: it returns every order matching the filters in a single response, and there is no `next_page` link. A wide date window can therefore produce a large payload, so narrow the date filters to bound the result set. Unlike the report's own UI export, the response carries only order rows — there is no trailing "Total" summary row.

Every cell is returned as it appears in the report's CSV export. Values that look numeric (the monetary columns) are returned as strings (currency and comma formatting stripped) so they match the rest of the API; everything else stays a string too. A value whose numeric part has a leading zero (for example an order number like `"0042"`) keeps its full display string so the leading zeros are not lost. Date cells are display-formatted strings in the resolved format, not ISO8601, and each date is returned twice — once in the company's timezone and once in UTC.

Each row also carries the IDs of the records it names — `sales_order_id`, `customer_id` and `sales_order_owner_id`, each right after its name column — so a row can be followed to the order, company or user endpoints without a name lookup. The CSV export leaves these ID columns out.

Companies on a compliance integration receive two extra columns — a manifest number (labeled per the active system, Metrc or BioTrack) and the shipped-from license — appended after the standard columns. Any Order custom fields configured for the company are appended after those, keyed by the slugified custom field label. The `meta` object echoes the resolved human-readable date range and the full ordered list of column definitions (each with its response `key` and display `label`), so an integrator can map dynamic keys without hardcoding them.

Requires the "view the sales order history report" permission on the API key.

## Query parameters

- `status` string[]
- `payment_status` string[]
- `order_source` string[]
- `order_datetime` string
- `delivery_datetime` string
- `due_datetime` string
- `created_datetime` string
- `updated_datetime` string
- `total` string
- `matched_with_compliance_transfer` boolean
- `search` string
- `company_relationship_ids` string[]
- `company_relationship_group_ids` string[]
- `shipped_from_license_ids` string[]
- `menu_ids` string[]
- `brand_ids` string[]
- `owner_ids` string[]
- `creator_ids` string[]
- `batch_ids` string[]
- `product_ids` string[]

## Response `200`

The Sales Order History report

- SalesOrderHistoryReport: The Sales Order History report
  - `data` SalesOrderHistoryReportRow[], required: The report rows
    - `charges_taxes_not_included` string, required: Total non-tax charges on the order, excluding taxes; 0 when none
    - `customer` string: The customer (company relationship) name, or `null` when the order has no linked customer.
    - `customer_id` string: The customer's company ID — the `id` [GET /public/v1/companies](#get-companies) returns and the value `company_relationship_ids` filters on — or `null` when the order has no linked customer.
    - `delivery_date` string: The delivery date as a display-formatted string in the company's timezone, or `null` when the order has no delivery date.
    - `delivery_date_utc` string: The same delivery date in UTC, or `null` when the order has no delivery date.
    - `discounts_taxes_not_included` string, required: Total discounts applied to the order, excluding taxes; 0 when none
    - `due_date` string, required: The due date as a display-formatted string in the company's timezone. Always present — every order has a due date (enforced on write).
    - `due_date_utc` string, required: The same due date in UTC. Always present.
    - `menu` string: The name of the menu the order was placed through, or `null` when the order was not placed through a menu. Companies without DistruCommerce do not receive this column.
    - `order_date` string, required: The order date as a display-formatted string in the company's timezone, e.g. "01/15/2026" (not ISO8601)
    - `order_date_utc` string, required: The same order date as a display-formatted string in UTC
    - `order_number` string, required: The order number, always returned as a string; even a purely numeric order number stays a string, and one with non-digit characters or a significant leading zero (e.g. "0042") keeps its full display string so the zero isn't lost.
    - `order_source` 'LEAFLINK' | 'EXTERNAL_BUYER' | 'INTERNAL_USER' | 'API', required: How the order was created, as a SCREAMING_CASE token. Always present.
    - `outstanding` string, required: Unpaid balance: total minus returns minus payments; 0 when fully settled
    - `owner` string: The order owner's name, or `null` when the order has no owner.
    - `paid` string, required: Total payments applied to the order; 0 when none
    - `returns` string, required: Total value of returns against the order; 0 when none
    - `sales_order_id` string, required: The order's ID — the `id` [GET /public/v1/orders](#get-orders) returns.
    - `sales_order_owner_id` string: The order owner's ID — the `id` [GET /public/v1/users](#get-users) returns — or `null` when the order has no owner.
    - `status` 'PENDING' | 'PROCESSING' | 'READY_TO_SHIP' | 'DELIVERING' | 'DELIVERED' | 'COMPLETED' | 'CANCELED', required: The order status in SCREAMING_CASE. A rare internal status the public API does not expose (e.g. a merged order) is returned as its raw internal string. Always present.
    - `subtotal` string, required: Sum of the order's line-item quantity times price, before taxes, charges, and discounts; 0 when the order has no items
    - `taxes` string, required: Total tax charges on the order; 0 when none
    - `total` string, required: The order grand total (subtotal plus charges and taxes, minus discounts); 0 when the order is empty
  - `meta` SalesOrderHistoryReportMeta, required: Report-level metadata
    - `columns` SalesOrderHistoryReportColumn[], required: The ordered column definitions for this response, including any compliance and custom-field columns present for the company. Each entry pairs the row `key` with its display `label`.
      - `key` string, required: The slugified key this column uses in every data row map (e.g. "order_date", "discounts_taxes_not_included"). Use it to read the corresponding value from each row.
      - `label` string, required: The human-readable column label as shown in the CSV export (e.g. "Order Date", "Discounts (taxes not included)")
    - `date_range` string, required: The human-readable date range the report covers, reflecting the resolved `order_datetime` filter (or the last-30-days default when none was given)
    - `report` string, required: The report identifier; always "sales_order_history"

## 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`: 3 info
  - added the optional property `data/items/customer_id` to the response with the `200` status
  - added the optional property `data/items/sales_order_owner_id` to the response with the `200` status
  - added the required property `data/items/sales_order_id` to the response with the `200` status

[Operation history](https://skmtc.dev/distru/apis/distru-api/changes/public/v1/reports/sales-order-history/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)
