Skip to main content
The Requests API allows employees to create and manage various types of requests, while administrators can approve, reject, or view pending requests.

Authentication

All endpoints require authentication via JWT token. The token should be included in the request headers:
Authorization: Bearer <your_jwt_token>
The authenticated user’s information is automatically extracted and loaded into req.empleado.

Request Types

The API supports the following request types:

Vacation

Request time off with automatic vacation day balance checking

Profile Update

Request changes to phone number, address, or profile image

Absence

Report justified absences with date ranges

Permission

Request special permissions for specific dates

Remote Work

Request to work from external locations

Request States

Requests can be in one of four states:
  • Pending (1): Request submitted, awaiting approval
  • Approved (2): Request approved by administrator
  • Rejected (3): Request rejected by administrator
  • Canceled (4): Request canceled by the employee

Role-Based Access

The API implements role-based access control:

Employee

Can view own requests, create new requests, and cancel pending requests

Admin

Can view all requests (excluding canceled), approve/reject requests, and access calendar

Super Admin

Can view all requests including canceled, with full administrative privileges

Available Endpoints

Get Requests

Retrieve requests with pagination and filters

Create Request

Create general requests (absence, permission, remote work)

Vacation Request

Create vacation requests with balance validation

Profile Update

Request profile data changes

Approve/Reject

Approve or reject requests (Admin only)

Calendar View

View approved requests in calendar format (Admin only)

Common Response Format

Successful responses follow this structure:
{
  "status": "success",
  "data": {
    "solicitudes": [...],
    "pagination": {
      "total": 100,
      "page": 1,
      "limit": 25,
      "totalPages": 4
    }
  }
}
Error responses:
{
  "message": "Error description"
}

Build docs developers (and LLMs) love