curl --request POST \
--url https://api.example.com/api/contracts/preview \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"lastNameFather": "<string>",
"lastNameMother": "<string>",
"birthDate": "<string>",
"sex": "<string>",
"dni": "<string>",
"email": "<string>",
"address": "<string>",
"province": "<string>",
"district": "<string>",
"department": "<string>",
"salary": 123,
"salaryInWords": "<string>",
"position": "<string>",
"entryDate": "<string>",
"endDate": "<string>",
"subDivisionOrParking": "<string>",
"contractType": "<string>",
"replacementFor": "<string>",
"reasonForSubstitution": "<string>",
"timeForCompany": "<string>",
"workingCondition": "<string>",
"probationaryPeriod": "<string>"
}
'{
"Content-Type": "<string>",
"Content-Disposition": "<string>",
"Content-Length": 123,
"Body": {}
}Generate and preview a single employee contract as a PDF file
curl --request POST \
--url https://api.example.com/api/contracts/preview \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"lastNameFather": "<string>",
"lastNameMother": "<string>",
"birthDate": "<string>",
"sex": "<string>",
"dni": "<string>",
"email": "<string>",
"address": "<string>",
"province": "<string>",
"district": "<string>",
"department": "<string>",
"salary": 123,
"salaryInWords": "<string>",
"position": "<string>",
"entryDate": "<string>",
"endDate": "<string>",
"subDivisionOrParking": "<string>",
"contractType": "<string>",
"replacementFor": "<string>",
"reasonForSubstitution": "<string>",
"timeForCompany": "<string>",
"workingCondition": "<string>",
"probationaryPeriod": "<string>"
}
'{
"Content-Type": "<string>",
"Content-Disposition": "<string>",
"Content-Length": 123,
"Body": {}
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/RaulQD/kontrak-backend/llms.txt
Use this file to discover all available pages before exploring further.
DD/MM/YYYYDD/MM/YYYYDD/MM/YYYYPlanilla, Part Time, Subsidioapplication/pdfinline; filename="{dni}-{position}.pdf"The filename is based on the employee’s DNI and position.{
"success": false,
"message": "La solicitud no se pudo procesar",
"errors": [
{
"field": "dni",
"message": "DNI debe tener exactamente 8 dígitos numéricos."
}
]
}
{
"success": false,
"message": "La solicitud no se pudo procesar",
"errors": [
{
"field": "replacementFor",
"message": "El campo 'SUPLENCIA DE' es obligatorio para contratos de Subsidio"
},
{
"field": "reasonForSubstitution",
"message": "El campo 'MOTIVO DE SUPLENCIA' es obligatorio para contratos de Subsidio"
},
{
"field": "timeForCompany",
"message": "El campo Tiempo en empresa es obligatorio"
},
{
"field": "workingCondition",
"message": "La condición laboral es obligatoria"
},
{
"field": "probationaryPeriod",
"message": "El periodo de prueba es obligatorio"
}
]
}
{
"success": false,
"message": "Error interno del servidor"
}
curl -X POST https://api.example.com/api/contracts/preview \
-H "Content-Type: application/json" \
-d '{
"name": "Juan",
"lastNameFather": "García",
"lastNameMother": "López",
"birthDate": "15/06/1990",
"sex": "Masculino",
"dni": "12345678",
"email": "juan.garcia@example.com",
"address": "Av. Principal 123",
"province": "Lima",
"district": "Miraflores",
"department": "Lima",
"salary": 3500,
"salaryInWords": "tres mil quinientos soles",
"position": "Desarrollador",
"entryDate": "01/03/2026",
"endDate": "31/12/2026",
"subDivisionOrParking": "Tecnología",
"contractType": "Planilla"
}' \
--output contract-preview.pdf
curl -X POST https://api.example.com/api/contracts/preview \
-H "Content-Type: application/json" \
-d '{
"name": "María",
"lastNameFather": "Pérez",
"lastNameMother": "Silva",
"birthDate": "20/03/1992",
"sex": "Femenino",
"dni": "87654321",
"email": "maria.perez@example.com",
"address": "Calle Los Olivos 456",
"province": "Lima",
"district": "San Isidro",
"department": "Lima",
"salary": 2500,
"salaryInWords": "dos mil quinientos soles",
"position": "Asistente",
"entryDate": "15/03/2026",
"endDate": "15/09/2026",
"subDivisionOrParking": "Administración",
"contractType": "Part Time"
}' \
--output contract-preview.pdf
curl -X POST https://api.example.com/api/contracts/preview \
-H "Content-Type: application/json" \
-d '{
"name": "Carlos",
"lastNameFather": "Rodríguez",
"lastNameMother": "Torres",
"birthDate": "10/08/1988",
"sex": "Masculino",
"dni": "45678912",
"email": "carlos.rodriguez@example.com",
"address": "Jr. Las Flores 789",
"province": "Lima",
"district": "Surco",
"department": "Lima",
"salary": 4000,
"salaryInWords": "cuatro mil soles",
"position": "Analista Senior",
"entryDate": "01/04/2026",
"endDate": "30/06/2026",
"subDivisionOrParking": "Finanzas",
"contractType": "Subsidio",
"replacementFor": "Ana Martínez",
"reasonForSubstitution": "Licencia por maternidad",
"timeForCompany": "3 meses",
"workingCondition": "Tiempo completo",
"probationaryPeriod": "30 días"
}' \
--output contract-preview.pdf
<iframe
src="https://api.example.com/api/contracts/preview"
width="100%"
height="600px"
style="border: none;">
</iframe>
const previewContract = async (employeeData) => {
try {
const response = await fetch('https://api.example.com/api/contracts/preview', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(employeeData)
});
if (!response.ok) {
const error = await response.json();
console.error('Validation errors:', error.errors);
return;
}
// Get the PDF as a blob
const blob = await response.blob();
// Create a URL for the blob
const url = window.URL.createObjectURL(blob);
// Open in new window or display in iframe
window.open(url, '_blank');
// Or trigger download
const a = document.createElement('a');
a.href = url;
a.download = 'contract-preview.pdf';
a.click();
} catch (error) {
console.error('Error previewing contract:', error);
}
};
// Usage
const employee = {
name: "Juan",
lastNameFather: "García",
lastNameMother: "López",
birthDate: "15/06/1990",
sex: "Masculino",
dni: "12345678",
email: "juan.garcia@example.com",
address: "Av. Principal 123",
province: "Lima",
district: "Miraflores",
department: "Lima",
salary: 3500,
salaryInWords: "tres mil quinientos soles",
position: "Desarrollador",
entryDate: "01/03/2026",
endDate: "31/12/2026",
subDivisionOrParking: "Tecnología",
contractType: "Planilla"
};
previewContract(employee);
Content-Disposition header is set to inline to allow browser preview{dni}-{position}.pdfDD/MM/YYYY formatreplacementFor - Name of person being replacedreasonForSubstitution - Reason for the substitutiontimeForCompany - Duration with the companyworkingCondition - Working conditionsprobationaryPeriod - Probationary period duration