Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/CLINTONARMANDO/apiregistropendientes/llms.txt

Use this file to discover all available pages before exploring further.

Every state change on a work order automatically generates a history entry (historial). This creates a tamper-evident audit trail showing who changed what and when — essential for SLA tracking, dispute resolution, and field operations review. Manual entries can also be created to record events that fall outside the standard state machine, such as phone calls with the client, supervisor instructions, or equipment notes. Base path: /api/historiales
All historial endpoints require a valid Authorization: Bearer <token> header.

POST /api/historiales

Create a manual history entry on a work order. Use this for events that are not driven by a state change — for example, logging a phone call, recording a supervisor decision, or noting an exception.
You do not need to call this endpoint after using PUT /api/pendientes/{id}/estado. State change endpoints create history entries automatically. Use POST /api/historiales only for custom events.

Request body

pendienteId
number
required
ID of the work order this entry belongs to.
empleadoId
number
required
ID of the employee recording this event.
estado
string
required
The EstadoPendiente value to associate with this log entry. Use the current state of the pendiente when recording a manual event. One of: REGISTRADO, ASIGNADO, EN_PROGRESO, PAUSADO, REVISION, POR_VALIDAR, OBSERVADO, FINALIZADO, POSTERGADO, CANCELADO.
detalles
string
required
Free-text description of the event being logged.

Response — 200 OK

Returns the newly created HistorialResponse:
id
number
History entry ID.
pendienteId
number
Parent work order ID.
empleado
object
Full employee object for the person who recorded this entry.
estado
string
The EstadoPendiente value captured in this entry.
detalles
string
Event description text.
fechaCreacion
string
ISO 8601 timestamp of when this entry was created.

Examples

curl --request POST \
  --url https://api.example.com/api/historiales \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "pendienteId": 42,
    "empleadoId": 3,
    "estado": "EN_PROGRESO",
    "detalles": "Cliente llamó para confirmar disponibilidad. Visita reprogramada para las 14:00."
  }'
Successful response:
{
  "id": 128,
  "pendienteId": 42,
  "empleado": {
    "id": 3,
    "nombre": "Carlos Quispe",
    "dni": "45678901",
    "email": "carlos.quispe@empresa.com",
    "rol": {
      "id": "SUPERVISOR",
      "nombre": "Supervisor"
    }
  },
  "estado": "EN_PROGRESO",
  "detalles": "Cliente llamó para confirmar disponibilidad. Visita reprogramada para las 14:00.",
  "fechaCreacion": "2026-06-15T09:12:33"
}

GET /api/historiales/pendiente/

Retrieve the complete history for a work order, ordered by fechaCreacion descending (newest entry first). This includes both automatically generated entries from state changes and any manually created entries.

Path parameters

pendienteId
number
required
ID of the work order whose history you want to retrieve.

Response — 200 OK

Returns an array of HistorialResponse objects ordered newest-first.
id
number
History entry ID.
pendienteId
number
Work order ID.
empleado
object
The employee who generated or recorded this entry.
estado
string
The state of the work order at the time this entry was created.
detalles
string
Description of what happened.
fechaCreacion
string
ISO 8601 creation timestamp.

Example

cURL
curl --request GET \
  --url https://api.example.com/api/historiales/pendiente/42 \
  --header 'Authorization: Bearer <token>'
Response:
[
  {
    "id": 130,
    "pendienteId": 42,
    "empleado": { "id": 9, "nombre": "Ana Torres", "dni": "78901234", "email": "ana@empresa.com", "rol": { "id": "TECNICO", "nombre": "Técnico" } },
    "estado": "FINALIZADO",
    "detalles": "Instalación completada. Cliente firmó conformidad.",
    "fechaCreacion": "2026-06-15T14:55:00"
  },
  {
    "id": 129,
    "pendienteId": 42,
    "empleado": { "id": 9, "nombre": "Ana Torres", "dni": "78901234", "email": "ana@empresa.com", "rol": { "id": "TECNICO", "nombre": "Técnico" } },
    "estado": "POR_VALIDAR",
    "detalles": "Trabajo terminado. Esperando validación del supervisor.",
    "fechaCreacion": "2026-06-15T14:30:00"
  },
  {
    "id": 128,
    "pendienteId": 42,
    "empleado": { "id": 3, "nombre": "Carlos Quispe", "dni": "45678901", "email": "carlos@empresa.com", "rol": { "id": "SUPERVISOR", "nombre": "Supervisor" } },
    "estado": "EN_PROGRESO",
    "detalles": "Cliente llamó para confirmar disponibilidad. Visita reprogramada para las 14:00.",
    "fechaCreacion": "2026-06-15T09:12:33"
  },
  {
    "id": 127,
    "pendienteId": 42,
    "empleado": { "id": 3, "nombre": "Carlos Quispe", "dni": "45678901", "email": "carlos@empresa.com", "rol": { "id": "SUPERVISOR", "nombre": "Supervisor" } },
    "estado": "ASIGNADO",
    "detalles": "Técnico asignado: Ana Torres.",
    "fechaCreacion": "2026-06-14T16:00:00"
  }
]
Use the history endpoint to build a timeline view in your front-end UI. The estado field on each entry lets you display which state the order was in when each event occurred, even after the order has moved on to a later state.

Build docs developers (and LLMs) love