Assign a course
Workforce module
POST/training-courses/{id}/assigntrainingCourses.assign
Assigns a published course to active members with an optional due date. Requires `Idempotency-Key`; a replay returns the original response. A rule that refuses the request returns 422 with `refusal` and `reason`.
- Requires the capability knowledge.sop.publish.
- OAuth scopes: knowledge.
- Send an Idempotency-Key header. A replay with the same key returns the original response.
- Error statuses: 400, 401, 404, 409, 422, 429. Errors are RFC 9457 problem details.
Path and query parameters
| Field | Type | Required | Description |
|---|---|---|---|
| id | string (uuid) | Yes | Identifier of the training course. |
Request body: AssignTrainingRequest
| Field | Type | Required | Description |
|---|---|---|---|
| membership_ids | array of string (uuid) | Yes | Learners. |
| due_on | string (date) | No | Due date. |
| reason | string | No | Why.Constraints: length 0 to 300 |
{
"membership_ids": [
"0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"
],
"due_on": "2026-10-20",
"reason": "New riggers"
}Response 200: AssignTrainingResult
| Field | Type | Required | Description |
|---|---|---|---|
| assigned | integer | Yes | Newly assigned learners.Constraints: range 0 to any |
{
"assigned": 2
}Code samples
curl -X POST "$XOS_BASE_URL/training-courses/0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f/assign" \
-H "Authorization: Bearer $XOS_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{"membership_ids":["0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"],"due_on":"2026-10-20","reason":"New riggers"}'const { data } = await xos.trainingCourses.assign("0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f", {
"membership_ids": [
"0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"
],
"due_on": "2026-10-20",
"reason": "New riggers"
});response = xos.training_courses.assign("0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f", {"membership_ids": ["0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"], "due_on": "2026-10-20", "reason": "New riggers"})xos training-courses assign 0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f --data '{"membership_ids":["0192f1e2-7c3a-7b4d-9e8f-1a2b3c4d5e6f"],"due_on":"2026-10-20","reason":"New riggers"}'