SalesOrderHistory

Get the Sales Order History report

Changed on

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.

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

Request

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

Query parameters

statusstring[]

Filter to orders whose status is any of the given values (OR). Omit for no status filter. SCREAMING_CASE; one of PENDING, PROCESSING, READY_TO_SHIP, DELIVERING, DELIVERED, COMPLETED, CANCELED.

payment_statusstring[]

Filter to orders whose payment status is any of the given values (OR). Omit for no payment filter. SCREAMING_CASE; one of NOT_PAID, PARTIALLY_PAID, FULLY_PAID, OVER_PAID.

order_sourcestring[]

Filter to orders created through any of the given sources (OR). Omit for no source filter. SCREAMING_CASE; one of LEAFLINK, EXTERNAL_BUYER, INTERNAL_USER, API.

order_datetimestring

Filter by order date, as a comma-separated after,before pair of ISO8601 UTC timestamps. Either side may be blank for an open-ended bound: 2026-01-01T00:00:00Z, matches on/after Jan 1, ,2026-02-01T00:00:00Z matches before Feb 1. When this param is omitted the report falls back to the last 30 days of order dates; supplying it overrides that default.

delivery_datetimestring

Filter by delivery date, as a comma-separated after,before pair of ISO8601 UTC timestamps; either side may be blank for an open-ended bound. No default when omitted.

due_datetimestring

Filter by due date, as a comma-separated after,before pair of ISO8601 UTC timestamps; either side may be blank for an open-ended bound. No default when omitted.

created_datetimestring

Filter by the order's creation timestamp, as a comma-separated after,before pair of ISO8601 UTC timestamps; either side may be blank for an open-ended bound. No default when omitted.

updated_datetimestring

Filter by the order's last-modified timestamp, as a comma-separated after,before pair of ISO8601 UTC timestamps; either side may be blank for an open-ended bound. No default when omitted.

totalstring

Filter by the order grand total, as a comma-separated min,max numeric range (inclusive). Either side may be blank for an open-ended bound (e.g. 100, for totals >= 100).

matched_with_compliance_transferboolean

Filter by whether the order is matched to a compliance (Metrc/BioTrack) transfer. true returns only matched orders, false only unmatched; omit to include both.

searchstring

Case-insensitive substring match against the order number, the customer name, and the LeafLink short ID (any one matching returns the order). Omit for no text search.

company_relationship_idsstring[]

Filter to orders for any of these customers, identified by their company relationship IDs (OR).

company_relationship_group_idsstring[]

Filter to orders whose customer belongs to any of these customer groups, by group ID (OR).

shipped_from_license_idsstring[]

Filter to orders shipped from any of these licenses, by license ID (OR).

menu_idsstring[]

Filter to orders placed against any of these menus, by menu ID (OR).

brand_idsstring[]

Filter to orders containing a product of any of these brands, by brand ID (OR).

owner_idsstring[]

Filter to orders owned by any of these users, by user ID (OR).

creator_idsstring[]

Filter to orders created by any of these users, by user ID (OR).

batch_idsstring[]

Filter to orders containing any of these batches, by batch ID (OR).

product_idsstring[]

Filter to orders containing any of these products, by product ID (OR). Unlike the other ID filters, these are the same id returned as a product's id elsewhere in the API.

Response

The Sales Order 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 required property // to the response with the status