Update the training status of a course

This endpoint allows updating the date and status of the trainings of a course assignment.

PATCH /api/v2/businesses/{businessId}/services/{serviceId}/employees/{employeeId}/course-assignments/{courseAssignmentId}/trainings

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 fields are mandatory.

Request body

JSON Analysis
{
  "updates": [
    {
      "trainingId": "string",
      "date": "string",
      "status": "string"
    }
  ]
}
Details
  • updates*: list with all the trainings of the assignment. For each training, the following information is included:

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

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

    • status*: status of the training. The possible values are PENDING, ATTENDED, NOT_ATTENDED, PASSED and FAILED.

Request example

Once the analysis of the different fields has been done, an example of the request is shown:

PATCH /api/v2/businesses/BUSINESSID/services/SERVICEID/employees/EMPLOYEEID/course-assignments/COURSEASSIGNMENTID/trainings
{
  "updates": [
    {
      "trainingId": "TRN-CAJ-NOR",
      "date": "2026-10-19",
      "status": "ATTENDED"
    },
    {
      "trainingId": "TRN-CAJ-TPV",
      "date": "2026-10-19",
      "status": "ATTENDED"
    },
    {
      "trainingId": "TRN-CAJ-ARQ",
      "date": "2026-10-21",
      "status": "PENDING"
    }
  ]
}

If the request is correct, the response will be a 200 OK with the updated course information.

Considerations

The request must include all the trainings of the assignment, even if only some of them are to be modified. Trainings are identified by their trainingId within the course of the assignment.

The dates must respect the order of the course trainings. The start date of the assignment becomes the date of its first training.

Trainings with a future date must have the PENDING status.

Trainings dated more than 3 months ago cannot be modified, and no training can be moved to a date before that limit.

Approval

When the trainings are updated, the course approval is always revoked: approved becomes false, even if no data has changed. To pass the course again, use this request.

If a new result is recorded in any training (a status other than PENDING that it did not have before), the employee must have passed, and have in force, the required courses of the course.

Error codes

In addition to the common errors, this endpoint can return the following codes:

Code Message Description

404 Not Found

Course assignment not found: <courseAssignmentId>

The given courseAssignmentId does not exist or does not belong to the employee.

Course not found for assignment: <courseId>

The course of the assignment no longer exists.

Training not found in the assignment course: <trainingId>

One of the given trainings does not belong to the course of the assignment.

400 Bad Request

Invalid training status: <status>

The status field was not provided or does not have a valid value.

trainingDates must contain exactly the course trainings

The request does not include all the trainings of the assignment.

Training dates must respect the training order

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

Cannot edit training with date <date>: it is more than 3 months in the past

One of the trainings of the assignment is dated more than 3 months ago.

Cannot set training date to <date>

One of the given dates is more than 3 months ago.

Future training <trainingId> must have status PENDING

A training with a future date has a status other than PENDING.

error.course_requirements_not_fulfilled

The employee has not passed, or does not have in force, all the required courses. The message includes the names of the pending courses.

What is a course?

What is a course assignment?