Skip to content
Proud to collaborate with Microsoft for Startups

canvas.courses.list-users-in-course-users ​

Returns the paginated list of users in this course. And optionally the user's enrollments in the course.

List users in course

Overview ​

PropertyValue
Workflow typeAtomic
LibraryApp-canvas
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
base_urlstringYes—Canvas API root, e.g. https://<host>/api
api_tokenstringNo—Bearer token; omit to use the workflow's token env var
course_idstringYes—ID
search_termstringNo—The partial name or full ID of the users to match and return in the results list.
sortstringNo—When set, sort the results of the search based on the given field.
enrollment_typelistNo—When set, only return users where the user is enrolled as this type. "student_view" implies include[]=test_student. This argument is ignored if enrollment_role is given.
enrollment_rolestringNo—Deprecated When set, only return users enrolled with the specified course-level role. This can be a role created with the {api:RoleOverridesController#add_role Add Role API} or a base role type of 'StudentEnrollment', 'TeacherEnrollment', 'TaEnrollment', 'ObserverEnrollment', or 'DesignerEnrollment'.
enrollment_role_idintegerNo—When set, only return courses where the user is enrolled with the specified course-level role. This can be a role created with the {api:RoleOverridesController#add_role Add Role API} or a built_in role id with type 'StudentEnrollment', 'TeacherEnrollment', 'TaEnrollment', 'ObserverEnrollment', or 'DesignerEnrollment'.
section_idslistNo—When set, only return users who are enrolled in the given section(s).
includelistNo—- "enrollments": Optionally include with each Course the user's current and invited enrollments. If the user is enrolled as a student, and the account has permission to manage or view all grades, each enrollment will include a 'grades' key with 'current_score', 'final_score', 'current_grade' and 'final_grade' values. - "locked": Optionally include whether an enrollment is locked. - "avatar_url": Optionally include avatar_url. - "bio": Optionally include each user's bio. - "test_student": Optionally include the course's Test Student, if present. Default is to not include Test Student. - "custom_links": Optionally include plugin-supplied custom links for each student, such as analytics information - "current_grading_period_scores": if enrollments is included as well as this directive, the scores returned in the enrollment will be for the current grading period if there is one. A 'grading_period_id' value will also be included with the scores. if grading_period_id is nil there is no current grading period and the score is a total score. - "uuid": Optionally include the users uuid
user_idstringNo—If this parameter is given and it corresponds to a user in the course, the +page+ parameter will be ignored and the page containing the specified user will be returned instead.
user_idslistNo—If included, the course users set will only include users with IDs specified by the param. Note: this will not work in conjunction with the "user_id" argument but multiple user_ids can be included.
enrollment_statelistNo—When set, only return users where the enrollment workflow state is of one of the given types. "active" and "invited" enrollments are returned by default.

Output Schema ​

FieldTypeRequiredDefaultDescription
base_urlstringYes—Canvas API root, e.g. https://<host>/api
api_tokenstringNo—Bearer token; omit to use the workflow's token env var
course_idstringYes—ID
search_termstringNo—The partial name or full ID of the users to match and return in the results list.
sortstringNo—When set, sort the results of the search based on the given field.
enrollment_typelistNo—When set, only return users where the user is enrolled as this type. "student_view" implies include[]=test_student. This argument is ignored if enrollment_role is given.
enrollment_rolestringNo—Deprecated When set, only return users enrolled with the specified course-level role. This can be a role created with the {api:RoleOverridesController#add_role Add Role API} or a base role type of 'StudentEnrollment', 'TeacherEnrollment', 'TaEnrollment', 'ObserverEnrollment', or 'DesignerEnrollment'.
enrollment_role_idintegerNo—When set, only return courses where the user is enrolled with the specified course-level role. This can be a role created with the {api:RoleOverridesController#add_role Add Role API} or a built_in role id with type 'StudentEnrollment', 'TeacherEnrollment', 'TaEnrollment', 'ObserverEnrollment', or 'DesignerEnrollment'.
section_idslistNo—When set, only return users who are enrolled in the given section(s).
includelistNo—- "enrollments": Optionally include with each Course the user's current and invited enrollments. If the user is enrolled as a student, and the account has permission to manage or view all grades, each enrollment will include a 'grades' key with 'current_score', 'final_score', 'current_grade' and 'final_grade' values. - "locked": Optionally include whether an enrollment is locked. - "avatar_url": Optionally include avatar_url. - "bio": Optionally include each user's bio. - "test_student": Optionally include the course's Test Student, if present. Default is to not include Test Student. - "custom_links": Optionally include plugin-supplied custom links for each student, such as analytics information - "current_grading_period_scores": if enrollments is included as well as this directive, the scores returned in the enrollment will be for the current grading period if there is one. A 'grading_period_id' value will also be included with the scores. if grading_period_id is nil there is no current grading period and the score is a total score. - "uuid": Optionally include the users uuid
user_idstringNo—If this parameter is given and it corresponds to a user in the course, the +page+ parameter will be ignored and the page containing the specified user will be returned instead.
user_idslistNo—If included, the course users set will only include users with IDs specified by the param. Note: this will not work in conjunction with the "user_id" argument but multiple user_ids can be included.
enrollment_statelistNo—When set, only return users where the enrollment workflow state is of one of the given types. "active" and "invited" enrollments are returned by default.
status_codeintegerNo—HTTP status code of the completed call
responsejsonNo—Parsed JSON response body
failure_reasonstringNo——
failure_typestringNo——
failed_atstringNo——
failed_stepstringNo——
failed_layerstringNo——
failed_at_statestringNo——
errorstringNo——
error_typestringNo——

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—executeWaiting to call GET /v1/courses/{course_id}/users
completedNoYesYes—HTTP call succeeded
failedNoYesNo—HTTP call failed

State Diagram ​

Transitions ​

FromActionToDescription
pendingexecutecompletedPerform GET /v1/courses/{course_id}/users
* (any state)failfailedRecord the failure reason

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "canvas.courses.list-users-in-course-users",
  "initial_data": {
    "base_url": "value",
    "course_id": "value"
  }
}