Skip to main content

Endpoint

Generates an Excel file containing employee data formatted for Law Life insurance (Vida Ley) submission. The response is a downloadable Excel file with standardized columns required by the insurance provider.

Request

Headers

{
  "Content-Type": "application/json"
}

Body Parameters

body
array
required
Array of employee objects to include in the Excel file

Response

Returns an Excel file (.xlsx) with the following headers:
ColumnDescriptionFormat
ItemSequential numberNumber
Apellido PaternoFather’s last nameText
Apellido MaternoMother’s last nameText
NombresFirst nameText
SexoGenderM/F
Fecha Nac.Birth dateExcel serial date
Tipo Doc.Document typeAlways “DNI”
Numero Doc.Document numberText
CondiciónEmployee conditionAlways “P” (Permanent)
CargoPositionText
Monedas SueldoCurrencyAlways “SOLES”
SueldoSalaryFormatted currency
Tasa/Nivel RiesgoRisk levelEmpty (to be filled)
Fec. IngresoEntry dateExcel serial date

Response Headers

Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Disposition: attachment; filename=VIDA_LEY_TRAMA_INV_URB_OP.xlsx
Content-Length: [file size in bytes]

Example

curl -X POST https://api.kontrak.com/api/excel/download-lawlife \
  -H "Content-Type: application/json" \
  -d '[
    {
      "name": "Juan",
      "lastNameFather": "Pérez",
      "lastNameMother": "García",
      "dni": "12345678",
      "position": "Operario",
      "salary": 1500,
      "entryDate": "01/03/2024",
      "birthDate": "15/06/1990",
      "sex": "M"
    },
    {
      "name": "María",
      "lastNameFather": "López",
      "lastNameMother": "Martínez",
      "dni": "87654321",
      "position": "Supervisor",
      "salary": 2500,
      "entryDate": "15/02/2024",
      "birthDate": "22/08/1988",
      "sex": "F"
    }
  ]' \
  --output VIDA_LEY_TRAMA_INV_URB_OP.xlsx

Error Responses

Empty Request Body

{
  "success": false,
  "message": "No se recibieron datos. Debes enviar una lista de empleados."
}

Too Many Employees

{
  "success": false,
  "message": "Máximo 80 empleados por lote"
}

Validation Error

{
  "success": false,
  "message": "Validation error",
  "errors": [
    {
      "field": "name",
      "message": "Nombre debe tener al menos 2 letras"
    },
    {
      "field": "dni",
      "message": "DNI debe tener exactamente 8 dígitos numéricos."
    }
  ]
}

Notes

  • The generated file includes a yellow header row for easy identification
  • Dates are converted to Excel serial date format for compatibility
  • Gender values are automatically mapped: “Masculino”/“M” → “M”, “Femenino”/“F” → “F”
  • Salary is formatted with currency symbols (S/.)
  • Document type is always set to “DNI”
  • Currency is always set to “SOLES”
  • Condition is always set to “P” (Permanent)
  • Risk level field is left empty for manual completion
  • Minimum 1 employee required, maximum 50 employees per batch
  • File name is always VIDA_LEY_TRAMA_INV_URB_OP.xlsx

Build docs developers (and LLMs) love