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.

Create a new insurance claim record in Monitor API. The siniestro number (no_siniestro) is the primary key — it must be unique across all records. On success the API automatically sets estado to Ingreso and writes the first historial_estado audit entry. Técnico users do not have write access and will receive 403.

Endpoint

POST /api/expedientes
Authentication: Bearer token required. Role: Administrador or Operador only.

Request body

no_siniestro
string
required
Unique claim identifier that becomes the primary key (e.g. "SIN-2024-001"). Leading and trailing whitespace is trimmed automatically. Returns 400 if blank, 409 if already taken.

Vehicle fields

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

Client fields

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

Administrative fields

factura
string
Invoice number for the repair.
orden
string
Internal work-order reference.
asesor
string
Service advisor’s name.
tecnico
string
Body technician assigned to this unit.
mecanico
string
Mechanic assigned to this unit.
observaciones
string
General notes or observations about the repair.
id_aseguradora
integer
Foreign key referencing the aseguradora table. Use GET /api/expedientes/aseguradoras to look up valid IDs.

Date fields

All date fields accept "YYYY-MM-DD" strings. The API parses them at 12:00:00 local time to prevent UTC day-shift issues.
fecha_ingreso
string
Date the vehicle entered the shop. Format: "YYYY-MM-DD".
fecha_valuacion
string
Date the damage estimate was completed. Format: "YYYY-MM-DD".
fecha_autorizacion
string
Date the insurer authorized the repair. Format: "YYYY-MM-DD".
fecha_pzas_completas
string
Date all replacement parts arrived. Format: "YYYY-MM-DD".
unidad_terminada
string
Date the vehicle repair was finished. Format: "YYYY-MM-DD".

Insurer-communication fields

comentarios_aseguradora
string
Free-text notes exchanged with the insurer.
comentarios_aseguradora_fh
string
ISO 8601 timestamp of the latest insurer comment. Example: "2024-03-20T10:30:00.000Z".

Custom dato fields

Four generic slot pairs for shop-specific milestones or tracking values. Each pair has a text label (up to 500 chars) and an ISO timestamp.
dato1
string
Custom tracking label slot 1.
dato1_fecha_hora
string
ISO 8601 timestamp for dato1.
dato2
string
Custom tracking label slot 2.
dato2_fecha_hora
string
ISO 8601 timestamp for dato2.
dato3
string
Custom tracking label slot 3.
dato3_fecha_hora
string
ISO 8601 timestamp for dato3.
dato4
string
Custom tracking label slot 4.
dato4_fecha_hora
string
ISO 8601 timestamp for dato4.

Document checklist flags

Boolean flags indicating whether each required document has been handed in. Omit a field to leave it as null (not yet confirmed).
doc_orden_admision
boolean
Admission work order received.
doc_identificacion
boolean
Client government-issued ID received.
doc_tarjeta_circulacion
boolean
Vehicle registration card received.
doc_caratula_poliza
boolean
Insurance policy cover page received.
doc_carta_reparacion
boolean
Repair authorization letter received.
doc_comprobante_deducible
boolean
Deductible payment receipt received.
doc_finiquito
boolean
Final settlement document received.
doc_encuesta_servicio
boolean
Customer satisfaction survey completed.
The estado field is not accepted in the request body. It is always hardcoded to Ingreso by the service layer. Status transitions are managed by a dedicated workflow module and cannot be set through this endpoint.
creado_por is not a client-provided field. It is set automatically from the authenticated user’s JWT id claim.

Request example

curl -X POST http://localhost:3000/api/expedientes \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "no_siniestro": "SIN-2024-001",
    "marca": "Toyota",
    "modelo": "Corolla",
    "color": "Blanco",
    "placas": "ABC-123",
    "nombre_cliente": "Juan García",
    "id_aseguradora": 1
  }'

Response — 201 Created

Returns the full expediente object as persisted. All fields are included (same schema as GET /api/expedientes/:no_siniestro without nested relations).
no_siniestro
string
The trimmed siniestro number echoed back.
estado
string
Always "Ingreso" for a newly created record.
creado_por
integer | null
Set automatically from the authenticated user’s JWT id claim.
All other fields follow the same schema as the GET /:no_siniestro response. Refer to the single-record endpoint for the complete field list.

Example response body

{
  "no_siniestro": "SIN-2024-001",
  "factura": null,
  "orden": null,
  "asesor": null,
  "fecha_ingreso": null,
  "fecha_valuacion": null,
  "fecha_autorizacion": null,
  "fecha_pzas_completas": null,
  "unidad_terminada": null,
  "tecnico": null,
  "mecanico": null,
  "vehiculo": null,
  "observaciones": null,
  "marca": "Toyota",
  "modelo": "Corolla",
  "tipo": null,
  "color": "Blanco",
  "placas": "ABC-123",
  "nombre_cliente": "Juan García",
  "telefono_cliente": null,
  "correo_cliente": null,
  "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": null,
  "doc_identificacion": null,
  "doc_tarjeta_circulacion": null,
  "doc_caratula_poliza": null,
  "doc_carta_reparacion": null,
  "doc_comprobante_deducible": null,
  "doc_finiquito": null,
  "doc_encuesta_servicio": null,
  "estado": "Ingreso",
  "ubicacion_almacenamiento": "Local",
  "id_aseguradora": 1,
  "creado_por": 2
}

Error responses

StatusBodyCause
400{ "error": "El No. Siniestro es obligatorio" }no_siniestro is missing or blank in the request body
401{ "error": "Token requerido" }No Authorization header provided
401{ "error": "Token inválido o expirado" }JWT verification failed
403{ "error": "Acceso restringido a administradores y operadores" }Authenticated user has Técnico role
409{ "error": "Ya existe un expediente con ese No. Siniestro" }A record with that no_siniestro already exists
500{ "error": "Error interno al crear expediente" }Database or internal server error

Build docs developers (and LLMs) love