Add an employee’s contracts with constraints
This endpoint allows adding contracts with constraints for an employee, supporting the nature (nature) of each constraint.
PUT /api/v2/businesses/{businessId}/people/{employeeId}/contracts-with-constraints
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": "CST",
"ignoreWithoutOuterId": false,
"contracts": [
{
"from": "2026-06-16",
"regularMinutes": 380,
"weeklyContract": false,
"dailyContract": true,
"countingDays": "WEEKENDS_AND_HOLIDAYS",
"additionalMinutes": 150,
"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",
"constraints": [
{
"id": "constraint.shift_duration_alternatives",
"parameters": {},
"blocks": {
"1": {
"shiftDuration": 630
},
"2": {
"shiftDuration": 1230
}
},
"blocking": false,
"nature": "PERSONAL"
},
{
"id": "constraint.presence_min_total_minutes",
"parameters": {
"min": "240"
},
"blocking": false
}
]
}
]
}
If all data is correct, the contracts will be created for the employee with the characteristics and constraints specified in the request.
Considerations
This endpoint supports the nature field on each constraint, allowing you to explicitly indicate whether it was entered manually (PERSONAL) or comes from a contract type or an import (CONTRACT_TYPE).
If the canceled or blocking fields of a constraint are not sent, both default to false. Therefore, it is recommended to explicitly indicate these fields in each import when a different value needs to be set.
Behavior of the lag field
The lag field acts exclusively as a safety window against the deletion of existing contracts that are not included in the request: an already-finished contract not included in the request is deleted if its end date falls within the lag period; if it ended earlier than that, it is excluded from deletion and remains unchanged in the system.
All contracts included in contracts are always created or updated, regardless of whether their dates fall within the period indicated by lag.
|
If |
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 ( |
Contract '<id>': constraints are required |
The |
|
Constraint '<id>': invalid nature '<nature>'. Allowed values are PERSONAL and CONTRACT_TYPE |
The value of a constraint’s |
|
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 |
|
Contract '<id>': block orderValue keys […] must be positive integers |
The order keys ( |
|
It is recommended to check the response body in case of error, as it includes relevant information for diagnosis and debugging, such as the invalid field or the unrecognized value. |
Useful links
What is a contract? And a contract type?
What is a constraint?