Skip to main content
GET
/
api
/
empleados
/
profile
Get Current User Profile
curl --request GET \
  --url https://api.example.com/api/empleados/profile \
  --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 returns the complete profile information for the currently authenticated user. The system automatically links Azure AD accounts with employee records using either the Azure OID or email address.

Authentication Required

This endpoint requires a valid JWT token from Azure AD authentication.

Authentication Flow

The endpoint performs a two-step lookup:
  1. Azure OID Lookup: First attempts to find the employee by their Azure Object ID (azure_oid)
  2. Email Fallback: If not found by OID, searches by email address and automatically links the Azure OID (Just-in-Time provisioning)
  3. Access Denied: If the user doesn’t exist in the employee database, returns 403

Request

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

Headers

Authorization
string
required
Bearer token from Azure AD authentication

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": "Juan Pérez",
  "DNI": "12345678",
  "correo": "[email protected]",
  "telefono": "+51 987654321",
  "direccion": "Av. Principal 123, Lima",
  "fecha_ingreso": "2023-01-15",
  "fecha_salida": null,
  "puesto": "Desarrollador Senior",
  "img_perfil": "/images/profiles/juan.jpg",
  "azure_oid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "id_rol": 3,
  "id_estado": 1,
  "id_clinica": 5,
  "id_area": 2,
  "total_solicitudes": 15,
  "solicitudes_pendientes": 2,
  "clinica": {
    "nombre_clinica": "Clínica Central"
  },
  "estado_empleado": {
    "descripcion": "Activo"
  },
  "rol": {
    "descripcion": "Empleado"
  },
  "vacaciones": [
    {
      "dias_base": 20,
      "dias_tomados": 8,
      "dias_disponibles": 12
    }
  ]
}

Error Handling

403 Forbidden

User authenticated in Azure AD but not registered in the employee database

500 Internal Error

Database connection issues or unexpected server errors

Just-in-Time Provisioning

When an employee authenticates for the first time:
  1. System checks for existing azure_oid match
  2. If not found, searches by email in employee database
  3. If found by email, automatically updates the employee record with their azure_oid
  4. Future requests use the linked azure_oid for faster lookups
This ensures seamless integration between Azure AD and the internal employee database.

Build docs developers (and LLMs) love