get_top_products
Get top selling products ranked by revenue or quantity. Set level to 'variant' to break down by variant (size, colour, etc.) — includes SKU, discount, and profit margin when cost data is available. Set level to 'category' for a revenue / COGS / gross-profit / margin-% rollup by product TYPE (e.g. 'Sewing Machines vs Fabric') — the structured answer to category-P&L / margin-by-category questions (margin is computed only over cost-configured units, with a costCoveragePercent per category). Optionally filter variants by productTitle. Supports compare for WoW/MoM/YoY trend — returns top 5 rising/falling/new products with the comparison.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| level | No | Grouping level: product (default), variant (by size/colour/SKU), or category (revenue/COGS/gross-profit/margin by product type) | |
| limit | No | Number of results (default: 10) | |
| metric | No | Sort by: revenue or quantity (default: revenue) | |
| _offset | No | Pagination offset. If a response includes _pagination.hasMore=true, use _offset to fetch the next page. | |
| compare | No | Attach a `comparison` block with the top rising/falling/new products vs the WoW/MoM/YoY/previous-period window. | |
| endDate | No | End date (YYYY-MM-DD) | |
| startDate | No | Start date (YYYY-MM-DD) | |
| productTitle | No | For variant level: filter to variants of a specific product (partial match) |