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.

Every employment relationship in La Oficina Nítida is backed by a Contrato record that captures the agreement type, dates, salary, and job title at the moment of signing. Contracts are isolated per tenant, linked to a specific employee, and serve as the anchor for document generation, expediente population, and automated expiration alerts. An employee may accumulate multiple contracts over time — renewals, role changes, and new engagements each produce a new record while the full history is preserved.

Contract Types

La Oficina Nítida supports the five contract modalities recognized by the Colombian labor code:
ValueContract typeKey characteristic
TERMINO_FIJOFixed-termHas a defined fechaFin; eligible for alert tracking
TERMINO_INDEFINIDOIndefinite termNo end date (fechaFin is null)
OBRA_LABORWork-for-hireTied to completion of a specific project or task
APRENDIZAJEApprenticeshipTraining contract under SENA regulations
PRESTACION_SERVICIOSServices contractIndependent-contractor engagement (not an employment relationship under the labor code)

Contract States and Lifecycle

Every contract starts in VIGENTE (active) and transitions through the following states:
TransitionTrigger
VIGENTE → VENCIDOThe contract’s fechaFin has passed without a renewal
VIGENTE → TERMINADOThe contract was explicitly terminated before its end date
VIGENTE → RENOVADOThe contract was renewed and a successor contract was created
VENCIDO → RENOVADOA lapsed contract is retroactively marked as renewed
State transitions are applied through PATCH /contracts/:id/status (requires ADMIN role). The API enforces the allowed transitions listed above; any other state change returns 400 Bad Request.
RENOVADO is currently a terminal state. Automatic creation of a successor contract upon renewal is planned for a future phase. For now, create the new contract manually and then update the original to RENOVADO.

Creating a Contract

POST /contracts
Content-Type: application/json

{
  "employeeId": "e1f2a3b4-...",
  "tipo": "TERMINO_FIJO",
  "fechaInicio": "2024-02-01",
  "fechaFin": "2025-01-31",
  "cargo": "Docente de Secundaria",
  "salario": 2100000,
  "sedeId": "a1b2c3d4-..."
}
Requires ADMIN or OPERADOR role.

CreateContractDto fields

FieldTypeRequiredDescription
employeeIdUUIDThe employee this contract belongs to
tipoContratoTipoOne of the five contract types above
fechaInicioISO date stringContract start date
fechaFinISO date stringContract end date. Omit for TERMINO_INDEFINIDO
cargostringJob title — stored as a snapshot
salarionumberMonthly salary in COP (minimum 0)
sedeIdUUIDBranch this contract is associated with

Historical snapshots

cargo and salario are stored directly on the Contrato record rather than being derived from the employee at query time. This design guarantees that a contract printed or audited months later reflects the terms agreed at signing — even if the employee was later promoted, transferred, or had their salary adjusted. The same immutability principle applies to the variablesSnapshot JSON field, which captures every template variable used during document generation.

Querying Contracts

List all contracts

GET /contracts?estado=VIGENTE&employeeId=e1f2a3b4-...&page=1&limit=20
ContractQueryDto filter parameters:
ParameterTypeDescription
estadoVIGENTE | VENCIDO | TERMINADO | RENOVADOFilter by contract status
employeeIdstringReturn contracts for a specific employee
searchstringFree-text search (matches employee name or document number)
pagenumberPage number (default 1)
limitnumberPage size (default 10, max 100)
Returns a paginated envelope with data and meta (total, page, limit, totalPages).

Contracts for a specific employee

GET /contracts/employees/:id/contracts
Returns all contracts associated with the employee in the authenticated tenant, ordered chronologically. Useful for rendering a full employment history timeline.

Get a single contract

GET /contracts/:id
Returns the full contract record. Returns 404 if the contract does not exist within the authenticated tenant.

Updating Contract Status

PATCH /contracts/:id/status
Content-Type: application/json

{
  "estado": "TERMINADO"
}
Requires ADMIN role. The service validates the transition against the allowed state machine before persisting the change.

Contract Document Generation

Once a contract record exists, you can generate a PDF contract document using a linked document template:
POST /contracts/:id/generate-document
Content-Type: application/json

{
  "templateId": "t9u8v7w6-..."
}
Requires ADMIN or OPERADOR role. The endpoint:
  1. Loads the contract and its associated employee record.
  2. Resolves all template variables (name fields, document number, cargo, salario, dates, sede, etc.) from the contract’s snapshot data.
  3. Renders the DOCX template with the resolved variables.
  4. Converts the result to PDF via the Gotenberg/LibreOffice service.
  5. Stores the PDF and creates a GeneratedDocument record.
  6. Automatically adds an ExpedienteDoc entry under the CONTRATO category in the employee’s digital file.
The response includes the generated document’s id and the URL to the resulting PDF.
Set up contract expiration alerts to stay ahead of upcoming renewals. Use POST /alerts/generate-contract-alerts to scan all active contracts with fechaFin within the next 30 days and create alerts at the 30-day, 15-day, and 7-day thresholds. Schedule this endpoint to run daily via a cron job so your team never misses a renewal window. See the Alerts module for details.

Build docs developers (and LLMs) love