Evidence files — photographs of vehicle damage, repair documents, insurance policies, and more — are attached to an expediente by itsDocumentation 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.
no_siniestro. Monitor API accepts them as multipart form uploads and stores them on the server filesystem, organised into per-claim folders. A corresponding record is written to the evidencia table in PostgreSQL so every file can be audited, listed, and deleted through the API.
File storage structure
Uploaded files land under a configurable base directory (see the environment variable note below). Within that base, the layout is:<unix_timestamp_ms>_<original_filename> (spaces in the original name are replaced with underscores). The timestamp prefix ensures filenames are unique even when the same file is uploaded more than once.
The base directory itself is resolved at startup from path.join(__dirname, '..', '..', 'evidencias') in the routes file — that is, two directory levels above src/routes/, which places it at the repository root alongside the src/ folder. You can override this path with the EVIDENCIAS_DIR environment variable.
Upload limits
The maximum file size is 50 MB per upload, enforced by the multer middleware. Attempts to exceed this limit will be rejected with a413 Payload Too Large response before the file is written to disk.
Uploading a file
POST /api/expedientes/:no_siniestro/evidencias
Send the file as multipart/form-data with the field name archivo. An optional query parameter ?tipo=documento routes the file to the DOCUMENTOS REPARACION subfolder; omitting it routes the file to the evidencias/ subfolder.
Requires the Administrador or Operador role.
Success response — 201 Created:
| Field | Description |
|---|---|
id | Auto-incremented primary key of the evidence record. |
no_siniestro | The claim this file belongs to. |
tipo | MIME type detected from the uploaded file (e.g. image/jpeg, application/pdf). |
nombre_archivo | The original filename as sent by the client. |
ruta | Absolute path on the server where the file was written. |
fecha_carga | UTC timestamp of when the record was created. |
subido_por | ID of the authenticated user who performed the upload. |
404 if the no_siniestro does not match any existing expediente.
Listing evidence
GET /api/expedientes/:no_siniestro/evidencias
Returns an array of all evidence records for the claim, ordered by fecha_carga descending (most recent first). Accessible by all authenticated roles (Administrador, Operador, and Técnico).
Deleting a single file
DELETE /api/expedientes/:no_siniestro/evidencias/:id
Deletes the database record and the physical file from disk. Requires the Administrador role.
404 if no evidence record with the given id exists.
Deleting the entire evidence folder
DELETE /api/expedientes/:no_siniestro/evidencias
Recursively removes the entire evidencias/<no_siniestro>/ directory from disk. This is intended for rollback scenarios — for example, when a new expediente creation is cancelled and the partially uploaded files need to be cleaned up. Requires the Administrador or Operador role.