Skip to main content
Creates a new beneficiario with the specified information.

Endpoint

POST /beneficiarios

Authentication

This endpoint requires a valid JWT token.
Authorization: Bearer YOUR_JWT_TOKEN

Request Body

nombre
string
required
Full name of the beneficiario (max 150 characters)
tiempoAsignado
number
required
Assigned time amount (must be greater than 0)
unidadTiempo
string
required
Time unit for the assigned time. Must be one of:
  • HORAS - Hours
  • MESES - Months

Response

id
number
Unique identifier for the beneficiario
nombre
string
Full name of the beneficiario
fechaIngreso
string
Date of entry (auto-generated as current date)
tiempoAsignado
number
Assigned time amount
unidadTiempo
string
Time unit (HORAS or MESES)
creadoEn
string
Timestamp when record was created

Example Request

curl -X POST http://localhost:3000/beneficiarios \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "nombre": "Juan Pérez García",
    "tiempoAsignado": 6,
    "unidadTiempo": "MESES"
  }'

Example Response

{
  "id": 1,
  "nombre": "Juan Pérez García",
  "fechaIngreso": "2026-03-05",
  "tiempoAsignado": 6,
  "unidadTiempo": "MESES",
  "creadoEn": "2026-03-05T10:30:00.000Z"
}

Validation Errors

{
  "statusCode": 400,
  "message": [
    "El nombre es obligatorio",
    "El tiempo asignado debe ser mayor a 0",
    "La unidad de tiempo debe ser HORAS o MESES"
  ],
  "error": "Bad Request"
}
The fechaIngreso field is automatically set to the current date when creating a beneficiario.

Build docs developers (and LLMs) love