An expediente (academic dossier) is the central record for a faculty member (docente). It combines the docente’s personal and institutional profile with the full collection of uploaded documents — scanned certificates, ID copies, degree titles, appointment resolutions, and more. Every document is linked to the dossier via the docente’s Venezuelan ID number (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/gcapella0/agente-inteligente-expedientes/llms.txt
Use this file to discover all available pages before exploring further.
cedula).
GET /docentes
List all docentes with pagination. Supports both classic skip/limit pagination and opaque cursor-based pagination for stable iteration over large collections.Query Parameters
Number of records to skip. Must be
>= 0.Maximum number of records to return per page. Range:
1–100.Opaque base64-encoded cursor returned by a previous response as
cursor_siguiente. When provided, the query fetches the page after this cursor position, ignoring skip.Response
Array of docente objects. Each
_id is serialized as a string.Total number of docentes in the collection (unfiltered).
Cursor to pass as
?cursor= in the next request. null when there are no more pages.true when additional pages exist beyond the current result.No authentication is required for this endpoint.
GET /docentes/buscar
Advanced search with text filters, field-level filters, sorting, and cursor-based pagination.Query Parameters
Text search against
docente.apellidos, docente.nombres, and docente.cedula (case-insensitive regex).Filter by
vinculacion_institucional.departamento (exact match).Filter by
vinculacion_institucional.sede (exact match).Filter by dossier status. Accepted values:
activo, inactivo, en_revision, completo, incompleto.Sort field. Prefix with
- for descending order. Supported values: apellidos, cedula, completitud, -updated_at.Records to skip.
Records per page (max 100).
Opaque cursor for stable next-page iteration.
Response
Same structure asGET /docentes with the addition of total_pages:
Computed as
ceil(total / limit). Based on the total matching the applied filters, not the cursor position.GET /expediente/
Retrieve a complete dossier — the docente profile plus all associated documents.Path Parameters
Venezuelan ID number (digits only), e.g.
12345678.Response
Full docente record as stored in MongoDB.
_id is a string.All documents belonging to this dossier. Each
_id is a string.Count of documents in the response array.
| Status | Detail |
|---|---|
404 | "Docente no encontrado" |
500 | "Error de base de datos" |
GET /expediente//documentos
List documents within a dossier with optional type, validation-state, and ordering filters.Path Parameters
Venezuelan ID number.
Query Parameters
Filter by
TipoDocumento value (e.g. cedula_identidad, titulo_universitario). See the full type list.Filter by validation state:
pendiente, aprobado, rechazado, or requiere_revision.When
false (default), the ocr.texto_completo field is stripped from each document to reduce payload size.Sort order. Use
created_at (oldest first) or -updated_at (most recently modified first).Records to skip.
Records per page (max 100).
Response
List of the 10 required document types that are not yet present in this dossier. An empty array means the dossier is complete.
GET /expediente//resumen
Return a completeness summary for the dossier in either JSON or plain-text format.Path Parameters
Venezuelan ID number.
Query Parameters
Response format:
json (default) or texto (plain text report).JSON Response
Percentage of the 10 required documents that are present. Sourced from
completitud.porcentaje on the docente record.Always
10 — the fixed list of required document types checked by the system.Text Response
Whenformato=texto, the endpoint returns a plain-text report suitable for logging or display:
GET /expediente//documento//archivo
Serve the physical file (PDF, JPG, or PNG) stored indata/storage/. Supports both inline rendering (e.g. <iframe>, <img>) and forced download.
Path Parameters
Venezuelan ID number of the owning docente.
MongoDB ObjectId of the document.
Query Parameters
JWT authentication token. Accepted as a query parameter so the URL can be embedded in
<img src> or <iframe src> attributes without a custom Authorization header.When
true, sets Content-Disposition: attachment to trigger a browser download. Default false renders the file inline.Authentication
Pass a valid JWT via the?token=<jwt> query parameter. This endpoint uses verify_token_sse, which reads the token exclusively from the query string — not from the Authorization header. This design enables the URL to be embedded directly in HTML <img src> or <iframe src> attributes where custom request headers are not available.
Response
Returns the raw file with appropriate media type:| Format | Content-Type |
|---|---|
pdf | application/pdf |
jpg / jpeg | image/jpeg |
png | image/png |
| Status | Detail |
|---|---|
401 | Missing or invalid ?token= JWT |
403 | "Ruta fuera del almacenamiento permitido" — path traversal attempt blocked |
404 | Document or physical file not found |
422 | Invalid documento_id format |
GET /expedientes/buscar-texto
Full-text search across the OCR content of all documents, scored by relevance.No authentication is required for this endpoint.
This endpoint uses MongoDB’s
$text index with $meta: "textScore" relevance scoring. Only documents whose OCR has been processed will appear in results.Query Parameters
Search query. Minimum 2 characters. Searches the indexed OCR text of all documents.
Optional filter to restrict results to a specific
TipoDocumento value.Comma-separated list of field names from
ocr.campos_extraidos to include in each result (e.g. nombre_completo,fecha_nacimiento).Records to skip.
Records per page (max 100).
Response
MongoDB text-search relevance score. Higher values indicate stronger matches.
Full name of the owning docente, enriched from the
docentes collection.Server-side elapsed time in milliseconds for the search operation.
POST /expedientes//chat
Ask an AI question about a specific dossier. The LLM receives a structured context built from the docente’s profile, institutional link, completeness metrics, and OCR-extracted document data.Authentication is required. The model and provider are configured server-side (OpenRouter or Ollama).
Path Parameters
Venezuelan ID number of the docente to query.
Request Body
The question to ask. Minimum 1 character, maximum 500 characters.
Response
Always
true on a successful response.The LLM-generated answer in Spanish.
Name of the LLM model that generated the response (e.g.
mistralai/mistral-7b-instruct).Round-trip inference time in milliseconds.
| Status | Detail |
|---|---|
401 | Missing or invalid bearer token |
404 | "Docente con cédula {cedula} no encontrado" |
503 | "Servicio LLM no disponible" or "El modelo LLM no respondió" |
PUT /expedientes/
Update dossier fields. JWT (admin) required. Updatable fields:nombres, apellidos, email_personal, email_institucional, telefono_principal, telefono_secundario, direccion_completa, departamento, sede, estado_civil, nacionalidad.
Request Body
auditoria collection.
Response
| Status | Detail |
|---|---|
400 | "No hay datos para actualizar" — all body fields were null |
401 | Missing or invalid JWT |
403 | Authenticated user does not have the admin role |
404 | Docente not found |
DELETE /expedientes/
Permanently delete a dossier and all its associated documents. JWT (admin) required. This action is irreversible and is recorded in theauditoria collection.
Response
Number of document records removed from the
documentos collection.| Status | Detail |
|---|---|
401 | Missing or invalid JWT |
403 | Authenticated user does not have the admin role |
404 | Docente not found |