Overview
The Statistics API provides aggregated sales data, profit margins, and product performance analytics across different time periods.All endpoints in this section require admin privileges.
Get Dashboard Summary
Retrieves aggregated sales and profit margin statistics for three time periods: daily, weekly (last 7 days), and monthly (last 30 days).Response
Statistics for the last 7 days (same structure as daily)
Statistics for the last 30 days (same structure as daily)
Margin Calculation
Themargin_total is calculated using the following formula for each sold item:
Get Top Products
Returns rankings of best-performing products by quantity sold and by profit margin.Query Parameters
Number of days to look back for the analysisExample:
days=7 for last week’s top productsNumber of top products to return in each rankingExample:
limit=10 for top 10 productsResponse
Top products ranked by total quantity sold:
Product identifier
Product name
Full name including parent product (for variants). Format:
"Parent Product Variant Name" or just product name if no parent.Total quantity sold
Total sales revenue from this product
Total profit margin from this product
Top products ranked by total profit margin (same structure as by_quantity)
Generate Period Report
Generates a detailed sales and profitability report for a specific period, breaking down performance by product.Query Parameters
Report period type. Options:
day- Single day reportweek- Weekly report (Monday to Sunday)month- Monthly report (full calendar month)
Reference date in
YYYY-MM-DD format. The period will be calculated based on this date:- day: Report for this specific date
- week: Report for the week containing this date
- month: Report for the month containing this date
date=2024-03-15Response
Reference date used for the report
Period label:
"Diario", "Semanal", or "Mensual"Total gross sales for the entire period
Total profit margin for the entire period
Period Date Ranges
Here’s how date ranges are calculated for each period type:Daily
Start: 00:00:00 of the specified dateEnd: 23:59:59 of the specified date
Weekly
Start: 00:00:00 of the Monday of the week containing the specified dateEnd: 23:59:59 of the Sunday of that week
Monthly
Start: 00:00:00 of the 1st day of the monthEnd: 23:59:59 of the last day of the month
Use Cases
Executive Dashboard
Executive Dashboard
Use
/stats/summary to display high-level KPIs on an executive dashboard:- Compare daily vs. weekly vs. monthly performance
- Track profit margins alongside sales volume
- Monitor sales velocity (sales_count)
Inventory Management
Inventory Management
Use
/stats/top-products to optimize inventory:- Identify fast-moving products by quantity
- Find high-margin products worth promoting
- Adjust stock levels based on sales velocity
Product Performance Analysis
Product Performance Analysis
Use
/stats/report for detailed product analysis:- Compare profitability across your catalog
- Identify underperforming products
- Calculate average margins by category
- Generate reports for accounting/management
Trend Analysis
Trend Analysis
Generate reports for multiple periods to identify trends: