Skip to main content
GET
/
api
/
v1
/
admin
/
dashboard
/
export
Export Dashboard
curl --request GET \
  --url https://api.example.com/api/v1/admin/dashboard/export

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

format
enum
default:"csv"
Export format: csv, xlsx, pdf
date
enum
default:"today"
Date range: today, yesterday, week, month, year, range
fromDate
string
Start date YYYY-MM-DD (auto-uses range if both dates provided)
toDate
string
End date YYYY-MM-DD
ventanaId
string
Filter by ventana
loteriaId
string
Filter by lottery
scope
enum
default:"all"
Data scope: all, mine
dimension
enum
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}

CSV Format

Includes sections:
  1. KPIs (key-value pairs)
  2. Breakdown by dimension (if specified)
  3. Alerts (if any)

Excel Format

Multiple sheets:
  • Resumen: KPIs and totals
  • Desgloses: Breakdowns by dimension
  • Alertas: Risk alerts

PDF Format

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

Headers

Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition: attachment; filename="dashboard-2024-03-15.xlsx"

Build docs developers (and LLMs) love