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
{
  "employeeIds": [
    "string"
  ],
  "trainingDates": [
    {
      "trainingId": "string",
      "date": "string"
    }
  ]
}
Details
  • employeeIds*: list of external identifiers of the employees the course is assigned to. It cannot contain repeated employees.

  • trainingDates*: dates of the course trainings. It must contain at least one training. For each training, the following information is included:

    • trainingId*: external identifier of the training. It must belong to the course and cannot be repeated.

    • date*: date on which the training takes place, in yyyy-MM-dd format.

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

404 Not Found

Course not found: <courseId>

The given courseId does not exist in the business.

Training not found in course: <trainingId>

One of the trainings in trainingDates does not belong to the course.

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.

400 Bad Request

At least one training date is required

The trainingDates field was not provided or is empty.

Training dates must respect the training order

The given dates do not respect the order of the course trainings.

What is a course assignment?

What is a course?