The analytics report endpoints provide granular breakdowns of platform data for use in charts, tables, and operational reports. Each endpoint targets a specific dimension — building types, upcoming events, login history, daily access timelines, user role distribution, and popular navigation routes — so you can query only the data your admin interface needs.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/luiss811/Backend-Airguide/llms.txt
Use this file to discover all available pages before exploring further.
GET /api/analytics/edificios-tipo
Returns the count of active buildings grouped by type.Request headers
Bearer token for an admin user.
Response — 200 OK
Returns an array of objects, one per building type found among active buildings.Building type identifier. Common values:
academico, administrativo, recreativo.Number of active buildings with this type.
Example
GET /api/analytics/eventos-proximos
Returns up to 10 active events starting within the next three months, ordered byfecha_inicio ascending. Use this to display an upcoming-events widget in an admin dashboard.
Request headers
Bearer token for an admin user.
Response — 200 OK
Returns an array of evento objects. Each object includes the full event record plus a nestededificio with its nombre.
Unique event identifier.
Event name.
ISO 8601 start datetime.
ISO 8601 end datetime.
Always
true for results returned by this endpoint.The building associated with this event.
Example
GET /api/analytics/accesos-recientes
Returns up to 50 recent login access log entries from the last N days, ordered byfecha descending. Use this to audit recent authentication activity.
Request headers
Bearer token for an admin user.
Query parameters
Number of days to look back from the current moment. Defaults to
7 if omitted.Response — 200 OK
Returns an array of log access objects with a nestedusuario.
ISO 8601 timestamp of the login event.
The user who triggered the access log entry.
The response is capped at 50 records regardless of how many log entries fall within the requested window. To retrieve older records, reduce the time window or paginate at the application level.
Example
GET /api/analytics/accesos-timeline
Returns daily access counts over the last N days. Each entry in the response array represents one calendar day and the number of logins recorded that day. Use this data to render a time-series chart.Request headers
Bearer token for an admin user.
Query parameters
Number of days to include in the timeline. Defaults to
30 if omitted.Response — 200 OK
Returns an array of daily aggregates. Days with zero accesses are not included.Calendar date in
YYYY-MM-DD format.Number of login events recorded on this date.
Example
GET /api/analytics/usuarios-rol
Returns user counts grouped by role and account status. Use this to build a role-distribution chart or a user-status summary table.Request headers
Bearer token for an admin user.
Response — 200 OK
Returns an array of objects, one per unique(rol, estado) combination that exists in the database.
User role, e.g.
alumno, profesor, admin.Account status:
activo, pendiente, or rechazado.Number of users with this role and status combination.
Example
GET /api/analytics/rutas-populares
Returns the top 10 navigation routes ranked by usage count. Only active routes with at least one recorded use are included. Building names are resolved from IDs; if a building cannot be found, the fallback format{tipo} {id} is used.
Request headers
Bearer token for an admin user.
Response — 200 OK
Returns an array of up to 10 route objects ordered byusos descending.
Unique route identifier (
id_ruta).Name of the origin building, or
"{tipo} {id}" if the building record is not found.Name of the destination building, or
"{tipo} {id}" if the building record is not found.Total number of times this route has been used (
contador_usos).Example
Error responses
| Status | Body | Cause |
|---|---|---|
401 | { "error": "No autorizado" } | Missing or invalid Bearer token. |
403 | { "error": "Acceso denegado. Se requieren permisos de administrador" } | Token belongs to a non-admin user. |
500 | { "error": "Error interno" } | Unexpected server-side error. |
