Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/sheeplettuce/Monitor/llms.txt

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

Retrieve a single expediente and all of its related records in one request. Unlike the list endpoint, this response includes the full set of scalar fields plus three nested relations: aseguradora (linked insurer), historial_estado (status-change audit log, newest-first), and evidencia (file metadata). All authenticated roles may call this endpoint.

Endpoint

GET /api/expedientes/:no_siniestro
Authentication: Bearer token required (any role).

Path parameter

no_siniestro
string
required
The unique claim number that serves as the expediente’s primary key (e.g. SIN-2024-001). Must be a non-empty string — passing an empty segment returns 400.

Request

No query parameters or request body.
curl http://localhost:3000/api/expedientes/SIN-2024-001 \
  -H "Authorization: Bearer $TOKEN"

Response — 200 OK

Returns a single expediente object with all scalar fields and nested relations.

Core fields

no_siniestro
string
Primary key — the siniestro (claim) number.
factura
string | null
Invoice number for the repair.
orden
string | null
Internal work-order reference.
asesor
string | null
Service advisor assigned to this claim.
estado
string (estado_enum)
Current workflow status. One of Ingreso, Restauracion, Pendiente_de_salida, or Salida.
ubicacion_almacenamiento
string (ubicacion_enum)
Storage location for evidence files. One of Local or Nube. Defaults to Local.
id_aseguradora
integer | null
Foreign key to the aseguradora table.
creado_por
integer | null
FK to the usuario who created this record.

Date fields

fecha_ingreso
string (ISO date) | null
Date the vehicle entered the shop. No time component — stored at 12:00:00 UTC to avoid timezone drift.
fecha_valuacion
string (ISO date) | null
Date the damage estimate (valuación) was completed.
fecha_autorizacion
string (ISO date) | null
Date the insurer authorized the repair.
fecha_pzas_completas
string (ISO date) | null
Date all replacement parts were received in full.
unidad_terminada
string (ISO date) | null
Date the vehicle repair was completed.

Vehicle fields

marca
string | null
Vehicle make (e.g. "Toyota").
modelo
string | null
Vehicle model (e.g. "Corolla").
tipo
string | null
Body type or trim (e.g. "Sedán", "SUV").
color
string | null
Vehicle color.
placas
string | null
License plate number.
vehiculo
string | null
Free-text vehicle description field (sometimes used for VIN or additional notes).

Client fields

nombre_cliente
string | null
Full name of the policyholder / vehicle owner.
telefono_cliente
string | null
Client phone number.
correo_cliente
string | null
Client email address.

Staff fields

tecnico
string | null
Body technician (carrocero) assigned to this unit.
mecanico
string | null
Mechanic assigned to this unit.
observaciones
string | null
General observations or notes about the repair.

Insurer-communication fields

comentarios_aseguradora
string | null
Free-text field for notes exchanged with the insurer.
comentarios_aseguradora_fh
string (ISO timestamp) | null
Timestamp of the latest insurer comment. Full datetime with timezone.

Custom dato fields

These four slot pairs store shop-specific milestones or tracking values. Each has a text label (datoN) and an associated timestamp (datoN_fecha_hora).
dato1
string | null
Custom tracking label slot 1 (up to 500 chars).
dato1_fecha_hora
string (ISO timestamp) | null
Timestamp for dato1.
dato2
string | null
Custom tracking label slot 2.
dato2_fecha_hora
string (ISO timestamp) | null
Timestamp for dato2.
dato3
string | null
Custom tracking label slot 3.
dato3_fecha_hora
string (ISO timestamp) | null
Timestamp for dato3.
dato4
string | null
Custom tracking label slot 4.
dato4_fecha_hora
string (ISO timestamp) | null
Timestamp for dato4.

Document checklist flags

Boolean flags indicating whether each required document has been received. All default to null (not yet confirmed).
doc_orden_admision
boolean | null
Admission work order received.
doc_identificacion
boolean | null
Client government-issued ID received.
doc_tarjeta_circulacion
boolean | null
Vehicle registration card received.
doc_caratula_poliza
boolean | null
Insurance policy cover page received.
doc_carta_reparacion
boolean | null
Repair authorization letter received.
doc_comprobante_deducible
boolean | null
Deductible payment receipt received.
doc_finiquito
boolean | null
Final settlement document received.
doc_encuesta_servicio
boolean | null
Customer satisfaction survey completed.

Nested relations

aseguradora
object | null
The linked insurer record.
historial_estado
array
Audit log of all status transitions for this expediente, ordered newest-first.
evidencia
array
Metadata records for every file attached to this expediente. Does not include binary content — use the Evidencias endpoints to download files.

Example response body

{
  "no_siniestro": "SIN-2024-001",
  "factura": "F-00123",
  "orden": "OT-2024-045",
  "asesor": "María López",
  "fecha_ingreso": "2024-03-15T12:00:00.000Z",
  "fecha_valuacion": "2024-03-18T12:00:00.000Z",
  "fecha_autorizacion": "2024-03-20T12:00:00.000Z",
  "fecha_pzas_completas": null,
  "unidad_terminada": null,
  "tecnico": "Carlos Pérez",
  "mecanico": null,
  "vehiculo": null,
  "observaciones": "Daño lateral derecho severo.",
  "marca": "Toyota",
  "modelo": "Corolla",
  "tipo": "Sedán",
  "color": "Blanco",
  "placas": "ABC-123",
  "nombre_cliente": "Juan García",
  "telefono_cliente": "555-100-2000",
  "correo_cliente": "juan@example.com",
  "dato1": null,
  "dato1_fecha_hora": null,
  "dato2": null,
  "dato2_fecha_hora": null,
  "dato3": null,
  "dato3_fecha_hora": null,
  "dato4": null,
  "dato4_fecha_hora": null,
  "comentarios_aseguradora": null,
  "comentarios_aseguradora_fh": null,
  "doc_orden_admision": true,
  "doc_identificacion": true,
  "doc_tarjeta_circulacion": true,
  "doc_caratula_poliza": false,
  "doc_carta_reparacion": false,
  "doc_comprobante_deducible": null,
  "doc_finiquito": null,
  "doc_encuesta_servicio": null,
  "estado": "Restauracion",
  "ubicacion_almacenamiento": "Local",
  "id_aseguradora": 1,
  "creado_por": 2,
  "aseguradora": { "id": 1, "nombre": "GNP Seguros" },
  "historial_estado": [
    {
      "id": 2,
      "no_siniestro": "SIN-2024-001",
      "estado_anterior": "Ingreso",
      "estado_nuevo": "Restauracion",
      "fecha_cambio": "2024-03-17T09:22:00.000Z",
      "cambiado_por": 2
    },
    {
      "id": 1,
      "no_siniestro": "SIN-2024-001",
      "estado_anterior": null,
      "estado_nuevo": "Ingreso",
      "fecha_cambio": "2024-03-15T14:05:00.000Z",
      "cambiado_por": 2
    }
  ],
  "evidencia": [
    {
      "id": 7,
      "no_siniestro": "SIN-2024-001",
      "tipo": "Fotografía",
      "nombre_archivo": "daño_lateral.jpg",
      "ruta": "uploads/SIN-2024-001/daño_lateral.jpg",
      "fecha_carga": "2024-03-15T14:10:00.000Z",
      "ubicacion_almacenamiento": "Local",
      "subido_por": 2
    }
  ]
}

Error responses

StatusBodyCause
400{ "error": "No. Siniestro requerido" }The :no_siniestro path segment is missing or not a valid string
401{ "error": "Token requerido" }No Authorization header provided
401{ "error": "Token inválido o expirado" }JWT verification failed
404{ "error": "Expediente no encontrado" }No record with that no_siniestro exists
500{ "error": "Error al obtener el expediente" }Database or internal server error

Build docs developers (and LLMs) love