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

Student email list without so many API requests

I'm currently using /api/v1/courses/:course_id/enrollments to generate a list of students in a set of classes. The list I'm generating needs to have SIS ID, student name, email, enrollment created at, enrollment updated at, last activity, and canvas state. I'm able to pull in everything I need, but email address. To get the email address, I'm using /api/v1/users/:user_id. But I'd like to try to minimize my API requests (if I have 50 students in class, I'm making 51 API requests and it isn't as fast as I'd like, and I'm doing this on about 40-50 classes per term). If I don't pull in the emails, I can generate a class roster in about 2-3 seconds, but if I include the email, it takes 9-10 seconds.

I've also tried /api/v1/courses/:course_id/users and this gets me everything I need for my list. However, I can't pull in all user states. I can't get users who have been deleted and I need that because some users are made inactive, while others are deleted, and I'd like to treat them the same way.

If I could include[]=email in the enrollments request or use enrollment_state[]=deleted in the users request, I'd have exactly what I need, but neither of these seem to be available.

Does anyone have any thoughts?

6 Replies
Community Champion

Hi Kevin,

What exactly are you trying to accomplish with gathering all this information? Reason I ask is because it could help us with giving you some help on how to improve the efficiency of gathering this data.

I'm not sure if or what #sis‌ you're using, but could you not use it to pull the email as well as class roster out of instead of making an API call into Canvas?

Hi Brian,

Our program is a fully online program and we have partner schools (six different schools). Students register at their school (each school has an instance of the class in their registration system). We cross-list the classes created by the SIS at each school into one class in Canvas where all students will interact. So Canvas is the only place that has a complete roster for a particular class. We use the email lists for various things throughout the term and after, and also track when I student last was active and if they have completed certain required items, so we can help with retention efforts. We also use the class lists to help during our financial settlement process, and that's where enrollment updated and created comes into play, which help verify refunding percentages.


0 Kudos
Community Champion

Hi Kevin,

One way I can see making this a little easier and less calls is to use some Admin Reports from within Canvas. 

  1. provisioning report‌ - this report allows you to pull enrollments based on term as well as users.  These two files will allow you to see enrollments in courses as well as get the students email address.
  2. last_enrollment_activity_report - while this doesn't allow you to see their last enrollment activity by course it does allow you to see by term. 
  3. student submission‌ report - this will allow you to see what graded items a student has submitted. The date of the submission, date graded as well as the score on the submission.  One thing to note is that if you're using any 3rd party LTI's the submission date by be null as they don't pass back the submission date to Canvas. 

Not sure if this helps but it is definitely one way to make less API calls to get some of the data you're looking for.

New Member

In a similar note, is there a way that I can get emails filtered by a specific role in a specific term? In other words, I need to get a list with all of my professors' emails for Fall 2019. I tried making a call via API but there is no way I can do that. If I go to provisioning, I do get all of the emails for a specific term but since provisioning does not include "role_id," I cannot simply filter the data. Does anyone have a solution for this? I would really appreciate it.

0 Kudos
Community Champion


Actually, the provisioning reports contain all of this information, but it is spread up over several files.

Roles are based on enrollments -- someone may be a teacher in one course but a student in another. If you configure the provisioning report and select the enrollments file, then you can tell what role people are in.

The provisioning reports typically require some combining together to get the information that you need. The enrollments file contains the roles, but the users file contains the emails. You can link the two together with the canvas_user_id.

Thank you James, you never disappoint :smileygrin: 

I wish there were an easier way to do this but at least now I know of a better way. 


0 Kudos