SalesOrderItemHistory

Get the Sales Order Item History report

Changed on

Returns one row per sales order line item, joining each item to its order, product, brand, vendor, and customer. Each row carries the order's dates and status, the product identity (name, SKU, UPC, category, default costs/prices), and the line item's own quantity, returned quantity, and price. This is a read-only reporting endpoint; it never changes orders, inventory, or compliance state.

Scoping and date default: • Rows are always scoped to the API key's company and to the orders the key's user is permitted to see. • When order_datetime is omitted the report covers the last 30 days by order date, evaluated in the company's timezone. This 30-day default applies only to order_datetime — the other date filters (delivery_datetime, due_datetime, created_datetime, updated_datetime) add no default and simply go unfiltered when omitted. • The resolved date range (human-readable) and the exact column set are returned under meta, so read meta.columns to discover which columns a given company's response actually contains before indexing into rows by key.

Column set varies by company: • Companies on a compliance integration (Metrc or BioTrack) additionally get package columns (label, batch number, expiration/harvest date), potency columns (THC/CBD % and mg per g/mL), the compliance manifest number, and the shipped-from license. Companies with no compliance integration do not receive these columns at all. • The trade-sample-package column is Metrc-only. • Any Order custom fields configured for the company are appended as extra columns keyed by the field's label.

Value formatting (rows mirror the CSV export): • Dates come as display-formatted strings, each in two variants — one in the company's timezone (e.g. order_date) and one in UTC (e.g. order_date_utc). • Money and quantity cells are returned as strings (the currency/percent formatting of the CSV is stripped, e.g. "1234.56") so they match the rest of the API. Identifier-like cells whose number has a significant leading zero (e.g. an order number "0042") keep their display string so the zero is not lost. • status and other enum-bearing cells are returned as SCREAMING_CASE tokens (matching the rest of the public API), not the internal human-readable labels. • An empty cell is returned as an empty string or null depending on the column; treat any non-core column as possibly blank. • Each row also carries sales_order_owner_id (after sales_rep) and batch_id and package_id (after batch_number), so a row can be followed to the user, batch or package endpoints without a lookup. The CSV export leaves these ID columns out. • Each row also carries the line's price before its price tier (price_base) and the tier that priced it (the price_tier_* columns, after order_item_price), so a tier's discount on a line is price_base minus order_item_price, times quantity. The tier columns hold the tier as it was when it priced the line, so deleted tiers still show. The CSV export leaves these columns out too.

Ordering and result size: • Rows come back newest-first by order date (descending). The endpoint exposes no sort or pagination controls, so a matching filter returns every line item in one response — there is no next_page cursor. Narrow the date range or other filters to bound the result size of a large history.

Required permission: reports_permissions_sales_order_item_history — the same permission that gates the Sales Order Item History report in the app.

get/public/v1/reports/sales-order-item-history

Request

  • Base URL
    https://app.distru.com
  • Auth
    HTTP bearer

Query parameters

statusstring[]

Keep only line items whose order is in one of the given statuses. Repeat the key to pass several; multiple values are OR'd (an order matches if its status is any of them). SCREAMING_CASE enum. Omit to include every status.

payment_statusstring[]

Keep only line items whose order has one of the given invoice payment statuses. Repeat the key for several values (OR'd). SCREAMING_CASE enum. Omit to include every payment status.

order_sourcestring[]

Keep only line items whose order was created through one of the given sources. Repeat the key for several values (OR'd). SCREAMING_CASE enum: LEAFLINK, EXTERNAL_BUYER, INTERNAL_USER, API. Omit to include every source.

sample'ONLY' | 'EXCLUDE'

Filter line items by whether they are samples. ONLY returns only sample line items; EXCLUDE drops all sample line items. Omit to include both sample and non-sample items.

trade_sample_packages'ONLY' | 'EXCLUDE'

Filter line items by whether their package is a Metrc trade sample. ONLY returns only trade-sample-package items; EXCLUDE drops them. Omit to include both. Meaningful only for companies on Metrc — the trade-sample-package column exists only there.

order_datetimestring

Filter by order date, as a comma-separated ISO8601 range start,end interpreted in the company's timezone. Either side may be left blank for an open-ended range (2026-01-01T00:00:00Z, = on or after that instant; ,2026-02-01T00:00:00Z = up to it). When this param is omitted entirely the report falls back to the last 30 days by order date; this default applies to order_datetime only.

delivery_datetimestring

Filter by the order's delivery date, as a comma-separated ISO8601 range start,end (company timezone). Either side may be blank for an open-ended range. Omit to leave delivery date unfiltered — unlike order_datetime, this filter has no 30-day default.

due_datetimestring

Filter by the order's due date, as a comma-separated ISO8601 range start,end (company timezone). Either side may be blank for an open-ended range. Omit to leave due date unfiltered.

created_datetimestring

Filter by when the order was created, as a comma-separated ISO8601 range start,end (company timezone). Either side may be blank for an open-ended range. Omit to leave creation date unfiltered.

updated_datetimestring

Filter by when the order was last modified, as a comma-separated ISO8601 range start,end (company timezone). Either side may be blank for an open-ended range. Omit to leave last-modified date unfiltered.

totalstring

Keep only line items whose order total falls within a comma-separated min,max range. Either side may be left blank for an open-ended bound (100, = 100 or more; ,500 = 500 or less). Bounds are inclusive order totals in the company's currency.

matched_with_compliance_transferboolean

When true, keep only orders matched to a compliance transfer (Metrc or BioTrack); when false, keep only orders not matched to one. Omit to include both.

searchstring

Free-text search across order number, customer name, and LeafLink short ID; matches line items whose order matches on any of the three (substring, case-insensitive). Omit to skip text search.

company_relationship_idsstring[]

Keep only line items whose customer is one of the given customers, by Distru customer (company relationship) ID. Repeat the key for several (OR'd). IDs are the id strings returned elsewhere in the API.

company_relationship_group_idsstring[]

Keep only line items whose customer belongs to one of the given customer groups, by group ID. Repeat the key for several (OR'd).

shipped_from_license_idsstring[]

Keep only line items whose order ships from one of the given licenses, by license ID. Repeat the key for several (OR'd).

menu_idsstring[]

Keep only line items whose order was placed against one of the given menus, by menu ID. Repeat the key for several (OR'd).

brand_idsstring[]

Keep only line items whose product belongs to one of the given brands, by brand ID. Repeat the key for several (OR'd).

owner_idsstring[]

Keep only line items whose order owner (the assigned user) is one of the given users, by user ID. Repeat the key for several (OR'd).

creator_idsstring[]

Keep only line items whose order was created by one of the given users, by user ID. Repeat the key for several (OR'd).

batch_idsstring[]

Keep only line items sourced from one of the given batches, by batch ID. Repeat the key for several (OR'd).

product_idsstring[]

Keep only line items for one of the given products, by product ID. Repeat the key for several (OR'd).

product_group_idsstring[]

Keep only line items whose product belongs to one of the given product groups, by product group ID. Repeat the key for several (OR'd).

Response

The Sales Order Item History report

Changes

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the required property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status

    • info

      added the optional property // to the response with the status