Skip to main content
The dashboard stats endpoint returns a single snapshot of key metrics scoped to the current calendar day (using the server’s configured timezone, America/La_Paz). It is designed to power frontend dashboard widgets without requiring multiple round trips.
This endpoint requires only a valid JWT. No specific role (admin or cajero) is needed.

GET /api/dashboard/stats

Return a real-time summary of restaurant activity. Authentication: Bearer JWT required
Required role: any authenticated user

Request parameters

No parameters.

Response

Returns a stats object (200 OK).
totalUsuarios
number
Count of active (non-deleted) users in the system.
totalProductos
number
Count of active (non-deleted) products.
totalPlatos
number
Count of active (non-deleted) dishes (platos).
transaccionesHoy
number
Total number of non-deleted transactions recorded today.
ordenesAbiertas
number
Number of today’s transactions with status pendiente or abierto.
ingresosHoy
string
Sum of monto_total for today’s transactions with status cerrado, as a two-decimal string (e.g. "850.00"). Returns "0.00" when there are no closed transactions.
actividadReciente
array
The 5 most recent transactions from today, ordered by hora descending. Each item has the following fields:
id
number
Transaction serial ID.
concepto
string
Transaction description (e.g. "Mesa 3 - Almuerzo").
mesa
string | null
Table or service label (e.g. "Mesa 3", "Para llevar"). null if not set.
estado
string
Transaction status: pendiente, abierto, or cerrado.
monto_total
string
Total amount as a two-decimal string (e.g. "120.00"). Defaults to "0.00".
hora
string (ISO 8601)
Timestamp of the transaction.

Error codes

StatusMeaning
401Missing or invalid JWT

Example

curl http://localhost:3000/api/dashboard/stats \
  -H "Authorization: Bearer <token>"
{
  "totalUsuarios": 4,
  "totalProductos": 12,
  "totalPlatos": 8,
  "transaccionesHoy": 15,
  "ordenesAbiertas": 3,
  "ingresosHoy": "850.00",
  "actividadReciente": [
    {
      "id": 42,
      "concepto": "Mesa 3 - Almuerzo",
      "mesa": "Mesa 3",
      "estado": "abierto",
      "monto_total": "120.00",
      "hora": "2026-03-18T14:35:00.000Z"
    },
    {
      "id": 41,
      "concepto": "Para llevar",
      "mesa": null,
      "estado": "cerrado",
      "monto_total": "75.50",
      "hora": "2026-03-18T14:10:00.000Z"
    }
  ]
}

Build docs developers (and LLMs) love