Skip to content

Get revenue by product

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

GET/back_in_stock/reports/product_revenue

Costs 1 rate-limit point · Rate limits

Revenue, units and orders from back-in-stock alerts per variant (or product), as the dashboard's revenue table.

revenue is the line revenue of the alerted items only (not whole orders), so rows add up to the total without overlap. units_sold is item quantity; orders is distinct orders containing the item. image_url is the variant's stored image, else the product's (null if none is stored).

Also searched asrevenue by productwhich products recovered revenueback in stock product revenuetop selling restocked productsunits sold from alerts

Query parameters

  • group_bystring

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

    One of variantproduct
  • fromstring

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

  • tostring

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

  • rangestring

    Set to all_time for the shop's whole history instead of from/to.

    One of all_time
  • sort_bystring

    Column to sort rows by. Default revenue.

    One of revenueunits_soldordersproduct_title
    Default "revenue"
  • directionstring

    Sort direction. Default desc.

    One of ascdesc
    Default "desc"
  • pageinteger

    Page of results to return, starting at 1.

    Default 1
  • per_pageinteger

    Rows per page, 1 to 100. Default 25.

    Default 25

Returns

  • windowobject

    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: string
  • sort_bystring
    Example: string
  • directionstring
    Example: string
  • 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 8 child attributesHide child attributes
    • shopify_product_idstring
      Example: string
    • product_titlestring
      Example: string
    • image_urlstring, nullable
      Example: string
    • shopify_variant_idstring
      Example: string
    • variant_titlestring
      Example: string
    • units_soldinteger
      Example: 1
    • ordersinteger
      Example: 1
    • revenuestring
      Example: string
  • 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/back_in_stock/reports/product_revenue
curl "https://app.stoqapp.com/api/v2/external/back_in_stock/reports/product_revenue" \
  -H "X-Auth-Token: $STOQ_API_KEY"
Response
{
  "window": {
    "from": "2026-01-15T09:30:00Z",
    "to": "2026-01-15T09:30:00Z"
  },
  "group_by": "string",
  "sort_by": "string",
  "direction": "string",
  "currency": null,
  "rows": [
    {
      "shopify_product_id": "string",
      "product_title": "string",
      "image_url": "string",
      "shopify_variant_id": "string",
      "variant_title": "string",
      "units_sold": 1,
      "orders": 1,
      "revenue": "string"
    }
  ],
  "meta": {
    "total_count": 1,
    "page": 1,
    "per_page": 1,
    "total_pages": 1
  }
}