Showing results for 
Show  only  | Search instead for 
Did you mean: 
Community Participant

How to enroll multiple users in a section with one API call?

I need to use the Canvas API to enroll multiple users (up to 400 per batch) into an existing course section.

I see the API will let me POST one user enrollment per API call using the "/v1/sections/{section_id}/enrollments" function.

Is there a different function that would let me enroll multiple users with a single API call?  Maybe some SIS import function?  I'd rather not take the slow approach of iterating over the list of users and enrolling them one at a time.

Labels (1)
Tags (3)
0 Kudos
3 Replies
Community Coach
Community Coach

You can use the SIS Import tool to generate many enrollments at once by uploading a CSV file, as long as the users and courses both have SIS ids, but that's generally done via the GUI.  It looks like there is an API to invoke an SIS Import function, though


Hi there, @lsloan ...

To piggyback on what @mzimmerman has already stated, you can find the Administrator Guides for SIS imports at this location: SIS Imports.

Hope this helps a bit.

Community Participant

Thank you, @mzimmerman and @Chris_Hofer, for the advice.

For whatever reasons not explained to me, my colleagues/managers specifically told me to NOT use the SIS import function in the Canvas API.  They said that they didn't like the disconnected nature of it and vaguely alluded to problems with using that function.

Aside from that, I think part of the problem is that the users who will provide the CSV do not have access to the SIS IDs of the users that will be enrolled in the section, but they do know the users' login IDs.  When we call the `/v1/sections/{section_id}/enrollments` API function to add users one by one, we use the `sis_login_id:` prefix for the `user_id` parameter to enroll the users by that ID.  If the SIS import function can support that, too, then I don't think the lack of SIS ID will be a problem.

I'll just need to decode why my colleagues are so opposed to using the SIS import function.

In the meantime, I spent a lot of time figuring out how to work with/around Canvas API's rate-limit features, which appeared when we started sending many (400+) asynchronous requests to `/v1/sections/{section_id}/enrollments` API function all at once.  The solution turned out to be to reactively add a few seconds wait (2–5) before retrying any of those many requests that fail.  Again, this is the solution that my colleagues directed me to use.  I wanted to take advantage of the rate-limit headers the Canvas API returns so we could implement proactive request throttling, but I was overruled.  🤷

0 Kudos