Add contracts by employee
This endpoint allows adding contracts with constraints for an employee.
PUT /api/v2/businesses/{businessId}/employees/{employeeId}/contracts
A detailed explanation of each field that can make up the request body is provided below.
|
Required fields are marked with (*). Accepted values for |
Request body
| JSON analysis |
|---|
Details
|
Request example
Once all fields have been analysed, the following is an example of the request body:
{
"business": "BUSINESSID",
"ignoreWithoutOuterId": false,
"ignoreConstraints": false,
"contracts": [
{
"from": "2026-01-15",
"to": null,
"regularMinutes": 360,
"weeklyContract": false,
"dailyContract": true,
"countingDays": "WEEKENDS_AND_HOLIDAYS",
"additionalMinutes": 120,
"regularControlPeriod": "MONTHLY",
"regularPeriodMultiplier": 1,
"regularPeriodStartDate": "2026-01-15",
"additionalControlPeriod": "MONTHLY",
"additionalPeriodMultiplier": 1,
"additionalPeriodStartDate": "2026-01-15",
"calendarDaysOff": true,
"numberOfHolidays": 10,
"numberOfPublicHolidays": 10,
"weeklyDaysInvolved": "LABOR_DAYS",
"costPerHour": 200.34,
"personCategory": "AV",
"completed": false,
"additionalDailyContract": true,
"additionalWeeklyContract": false,
"regularCountingDayType": "WEEKENDS",
"additionalCountingDayType": "WEEKENDS",
"constraints": [
{
"id": "constraint.sliding_rested_constraint",
"parameters": {
"assigmentIncidence": "false",
"skipHolidayWeekends": "false"
},
"blocks": {
"1": {
"weekendRestFull": "SATURDAY_OR_SUNDAY",
"uniformDistribution": "UNIFORM",
"periodicity": "MONTHLY",
"restDayAsWork": "false",
"maxOccurrences": "0,1",
"interval": "0,1",
"mandatory": "true"
},
"2": {
"weekendRestFull": "SATURDAY_XOR_SUNDAY",
"uniformDistribution": "UNIFORM",
"periodicity": "WEEKLY",
"restDayAsWork": "false",
"maxOccurrences": "0,1",
"interval": "0,1",
"mandatory": "false"
}
},
"blocking": false
},
{
"id": "constraint.max_consecutive_worked_days",
"parameters": {
"min": 1,
"max": 6
},
"blocking": false
}
]
}
]
}
If all data is correct, a contract will be created for the employee with the characteristics and constraints specified in the request.
Considerations
If contractTypeId is sent, all constraints —including those defined manually— are replaced by those from the contract type.
If contractTypeId is not sent, only constraints whose origin is Importer are replaced by those in the request; constraints defined manually are preserved in the system.
|
A contract type and constraints cannot be sent in the same request: if both |
Error codes
In addition to the common errors, this endpoint can return the following codes:
| Code | Message | Description |
|---|---|---|
|
Constraint '<id>' not found in business catalog |
The constraint identifier ( |
[…] cannot specify both contractTypeId and constraints simultaneously. |
Both |
|
Business mismatch: employee belongs to '<business>' but request specifies '<business>' |
The business specified in the request does not match the employee’s actual business. |
|
PersonCategory '<id>' not found in business '<business>' |
The employee category identifier ( |
|
DayType '<id>' not found in business |
The day type sent in |
|
ContractType '<id>' not found in business '<business>' |
The contract type identifier ( |
|
Contract '<id>': block orderValue keys […] must be positive integers |
The order keys ( |
|
It is recommended to review the response body in case of an error, as it includes relevant information for diagnosis and debugging, such as invalid fields or unrecognized values. |
Useful links
What is a contract? And a contract type?
What is a constraint?