Assign a course
This endpoint allows assigning a course to several employees of a service, with the same dates for all of them.
POST /api/v2/businesses/{businessId}/services/{serviceId}/courses/{courseId}/assignments/bulk
Below is a detailed explanation of each of the fields that can make up the request body, with some being mandatory for the request to be successful.
|
All the fields of this request are mandatory. |
Request body
| JSON Analysis |
|---|
Details
|
Request example
Once the analysis of the different fields has been done, an example of the request is shown:
POST /api/v2/businesses/BUSINESSID/services/SERVICEID/courses/COURSEID/assignments/bulk
{
"employeeIds": [
"000001",
"000002"
],
"trainingDates": [
{
"trainingId": "TRN-ID",
"date": "2026-10-19"
}
]
}
If the request is correct, the response will be a 201 Created with one course assignment per employee.
Considerations
It is not necessary to provide the date of every training of the course. Trainings not included in trainingDates are calculated from the day defined for them in the course, using the earliest date given as reference.
The given dates must respect the order of the course trainings.
Trainings are created with the PENDING status.
|
The request is not idempotent: if it is repeated, duplicate assignments are created for the same employees. |
Error codes
In addition to the common errors, this endpoint can return the following codes:
| Code | Message | Description |
|---|---|---|
|
Course not found: <courseId> |
The given |
Training not found in course: <trainingId> |
One of the trainings in |
|
Person not found in service |
One of the employees does not have a contract or an association with the service during the whole course period. |
|
|
At least one training date is required |
The |
Training dates must respect the training order |
The given dates do not respect the order of the course trainings. |
Useful links
What is a course assignment?
What is a course?