Skip to main content
POST
Assign a course to specific users and/or groups. Assigning a group also assigns its subgroups. The request is all or nothing: if a listed user ID does not resolve to a user, nothing is assigned and the request fails with 400; if a listed user cannot be assigned (the user is blocked or not active, or has a role without permission to take courses), nothing is assigned and the request fails with 422.

Path Parameters

integer
required
The unique identifier of the course

Request Headers

string
required
API Key. Go to your Konstantly site > Settings > API and copy the value from there.

Request Body

At least one of users or groups must contain an ID.
array
Array of user IDs to assign the course to: Konstantly user IDs or your own user IDs (see User IDs). Each must be a positive integer or a non-empty string of at most 41 characters.
array
Array of group IDs to assign the course to
integer
Timestamp of date and time (UTC) when the course should be assigned. A time in the past is treated as now.
integer
Timestamp of date and time (UTC) of the deadline for course completion
object
Assign the course after a period from now instead of at a fixed time. Used when assignAt is not set.
object
Deadline as a period counted from the assignment time. Used when deadlineAt is not set. Same properties as assignPeriod.

Response

array
required
Users the course was assigned to
array
required
Groups the course was assigned to

Error Responses

object
Returned when a user ID does not resolve to a user ("Unknown users: emp-7", with code USER_CANNOT_ASSIGN_UNKNOWN_ENTITY and the IDs in details.users). Nothing is assigned.
object
Returned when the request cannot be processed. Nothing is assigned.