Get revenue by product
API v2 is in public beta: endpoints and fields can change before general availability. See the changelog
/back_in_stock/reports/product_revenueCosts 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_bystringReturn a row per variant or per product. Default variant.
One ofvariantproductfromstringStart 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.
tostringEnd 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.
rangestringSet to all_time for the shop's whole history instead of from/to.
One ofall_timesort_bystringColumn to sort rows by. Default revenue.
One ofrevenueunits_soldordersproduct_titleDefault"revenue"directionstringSort direction. Default desc.
One ofascdescDefault"desc"pageintegerPage of results to return, starting at 1.
Default1per_pageintegerRows per page, 1 to 100. Default 25.
Default25
Returns
windowobjectThe date range the figures cover. Null when range is all_time.
Show 2 child attributesHide child attributes
fromstringStart of the range, ISO 8601.
tostringEnd of the range, ISO 8601.
group_bystringExample:stringsort_bystringExample:stringdirectionstringExample:stringcurrencynullISO 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 objectsShow 8 child attributesHide child attributes
shopify_product_idstringExample:stringproduct_titlestringExample:stringimage_urlstring, nullableExample:stringshopify_variant_idstringExample:stringvariant_titlestringExample:stringunits_soldintegerExample:1ordersintegerExample:1revenuestringExample:string
metaobjectPagination for the list.
Show 4 child attributesHide child attributes
total_countintegerItems matching the filters, across all pages.
pageintegerPage returned, starting at 1.
per_pageintegerMost items per page.
total_pagesintegerPages available at this per_page; 0 when nothing matches.
Errors
validation_failedThe 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.
curl "https://app.stoqapp.com/api/v2/external/back_in_stock/reports/product_revenue" \
-H "X-Auth-Token: $STOQ_API_KEY"const res = await fetch("https://app.stoqapp.com/api/v2/external/back_in_stock/reports/product_revenue", {
headers: {
"X-Auth-Token": process.env.STOQ_API_KEY,
},
});
const data = await res.json();import os
import requests
res = requests.get(
"https://app.stoqapp.com/api/v2/external/back_in_stock/reports/product_revenue",
headers={"X-Auth-Token": os.environ["STOQ_API_KEY"]},
)
data = res.json()require "net/http"
require "json"
uri = URI("https://app.stoqapp.com/api/v2/external/back_in_stock/reports/product_revenue")
req = Net::HTTP::Get.new(uri, "X-Auth-Token" => ENV["STOQ_API_KEY"])
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body)curl "https://app.stoqapp.com/api/v2/external/back_in_stock/reports/product_revenue?group_by=variant&range=all_time&sort_by=revenue" \
-H "X-Auth-Token: $STOQ_API_KEY"const res = await fetch("https://app.stoqapp.com/api/v2/external/back_in_stock/reports/product_revenue?group_by=variant&range=all_time&sort_by=revenue", {
headers: {
"X-Auth-Token": process.env.STOQ_API_KEY,
},
});
const data = await res.json();import os
import requests
res = requests.get(
"https://app.stoqapp.com/api/v2/external/back_in_stock/reports/product_revenue?group_by=variant&range=all_time&sort_by=revenue",
headers={"X-Auth-Token": os.environ["STOQ_API_KEY"]},
)
data = res.json()require "net/http"
require "json"
uri = URI("https://app.stoqapp.com/api/v2/external/back_in_stock/reports/product_revenue?group_by=variant&range=all_time&sort_by=revenue")
req = Net::HTTP::Get.new(uri, "X-Auth-Token" => ENV["STOQ_API_KEY"])
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body){
"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
}
}{
"errors": [
"Invalid API key"
],
"code": "auth_invalid",
"details": [
{
"code": "auth_invalid",
"message": "Invalid API key",
"path": null,
"value": null,
"expected": null
}
]
}{
"errors": [
"name is required"
],
"code": "validation_failed",
"details": [
{
"code": "validation_failed",
"message": "name is required",
"path": null,
"value": null,
"expected": null
}
]
}{
"errors": [
"Rate limit exceeded"
],
"code": "rate_limited",
"details": [
{
"code": "rate_limited",
"message": "Rate limit exceeded",
"path": null,
"value": null,
"expected": null
}
]
}