Skip to main content
GET
/
api
/
dashboard-admin
/
kpis
Dashboard KPIs
curl --request GET \
  --url https://api.example.com/api/dashboard-admin/kpis
{
  "500": {},
  "status": "<string>",
  "data": {
    "solicitudes_pendientes": 123,
    "ausentes_hoy": 123,
    "dias_vacaciones_otorgados_ytd": 123,
    "plantilla_activa": 123,
    "empleado_nombre": "<string>"
  }
}

Overview

This endpoint returns key performance indicators (KPIs) for the admin dashboard. It can provide organization-wide metrics or employee-specific metrics depending on the query parameters.

Authentication

Requires JWT authentication token. Admins can view organization-wide KPIs or specific employee KPIs. Employees may be restricted based on permissions.

Query Parameters

empleado_id
integer
Optional employee ID. If provided, returns KPIs specific to that employee. If omitted, returns organization-wide KPIs.

Response

status
string
Response status (“success”)
data
object
KPI data object
solicitudes_pendientes
integer
Number of requests with “Pendiente” (Pending) status. For organization-wide: total pending requests. For employee: pending requests from that employee.
ausentes_hoy
integer
Number of employees currently absent (requests approved with today’s date within the range). For employee-specific: 1 if employee is absent today, 0 otherwise.
dias_vacaciones_otorgados_ytd
integer
Total vacation days approved year-to-date. For organization: sum across all employees. For employee: sum for that employee only.
plantilla_activa
integer
Total number of active employees in the organization. Only returned for organization-wide queries (null when empleado_id is provided).
empleado_nombre
string
Full name of the employee. Only returned when empleado_id parameter is provided (null for organization-wide queries).

Error Responses

500
object
Internal server error
{
  "status": "error",
  "message": "Error al obtener indicadores."
}

Code Examples

Organization-wide KPIs

cURL
curl -X GET 'https://api.example.com/api/dashboard-admin/kpis' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN'
JavaScript
// Get organization-wide KPIs
const response = await fetch('https://api.example.com/api/dashboard-admin/kpis', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_JWT_TOKEN',
    'Content-Type': 'application/json'
  }
});

const kpis = await response.json();
console.log(`Pending requests: ${kpis.data.solicitudes_pendientes}`);
console.log(`Absent today: ${kpis.data.ausentes_hoy}`);
console.log(`Vacation days YTD: ${kpis.data.dias_vacaciones_otorgados_ytd}`);
console.log(`Active employees: ${kpis.data.plantilla_activa}`);
Python
import requests

# Organization-wide KPIs
url = 'https://api.example.com/api/dashboard-admin/kpis'
headers = {
    'Authorization': 'Bearer YOUR_JWT_TOKEN',
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers)
kpis = response.json()['data']

print(f"Pending requests: {kpis['solicitudes_pendientes']}")
print(f"Absent today: {kpis['ausentes_hoy']}")
print(f"Vacation days YTD: {kpis['dias_vacaciones_otorgados_ytd']}")
print(f"Active employees: {kpis['plantilla_activa']}")

Employee-specific KPIs

cURL
curl -X GET 'https://api.example.com/api/dashboard-admin/kpis?empleado_id=42' \
  -H 'Authorization: Bearer YOUR_JWT_TOKEN'
JavaScript
// Get employee-specific KPIs
const employeeId = 42;
const response = await fetch(
  `https://api.example.com/api/dashboard-admin/kpis?empleado_id=${employeeId}`,
  {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_JWT_TOKEN',
      'Content-Type': 'application/json'
    }
  }
);

const kpis = await response.json();
console.log(`Employee: ${kpis.data.empleado_nombre}`);
console.log(`Their pending requests: ${kpis.data.solicitudes_pendientes}`);
console.log(`Absent today: ${kpis.data.ausentes_hoy === 1 ? 'Yes' : 'No'}`);
Python
import requests

# Employee-specific KPIs
employee_id = 42
url = f'https://api.example.com/api/dashboard-admin/kpis'
params = {'empleado_id': employee_id}
headers = {
    'Authorization': 'Bearer YOUR_JWT_TOKEN',
    'Content-Type': 'application/json'
}

response = requests.get(url, params=params, headers=headers)
kpis = response.json()['data']

print(f"Employee: {kpis['empleado_nombre']}")
print(f"Their pending requests: {kpis['solicitudes_pendientes']}")
print(f"Absent today: {'Yes' if kpis['ausentes_hoy'] == 1 else 'No'}")
print(f"Vacation days YTD: {kpis['dias_vacaciones_otorgados_ytd']}")

Example Responses

Organization-wide Response

{
  "status": "success",
  "data": {
    "solicitudes_pendientes": 15,
    "ausentes_hoy": 8,
    "dias_vacaciones_otorgados_ytd": 342,
    "plantilla_activa": 125,
    "empleado_nombre": null
  }
}

Employee-specific Response

{
  "status": "success",
  "data": {
    "solicitudes_pendientes": 2,
    "ausentes_hoy": 0,
    "dias_vacaciones_otorgados_ytd": 10,
    "plantilla_activa": null,
    "empleado_nombre": "Juan Pérez González"
  }
}

KPI Definitions

Pending Requests

Count of requests awaiting approval. Helps admins prioritize review workload.

Absent Today

Number of employees with approved requests covering today’s date. Useful for workforce planning.

Vacation Days YTD

Total vacation days approved since January 1st of current year. Tracks vacation utilization.

Active Employees

Current headcount of active employees. Only shown for organization-wide view.

Use Cases

Admin Dashboard

Display key metrics on admin dashboard homepage for quick overview

Workforce Planning

Monitor current absences to ensure adequate staffing levels

Employee Profile

Show employee-specific metrics on their profile page

Approval Queue

Display pending request count with link to approval interface

Build docs developers (and LLMs) love