Skip to main content
GET
/
api
/
v1
/
admin
/
dashboard
/
timeseries
Time Series
curl --request GET \
  --url https://api.example.com/api/v1/admin/dashboard/timeseries
{
  "series": [
    {
      "timestamp": "<string>",
      "sales": 123,
      "payouts": 123,
      "tickets": 123,
      "netProfit": 123
    }
  ],
  "comparison": [
    {}
  ]
}

Overview

Returns time-series data aggregated by hour, day, or week. Optionally includes comparison with previous period.

Authentication

Requires JWT authentication. VENDEDOR role is not authorized.

Query Parameters

date
enum
default:"today"
Date range preset: today, yesterday, week, month, year, range
fromDate
string
Start date in YYYY-MM-DD (required if date=range)
toDate
string
End date in YYYY-MM-DD (required if date=range)
interval
enum
default:"day"
Aggregation interval: hour, day, week
granularity
enum
Alias for interval (frontend compatibility)
compare
boolean
default:"false"
Include comparison with previous period
ventanaId
string
Filter by ventana (admin only)
loteriaId
string
Filter by lottery
betType
string
Filter by bet type

Response

series
array
Time series data points
comparison
array
Previous period comparison data (if compare=true)

Interval Limits

  • hour: Max 7 days
  • day: Max 90 days
  • week: Max 365 days

Example Request

GET /api/v1/admin/dashboard/timeseries?date=week&interval=day&compare=true

Example Response

{
  "success": true,
  "data": {
    "series": [
      {
        "timestamp": "2024-03-11T06:00:00.000Z",
        "sales": 200000,
        "payouts": 100000,
        "tickets": 150,
        "netProfit": 100000
      },
      {
        "timestamp": "2024-03-12T06:00:00.000Z",
        "sales": 250000,
        "payouts": 120000,
        "tickets": 180,
        "netProfit": 130000
      }
    ],
    "comparison": [
      {
        "timestamp": "2024-03-04T06:00:00.000Z",
        "sales": 180000,
        "payouts": 90000,
        "tickets": 140,
        "netProfit": 90000
      }
    ]
  },
  "meta": {
    "range": {
      "fromAt": "2024-03-11T06:00:00.000Z",
      "toAt": "2024-03-18T05:59:59.999Z"
    },
    "generatedAt": "2024-03-15T12:00:00.000Z"
  }
}

Build docs developers (and LLMs) love