SalesByUser

Get the Sales By User report

Changed on

Returns the Sales By User leaderboard: one row per user (sales rep) with their leaderboard rank, order count, pre-tax sales, and total sales over the reported date range. Rows are always ranked by total sales and returned in that order, with the top seller at rank 1 — this ordering is fixed and cannot be changed by the caller.

This is a read-only aggregate of the orders already in your account; it creates nothing and changes no inventory, compliance, or order state. Each order is attributed to the user set as its sales rep, and the money columns are net of returns — a return lowers that rep's pre-tax and total sales. Both money columns reflect the same set of orders; total_sales includes tax while sales_pre_tax excludes it.

Scope of what is counted: • Date range — orders are included by their order date. When order_datetime is omitted, the report covers the last 30 days (from the start of the day 30 days ago through the end of today), resolved in the account's time zone. • Status — canceled orders are excluded by default. To count them, pass CANCELED in the status filter; passing status at all replaces the default set entirely, so list every status you want counted. • Users — every sales rep with at least one qualifying order appears; deactivated users are omitted. Use user_ids to restrict the leaderboard to specific reps.

Response values mirror the report's CSV export with numeric cells returned as strings, so leaderboard_rank, order_count, and the two money columns come back as strings (currency and comma formatting stripped), matching the rest of the API. Report-level context — the resolved human-readable date range and the column definitions — is returned under meta.

Each row also carries user_id, the ID of the user it ranks, right after the user column, so a row can be followed to the user endpoints without a name lookup. The CSV export leaves this ID column out.

Requires the "view the sales by user report" permission on the API key's user.

get/public/v1/reports/sales-by-user

Request

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

Query parameters

statusstring[]

Restricts the report to orders in these statuses (SCREAMING_CASE). Repeat the key to pass several. When omitted, every status except CANCELED is counted; passing this parameter replaces that default entirely, so include CANCELED here if you want canceled orders in the totals, and list every status you want counted.

order_datetimestring

Restricts the report to orders whose order date falls in this range, given as two comma-separated ISO8601 timestamps, after,before. Either side may be left empty for an open-ended range (,2026-02-01T00:00:00Z is everything up to that instant; 2026-01-01T00:00:00Z, is everything from that instant on). When omitted entirely, the report covers the last 30 days (start of the day 30 days ago through end of today), resolved in the account's time zone.

searchstring

Restricts the report to orders whose order number, customer name, or LeafLink short id matches this term (case-insensitive, partial match) before the per-user totals are computed. Omit to include all orders in range.

user_idsstring[]

Restricts the leaderboard to these users (sales reps), by their Distru user id. Repeat the key to pass several. When omitted, every sales rep with a qualifying order appears. Deactivated users are never included, even if listed here.

Response

The Sales By User report

Changes