Enrollments API: inactive enrollments returned by default
Author: putmanbCreated Oct 14, 2020Updated Sep 11, 2026
LabelsNo Activity
Summary:
Per the API documentation for the state[] param of "List enrollments" (https://canvas.instructure.com/doc/api/enrollments.html#method.enrollments_api.index):
Filter by enrollment state. If omitted, 'active' and 'invited' enrollments are returned.
However, in my testing enrollments with enrollment_state = 'inactive' are being returned for a course, even when the state[] parameter is omitted.
Steps to reproduce:
- Create a course with at least 1 inactive enrollment.
- Use the API to list enrollments for that course, do not include a state[] param: /api/v1/courses/1234/enrollments
- Observe the returned results.
Expected behavior:
The inactive enrollment should NOT be included.
Actual behavior:
The inactive enrollment IS included.
Notes
The specific case I observed was for a custom role of base type of TeacherEnrollment. I haven't confirmed other cases. So the bug could be limited to custom roles only.
Source: instructure/canvas-lms