Skip to main content
POST
/
solicitud
curl -X POST https://api.example.com/solicitud \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "idUsuarioSolicitante": 1,
    "idDepartamentoSolicitante": 2,
    "idUsuarioAprobador": 3,
    "idTipoPrioridadSolicitud": 2,
    "idTipoServicioSolicitud": 1,
    "asunto": "Transporte de personal a sede central",
    "descripcion": "Se requiere transporte para personal de la unidad",
    "justificacion": "Reunión de coordinación institucional",
    "cantidadPasajeros": 5,
    "nombresPasajeros": "Juan Pérez, María López, Carlos Rivas",
    "fechaServicioRequerido": "2026-04-15",
    "horaServicioRequerido": "08:00",
    "observaciones": "Llevar a las 8am y regresar a las 5pm",
    "lugares": [
      {
        "idLugar": 5,
        "esOrigen": true,
        "orden": 0,
        "descripcion": "Sede central - Salida"
      },
      {
        "idLugar": 12,
        "esOrigen": false,
        "orden": 1,
        "descripcion": "Primer destino",
        "horaEstimadaLlegada": "10:30",
        "requiereRetorno": true,
        "horaEstimadaRetorno": "12:00"
      }
    ]
  }'
{
  "success": true,
  "message": "Solicitud creada exitosamente",
  "data": {
    "Id": 42,
    "CodigoSolicitud": "SOL-2026-03-00000042",
    "IdUsuarioSolicitante": 1,
    "NombreSolicitante": "Juan Pérez",
    "EmailSolicitante": "[email protected]",
    "IdDepartamentoSolicitante": 2,
    "NombreDepartamento": "Logística",
    "IdUsuarioAprobador": 3,
    "NombreAprobador": "María González",
    "EmailAprobador": "[email protected]",
    "IdTipoPrioridadSolicitud": 2,
    "NombrePrioridad": "Normal",
    "IdTipoServicioSolicitud": 1,
    "NombreTipoServicio": "Transporte de personal",
    "Asunto": "Transporte de personal a sede central",
    "Descripcion": "Se requiere transporte para personal de la unidad",
    "Justificacion": "Reunión de coordinación institucional",
    "CantidadPasajeros": 5,
    "NombresPasajeros": "Juan Pérez, María López, Carlos Rivas",
    "FechaServicioRequerido": "2026-04-15",
    "HoraServicioRequerido": "08:00:00",
    "Observaciones": "Llevar a las 8am y regresar a las 5pm",
    "IdEstadoActual": 1,
    "CodigoEstadoActual": "PENDIENTE_APROBACION",
    "NombreEstadoActual": "Pendiente de Aprobación",
    "ColorEstadoActual": "#FFA500",
    "EsEstadoFinal": false,
    "FechaHoraCreacion": "2026-03-10T14:30:00",
    "FechaHoraActualizacion": "2026-03-10T14:30:00",
    "lugares": [
      {
        "Id": 1,
        "IdLugar": 5,
        "NombreLugar": "Sede Central",
        "DireccionLugar": "Av. Principal 123",
        "EsOrigen": true,
        "Orden": 0,
        "Descripcion": "Sede central - Salida",
        "HoraEstimadaLlegada": null,
        "RequiereRetorno": false,
        "HoraEstimadaRetorno": null
      },
      {
        "Id": 2,
        "IdLugar": 12,
        "NombreLugar": "Oficina Regional Norte",
        "DireccionLugar": "Calle Norte 456",
        "EsOrigen": false,
        "Orden": 1,
        "Descripcion": "Primer destino",
        "HoraEstimadaLlegada": "10:30:00",
        "RequiereRetorno": true,
        "HoraEstimadaRetorno": "12:00:00"
      }
    ],
    "misiones": []
  }
}

Overview

Creates a new transport solicitud (request) in the system. The solicitud is created directly in PENDIENTE_APROBACION status.
Missions are not created at this stage. The approver will create missions later in the Missions module after approval.

Authentication

Requires valid authentication token.

Request Body

idUsuarioSolicitante
integer
required
ID of the requester profile (FK to Perfil)
idDepartamentoSolicitante
integer
required
ID of the requesting department (FK to Departamento)
idUsuarioAprobador
integer
required
ID of the approver profile (FK to Perfil). Must be different from requester.
idTipoPrioridadSolicitud
integer
required
ID of the priority type (FK to TipoPrioridadSolicitud)
idTipoServicioSolicitud
integer
required
ID of the service type (FK to TipoServicioSolicitud)
asunto
string
required
Subject of the solicitud (5-250 characters)
descripcion
string
Detailed description of the solicitud
justificacion
string
Justification for the transport request
cantidadPasajeros
integer
required
Number of passengers (minimum 0)
nombresPasajeros
string
Names of passengers
fechaServicioRequerido
date
required
Date when service is required (YYYY-MM-DD format, cannot be in the past)
horaServicioRequerido
time
required
Time when service is required (HH:MM format)
observaciones
string
Additional observations
lugares
array
required
List of locations (minimum 1 required)

Business Rules

  • The solicitud code is auto-generated: SOL-{YEAR}-{MONTH}-{CORRELATIVE}
  • The requester and approver must be different people
  • Service date cannot be in the past
  • At least one location must be provided
  • Only one location can be marked as origin (esOrigen=true)
  • Origin location cannot require return (requiereRetorno must be false)
  • If requiereRetorno=true, horaEstimadaRetorno is mandatory
  • Location order values must be unique and consecutive starting from 0
  • Email notifications are sent to:
    • Requester: Confirmation email
    • Approver: Pending approval notification

Response

success
boolean
Indicates if the operation was successful
message
string
Success message
data
object
The created solicitud object

Status Codes

201
Created
Solicitud created successfully
400
Bad Request
Validation error (invalid fields, requester = approver, invalid location data)
409
Conflict
Conflict error (duplicate, business rule violation)
422
Unprocessable Entity
Business logic validation error (date in past, invalid location rules)
500
Internal Server Error
Server error
curl -X POST https://api.example.com/solicitud \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "idUsuarioSolicitante": 1,
    "idDepartamentoSolicitante": 2,
    "idUsuarioAprobador": 3,
    "idTipoPrioridadSolicitud": 2,
    "idTipoServicioSolicitud": 1,
    "asunto": "Transporte de personal a sede central",
    "descripcion": "Se requiere transporte para personal de la unidad",
    "justificacion": "Reunión de coordinación institucional",
    "cantidadPasajeros": 5,
    "nombresPasajeros": "Juan Pérez, María López, Carlos Rivas",
    "fechaServicioRequerido": "2026-04-15",
    "horaServicioRequerido": "08:00",
    "observaciones": "Llevar a las 8am y regresar a las 5pm",
    "lugares": [
      {
        "idLugar": 5,
        "esOrigen": true,
        "orden": 0,
        "descripcion": "Sede central - Salida"
      },
      {
        "idLugar": 12,
        "esOrigen": false,
        "orden": 1,
        "descripcion": "Primer destino",
        "horaEstimadaLlegada": "10:30",
        "requiereRetorno": true,
        "horaEstimadaRetorno": "12:00"
      }
    ]
  }'
{
  "success": true,
  "message": "Solicitud creada exitosamente",
  "data": {
    "Id": 42,
    "CodigoSolicitud": "SOL-2026-03-00000042",
    "IdUsuarioSolicitante": 1,
    "NombreSolicitante": "Juan Pérez",
    "EmailSolicitante": "[email protected]",
    "IdDepartamentoSolicitante": 2,
    "NombreDepartamento": "Logística",
    "IdUsuarioAprobador": 3,
    "NombreAprobador": "María González",
    "EmailAprobador": "[email protected]",
    "IdTipoPrioridadSolicitud": 2,
    "NombrePrioridad": "Normal",
    "IdTipoServicioSolicitud": 1,
    "NombreTipoServicio": "Transporte de personal",
    "Asunto": "Transporte de personal a sede central",
    "Descripcion": "Se requiere transporte para personal de la unidad",
    "Justificacion": "Reunión de coordinación institucional",
    "CantidadPasajeros": 5,
    "NombresPasajeros": "Juan Pérez, María López, Carlos Rivas",
    "FechaServicioRequerido": "2026-04-15",
    "HoraServicioRequerido": "08:00:00",
    "Observaciones": "Llevar a las 8am y regresar a las 5pm",
    "IdEstadoActual": 1,
    "CodigoEstadoActual": "PENDIENTE_APROBACION",
    "NombreEstadoActual": "Pendiente de Aprobación",
    "ColorEstadoActual": "#FFA500",
    "EsEstadoFinal": false,
    "FechaHoraCreacion": "2026-03-10T14:30:00",
    "FechaHoraActualizacion": "2026-03-10T14:30:00",
    "lugares": [
      {
        "Id": 1,
        "IdLugar": 5,
        "NombreLugar": "Sede Central",
        "DireccionLugar": "Av. Principal 123",
        "EsOrigen": true,
        "Orden": 0,
        "Descripcion": "Sede central - Salida",
        "HoraEstimadaLlegada": null,
        "RequiereRetorno": false,
        "HoraEstimadaRetorno": null
      },
      {
        "Id": 2,
        "IdLugar": 12,
        "NombreLugar": "Oficina Regional Norte",
        "DireccionLugar": "Calle Norte 456",
        "EsOrigen": false,
        "Orden": 1,
        "Descripcion": "Primer destino",
        "HoraEstimadaLlegada": "10:30:00",
        "RequiereRetorno": true,
        "HoraEstimadaRetorno": "12:00:00"
      }
    ],
    "misiones": []
  }
}
The requester and approver must be different users. The system will reject requests where both IDs are the same.

Build docs developers (and LLMs) love