Overview
Exports dashboard data in CSV, XLSX, or PDF format. Includes all metrics, breakdowns, and KPIs.
Authentication
Requires JWT authentication. VENDEDOR role is not authorized.
Query Parameters
Export format: csv, xlsx, pdf
Date range: today, yesterday, week, month, year, range
Start date YYYY-MM-DD (auto-uses range if both dates provided)
Breakdown dimension: ventana, loteria, vendedor
Response
Returns file download with appropriate MIME type:
- CSV:
text/csv; charset=utf-8 (with UTF-8 BOM for Excel compatibility)
- XLSX:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
- PDF:
application/pdf
Filename format: dashboard-YYYY-MM-DD.{format}
Includes sections:
- KPIs (key-value pairs)
- Breakdown by dimension (if specified)
- Alerts (if any)
Multiple sheets:
- Resumen: KPIs and totals
- Desgloses: Breakdowns by dimension
- Alertas: Risk alerts
Formatted report with:
- Header with date range
- KPI summary table
- Breakdown tables
- Alert section
Example Request
GET /api/v1/admin/dashboard/export?format=xlsx&date=month&dimension=ventana
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition: attachment; filename="dashboard-2024-03-15.xlsx"