Skip to main content
GET
/
api
/
products
List products with sales and stock performance
curl --request GET \
  --url https://app.solya.app/api/products \
  --header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "averagePrice": 122.6,
      "avgGrossMarginPct": 55,
      "avgSellingPrice": 122.65,
      "brandName": "Sézane",
      "family": "Robes",
      "id": "product-uuid-1",
      "imageUrl": "https://cdn.example.com/products/robe-angele.jpg",
      "monthlySales": 23,
      "name": "Robe Angèle",
      "shopCount": 6,
      "sizesAvailable": [
        "XS",
        "S",
        "M",
        "L"
      ],
      "stockValue": 2473.49,
      "tags": [
        "Overstock - +30 jours"
      ],
      "totalCogs": 1269.38,
      "totalDiscount": 0,
      "totalGrossMargin": 1551.52,
      "totalGrossSales": 2820.9,
      "totalNetSales": 2820.9,
      "totalQuantity": 217,
      "totalTransactions": 17,
      "totalUnitsSold": 23,
      "variantCount": 4
    },
    {
      "averagePrice": 85,
      "avgGrossMarginPct": 55,
      "avgSellingPrice": 85,
      "brandName": "Sézane",
      "family": "Chemises",
      "id": "product-uuid-2",
      "imageUrl": "https://cdn.example.com/products/chemise-adele.jpg",
      "monthlySales": 11,
      "name": "Chemise Adèle",
      "shopCount": 4,
      "sizesAvailable": [
        "S",
        "M",
        "L"
      ],
      "stockValue": 1078,
      "tags": [],
      "totalCogs": 420,
      "totalDiscount": 0,
      "totalGrossMargin": 515,
      "totalGrossSales": 935,
      "totalNetSales": 935,
      "totalQuantity": 98,
      "totalTransactions": 9,
      "totalUnitsSold": 11,
      "variantCount": 3
    }
  ],
  "page": 1,
  "pageSize": 20,
  "total": 58
}

Authorizations

Authorization
string
header
required

User session token issued by NextAuth. For human users accessing Solya via the web application.

Query Parameters

page
integer
default:1

Page number, 1-indexed (default: 1)

Required range: 1 <= x <= 9007199254740991
pageSize
integer
default:20

Number of items per page, max 100 (default: 20)

Required range: 1 <= x <= 100
q
string

Case-insensitive substring search query

brandId
string
period
enum<string>

Pre-aggregated time window to read product KPIs for (defaults to LAST_30_DAYS). The gold dim_product_summary tables hold one row per product per time_period; this selects which window's aggregates (sales, units, margin, stock) are returned. Choosing a different period changes the metric values, not the set of products.

Available options:
LAST_7_DAYS,
LAST_30_DAYS,
LAST_90_DAYS,
LAST_6_MONTHS,
LAST_12_MONTHS,
THIS_MONTH,
THIS_QUARTER,
THIS_YEAR,
YEAR_TO_DATE,
LAST_MONTH,
LAST_QUARTER,
LAST_YEAR,
ALL_TIME
sortBy
enum<string>
default:name

Column to sort by. Defaults to 'name' (alphabetical). For best-selling / top-selling products, use a sales metric: 'totalNetSales' (net revenue), 'totalGrossSales' (gross revenue), or 'totalUnitsSold' (units sold), combined with sortDirection=desc. Other metrics: 'totalQuantity' (stock on hand), 'averagePrice', 'monthlySales', 'stockValue', 'totalDiscount', 'totalCogs', 'totalGrossMargin', 'totalTransactions', 'avgGrossMarginPct', 'avgSellingPrice', 'variantCount', 'shopCount', plus the 'brandName' and 'family' dimensions.

Available options:
name,
brandName,
family,
totalQuantity,
averagePrice,
monthlySales,
stockValue,
totalGrossSales,
totalNetSales,
totalUnitsSold,
totalDiscount,
totalCogs,
totalGrossMargin,
totalTransactions,
avgGrossMarginPct,
avgSellingPrice,
variantCount,
shopCount
sortDirection
enum<string>
default:asc

Sort direction: 'asc' or 'desc'. Defaults to 'asc'. Use 'desc' with a sales-metric sortBy (e.g. totalNetSales) to rank best-sellers first.

Available options:
asc,
desc

Response

Successful response

data
object
required
success
enum<boolean>
required
Available options:
true