{
"_links": {
"next": "/api/products/analytics?from=2026-01-01&to=2026-03-31&group_by=product&compare_from=2025-01-01&compare_to=2025-03-31&sort_by=revenue&limit=2&offset=2",
"sales_summary": "/api/sales/summary?from=2026-01-01&to=2026-03-31&group_by=month",
"self": "/api/products/analytics?from=2026-01-01&to=2026-03-31&group_by=product&compare_from=2025-01-01&compare_to=2025-03-31&sort_by=revenue&limit=2&offset=0",
"top_products": "/api/sales/top-products?from=2026-01-01&to=2026-03-31"
},
"buckets": [
{
"_links": {
"product_detail": "/api/inventory/products/by-id/412"
},
"abc_class": "A",
"compare": {
"delta": 7050,
"delta_pct": 17.11,
"revenue_b": 41200
},
"cost": 31362.5,
"invoices_count": 37,
"lines_count": 42,
"margin": 16887.5,
"margin_pct": 35,
"qty": 3860,
"ref": {
"code": "GYP-12",
"id": 412,
"name": "Gypse régulier 1/2 po 4 x 8"
},
"revenue": 48250,
"share_pct": 50
},
{
"_links": {
"product_detail": "/api/inventory/products/by-id/236"
},
"abc_class": "A",
"compare": {
"delta": -2420,
"delta_pct": -10.13,
"revenue_b": 23900
},
"cost": 12888,
"invoices_count": 51,
"lines_count": 58,
"margin": 8592,
"margin_pct": 40,
"qty": 716,
"ref": {
"code": "PEI-BL4",
"id": 236,
"name": "Peinture latex blanc 3,78 L"
},
"revenue": 21480,
"share_pct": 22.26
}
],
"cache": {
"age_seconds": 0,
"cached_at": "2026-04-15T10:05:00-04:00",
"expires_at": "2026-04-16T10:05:00-04:00",
"force_refreshed": false,
"key_hash": "sha1:b7e1c94a0d3f2e6a8c5b1d9f4e7a2c0b6d8f3e1a",
"status": "miss",
"ttl_policy": "historical_24h",
"ttl_remaining_seconds": 86400
},
"compare_period": {
"from": "2025-01-01",
"to": "2025-03-31"
},
"filter": {
"limit": 2,
"offset": 0,
"sort_by": "revenue"
},
"group_by": "product",
"metadata": {
"extracted_at": "2026-04-15T10:05:00-04:00",
"has_more": true,
"invoices_count_b": 131,
"limit_applied": 2,
"next_offset": 2,
"offset_applied": 0,
"organisation_id": "entreprise_exemple",
"scope": "invoicing_lines_type_1_only",
"scope_note": "Lignes de produit des factures, avant taxes ; marge = montant de la ligne moins le coûtant unitaire au moment de la vente multiplié par la quantité",
"sdk_indexes_used": {
"invoicing": 6,
"invoicing_line": 6
},
"truncated": true
},
"period": {
"from": "2026-01-01",
"to": "2026-03-31"
},
"summary": {
"buckets_count": 27,
"buckets_total": 29,
"cost_total": 58210.4,
"invoices_count": 142,
"lines_count": 486,
"lines_without_cost": 64,
"margin_pct": 39.68,
"margin_total": 38289.6,
"qty_total": 9874.5,
"revenue_total": 96500
}
}