Skip to content

Get sales by product

API v2 is in public beta: endpoints and fields can change before general availability. See the changelog

GET/preorders/reports/products

Costs 1 rate-limit point · Rate limits

Preorder units, orders, line revenue and last order date per variant (or product), as the dashboard's products table.

Counts preorder line items only (ordinary items in a mixed cart are excluded). revenue is line revenue. group_by=product rolls variants up to their product. range=all_time is the dashboard's All time. image_url is the variant's stored image, else the product's (null if none is stored).

Also searched asper-product reportproduct performancewhich products are preorderingreport by productper-variant reportreport by varianttop preorder products

Query parameters

  • rangestring

    Send all_time for the shop's whole history instead of a from/to window; from and to are then ignored.

    One of all_timenull
  • group_bystring

    Return one row per variant or per product. Default variant.

    One of variantproduct
    Default "variant"
  • fromstring

    Start of the window, as an ISO 8601 date or time. A bare date starts at midnight in the shop's time zone. Default 30 days ago.

  • tostring

    End of the window, as an ISO 8601 date or time. A bare date runs to the end of that day in the shop's time zone. Default today.

  • sort_bystring

    Column to sort the rows by. Default revenue; order_count is still accepted as an old name for orders.

    One of revenueunits_soldorderslast_order_dateproduct_title
    Default "revenue"
  • directionstring

    Sort order of the rows. Default desc.

    One of ascdesc
    Default "desc"
  • pageinteger

    Page of rows to return, starting at 1.

    Default 1
  • per_pageinteger

    Rows per page, 1 to 100. Default 25.

    Default 25

Returns

  • windowobject, nullable

    The date range the figures cover. Null when range is all_time.

    Show 2 child attributesHide child attributes
    • fromstring

      Start of the range, ISO 8601.

    • tostring

      End of the range, ISO 8601.

  • group_bystring
    Example: variant
  • sort_bystring
    Example: revenue
  • directionstring
    Example: desc
  • currencynull

    ISO 4217 code of the currency the money amounts in this response are in: the order's for an order, else the shop's. Null when it is not known.

  • rowsarray of objects
    Show 10 child attributesHide child attributes
    • shopify_product_idstring
      Example: gid://shopify/Product/8784906035384
    • product_titlestring
      Example: Classic Sneaker
    • image_urlstring, nullable
    • shopify_variant_idstring
      Example: gid://shopify/ProductVariant/47284734423096
    • variant_titlestring
      Example: Blue / Medium
    • skustring
      Example: CS-BLU-M
    • units_soldinteger
    • ordersinteger
      Example: 58
    • revenuestring
      Example: 7040.00
    • last_order_datestring
      Example: 2026-06-25T10:02:00Z
  • metaobject

    Pagination for the list.

    Show 4 child attributesHide child attributes
    • total_countinteger

      Items matching the filters, across all pages.

    • pageinteger

      Page returned, starting at 1.

    • per_pageinteger

      Most items per page.

    • total_pagesinteger

      Pages available at this per_page; 0 when nothing matches.

Errors

422
validation_failed

The action refused the request for a reason that is not a single bad field.

Any request can also fail with auth_invalid (401) or rate_limited (429).

Every error has the same shape: see Errors and the list of error codes.

GET/preorders/reports/products
curl "https://app.stoqapp.com/api/v2/external/preorders/reports/products" \
  -H "X-Auth-Token: $STOQ_API_KEY"
Response
{
  "window": {
    "from": "2026-05-26T00:00:00Z",
    "to": "2026-06-25T23:59:59Z"
  },
  "group_by": "variant",
  "sort_by": "revenue",
  "direction": "desc",
  "currency": "USD",
  "rows": [
    {
      "shopify_product_id": "gid://shopify/Product/8784906035384",
      "product_title": "Classic Sneaker",
      "shopify_variant_id": "gid://shopify/ProductVariant/47284734423096",
      "variant_title": "Blue / Medium",
      "sku": "CS-BLU-M",
      "units": 64,
      "orders": 58,
      "revenue": "7040.00",
      "last_order_date": "2026-06-25T10:02:00Z"
    },
    {
      "shopify_product_id": "gid://shopify/Product/8784906035384",
      "product_title": "Classic Sneaker",
      "shopify_variant_id": "gid://shopify/ProductVariant/47284734455864",
      "variant_title": "Red / Large",
      "sku": "CS-RED-L",
      "units": 31,
      "orders": 30,
      "revenue": "3410.00",
      "last_order_date": "2026-06-24T18:40:00Z"
    }
  ],
  "meta": {
    "total_count": 42,
    "page": 1,
    "per_page": 25,
    "total_pages": 2
  }
}