Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Glemynart/SaaS/llms.txt

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

An ExpedienteDoc record represents a single file stored in a tenant’s Cloudflare R2 bucket as part of an employee’s digital dossier (expediente digital). Documents can originate from the automated PDF generation pipeline — in which case the generatedDocumentId field links back to the source GeneratedDocument — or they can be uploaded manually through future upload endpoints. Every record tracks the storage key, MIME type, file size in bytes, and a version counter that increments when a new version of the same document is uploaded. The ExpedienteDocsService also computes per-category statistics that give a quick overview of the completeness of an employee’s file. All endpoints require a valid JWT.
Authorization: Bearer {accessToken}

List expediente docs for an employee

GET /employees/:id/expediente
Roles: ADMIN, OPERADOR, VIEWER
Returns all ExpedienteDoc records belonging to the specified employee, ordered by createdAt descending, together with a category statistics summary.
id
string (UUID)
required
Employee identifier. Returns 404 Not Found if the employee does not exist within the authenticated tenant.
docs
ExpedienteDoc[]
Full list of document records for the employee. Each item includes a nested generatedDocument object ({ id, nombre, tipo }) when the document was produced by the generation pipeline, or null for manually uploaded files.
docs[*].id
string (UUID)
Document record identifier.
docs[*].empleadoId
string (UUID)
Owning employee identifier.
docs[*].categoria
string
Document category (see Category reference below).
docs[*].nombre
string
Original file name or display name.
docs[*].storageKey
string
R2 object key (see Storage key convention).
docs[*].mimeType
string
MIME type of the stored file, e.g. "application/pdf" or "image/jpeg".
docs[*].tamanoBytes
number
File size in bytes.
docs[*].version
number
Version counter. Starts at 1 and increments each time a replacement file is uploaded for the same logical document.
docs[*].generatedDocumentId
string (UUID) | null
Reference to the GeneratedDocument that produced this file, or null for manual uploads.
docs[*].contratoId
string (UUID) | null
Reference to the associated Contrato, if applicable.
docs[*].descripcion
string | null
Optional human-readable description.
docs[*].fechaDocumento
string (ISO 8601) | null
Date of the document itself (e.g. the effective date of a certificate).
docs[*].fechaVencimiento
string (ISO 8601) | null
Document expiry date. Used by the alert scheduler.
docs[*].requiereRenovacion
boolean | null
Whether this document must be renewed before its expiry date.
docs[*].subidoPorNombre
string | null
Snapshot of the display name of the user who uploaded the file. Preserved even if the user account is later deleted.
docs[*].createdAt
string (ISO 8601)
Upload timestamp.
stats.total
number
Total number of documents in the expediente.
stats.byCategory
object
Map of ExpedienteCategoria value → document count. Only categories with at least one document are included (e.g. { "CONTRATO": 3, "CERTIFICADO": 1 }).
stats.ultimoDocumento
string (ISO 8601) | null
createdAt timestamp of the most recently added document, or null if the expediente is empty.
curl https://api.oficinaclear.com/employees/a1b2c3d4-0000-0000-0000-000000000001/expediente \
  -H "Authorization: Bearer $TOKEN"

Get expediente doc

GET /expediente-docs/:id
Roles: ADMIN, OPERADOR, VIEWER
Returns a single ExpedienteDoc record with both employee and generated-document relations expanded.
id
string (UUID)
required
Expediente document identifier.
id
string (UUID)
Document record identifier.
empleadoId
string (UUID)
Owning employee identifier.
categoria
string
Document category enum value.
nombre
string
File display name.
storageKey
string
R2 object key.
mimeType
string
MIME type.
tamanoBytes
number
File size in bytes.
version
number
Version counter.
generatedDocumentId
string (UUID) | null
Source generated document, or null.
contratoId
string (UUID) | null
Associated contract, or null.
empleado
object
Inline employee snapshot: { id, primerNombre, segundoNombre, primerApellido, segundoApellido }.
generatedDocument
object | null
Inline generated document snapshot: { id, nombre, tipo }, or null.
createdAt
string (ISO 8601)
Upload timestamp.
curl https://api.oficinaclear.com/expediente-docs/e5f6g7h8-0000-0000-0000-000000000005 \
  -H "Authorization: Bearer $TOKEN"

Delete expediente doc

DELETE /expediente-docs/:id
Roles: ADMIN
Permanently removes the ExpedienteDoc record from the database. The corresponding R2 object is not deleted automatically in this API version; object lifecycle management must be handled separately.
id
string (UUID)
required
Expediente document identifier.
id
string (UUID)
Identifier of the deleted record.
curl -X DELETE https://api.oficinaclear.com/expediente-docs/e5f6g7h8-0000-0000-0000-000000000005 \
  -H "Authorization: Bearer $TOKEN"

Category reference

CategoryDescription
CONTRATOEmployment contracts and addenda. PDFs generated through the document pipeline are automatically placed in this category when the source template type is CONTRACT.
AFILIACIONSocial security and benefit affiliation forms (EPS, ARL, pension fund, caja de compensación).
CERTIFICADOLabour certificates, educational certificates, or any other official certification. PDFs from CERTIFICATION-type templates land here.
DOCUMENTO_PERSONALIdentity documents, passports, and other personal identity records.
PREAVISOPre-notice letters issued before contract termination.
TERMINACIONTermination agreements, settlement documents (actas de liquidación), and related records.
OTROAny document that does not fit the above categories. LETTER and MEMO template types resolve to this category.

Storage key convention

Every storageKey value follows this pattern:
{tenantId}/expediente/{empleadoId}/{categoria}/{id}_v{version}.{ext}
Example:
f3a2b1c0-0000-0000-0000-000000000010/expediente/a1b2c3d4-0000-0000-0000-000000000001/CONTRATO/e5f6g7h8-0000-0000-0000-000000000005_v1.pdf
Documents created automatically by the PDF generation pipeline use the pattern:
{tenantId}/expediente/{empleadoId}/{categoria}/gen_{generatedDocumentId}_v1.pdf
When POST /generated-documents/:id/generate-pdf completes successfully, the platform automatically creates an ExpedienteDoc record in the CONTRATO category (for CONTRACT-type templates) or CERTIFICADO (for CERTIFICATION-type templates). LETTER and MEMO types resolve to OTRO. No manual upload step is required.

Build docs developers (and LLMs) love