Skip to main content
GET
/
api
/
empleados
/
:idEmpleado
Get Employee by ID
curl --request GET \
  --url https://api.example.com/api/empleados/:idEmpleado \
  --header 'Authorization: <authorization>'
{
  "id_empleado": 123,
  "nombre": "<string>",
  "DNI": "<string>",
  "correo": "<string>",
  "telefono": "<string>",
  "direccion": "<string>",
  "fecha_ingreso": "<string>",
  "fecha_salida": "<string>",
  "puesto": "<string>",
  "img_perfil": "<string>",
  "azure_oid": "<string>",
  "id_rol": 123,
  "id_estado": 123,
  "id_clinica": 123,
  "id_area": 123,
  "total_solicitudes": 123,
  "solicitudes_pendientes": 123,
  "clinica": {
    "nombre_clinica": "<string>"
  },
  "estado_empleado": {
    "descripcion": "<string>"
  },
  "rol": {
    "descripcion": "<string>"
  },
  "vacaciones": [
    {
      "dias_base": 123,
      "dias_tomados": 123,
      "dias_disponibles": 123
    }
  ]
}

Overview

This endpoint allows administrators to retrieve detailed profile information for any employee by their employee ID. It returns the same comprehensive data structure as the profile endpoint, including clinic, role, vacation, and request statistics.

Admin Access Required

This endpoint requires administrator privileges. Only users with admin role can access other employees’ profiles.

Request

curl -X GET 'https://api.yourcompany.com/api/empleados/42' \
  -H 'Authorization: Bearer YOUR_ADMIN_JWT_TOKEN'

Path Parameters

idEmpleado
integer
required
The unique identifier of the employee to retrieve. Must be a valid numeric ID.

Headers

Authorization
string
required
Bearer token from Azure AD authentication with admin privileges

Response

id_empleado
integer
Unique employee identifier
nombre
string
Employee’s full name
DNI
string
Employee’s national ID number
correo
string
Employee’s email address
telefono
string
Employee’s phone number
direccion
string
Employee’s physical address
fecha_ingreso
string
Date the employee joined (format: YYYY-MM-DD)
fecha_salida
string
Date the employee left (null if currently active)
puesto
string
Employee’s job position/title
img_perfil
string
URL or path to profile image
azure_oid
string
Azure AD Object ID for integration
id_rol
integer
Foreign key to employee role
id_estado
integer
Foreign key to employee status
id_clinica
integer
Foreign key to assigned clinic
id_area
integer
Foreign key to department/area
total_solicitudes
integer
Total number of requests submitted by this employee
solicitudes_pendientes
integer
Number of pending requests awaiting approval
clinica
object
estado_empleado
object
rol
object
vacaciones
array
Array of vacation records for the employee

Response Example

{
  "id_empleado": 42,
  "nombre": "María González",
  "DNI": "87654321",
  "correo": "[email protected]",
  "telefono": "+51 912345678",
  "direccion": "Jr. Los Olivos 456, Lima",
  "fecha_ingreso": "2022-03-10",
  "fecha_salida": null,
  "puesto": "Gerente de Operaciones",
  "img_perfil": "/images/profiles/maria.jpg",
  "azure_oid": "b2c3d4e5-f6a7-8901-bcde-fa2345678901",
  "id_rol": 2,
  "id_estado": 1,
  "id_clinica": 3,
  "id_area": 5,
  "total_solicitudes": 28,
  "solicitudes_pendientes": 3,
  "clinica": {
    "nombre_clinica": "Clínica San Juan"
  },
  "estado_empleado": {
    "descripcion": "Activo"
  },
  "rol": {
    "descripcion": "Gerente"
  },
  "vacaciones": [
    {
      "dias_base": 25,
      "dias_tomados": 10,
      "dias_disponibles": 15
    }
  ]
}

Error Handling

400 Bad Request

The provided employee ID is not a valid number

403 Forbidden

User does not have administrator privileges to access this endpoint

404 Not Found

No employee exists with the specified ID

500 Internal Error

Database connection issues or unexpected server errors

Input Validation

The endpoint performs basic sanitization:
  • ID Validation: Ensures idEmpleado is a numeric value
  • Type Safety: Non-numeric values are rejected with a 400 error
  • SQL Injection Protection: Uses parameterized queries through Sequelize ORM

Use Cases

Admin Dashboard

View detailed employee information in administrative interfaces

Request Management

Access employee details when reviewing their submitted requests

HR Operations

Manage employee records and track vacation balances

Reporting

Generate reports with comprehensive employee data

Build docs developers (and LLMs) love