Canvas API only returns courses that I created, How can I return all courses on the instance ?

Jump to solution
DavidGeismar2
Community Member

I am using the canvas api to retrieve all courses from my canvas instance.
In order to do this I :

- create a new access token in /profile/settings

- Then use this access token to perform an API call to list all courses with https://canvas.instructure.com/doc/api/courses.html#method.courses.index

This works well. However the API only returns the courses that I have specifically created. I need to return all the courses from the canvas instance.

Am I missing something ? What should I do to be able to access all courses ?

Labels (1)
0 Likes
2 Solutions
melodyc_lam
Community Coach
Community Coach

@DavidGeismar2 Welcome, and welcome to using the API!

You'll want to use the following API endpoint to GET the courses from a specific account/subaccount:

<your canvas URL>/api/v1/accounts/<account ID>/courses

Your root account ID I believe is 1 (one) but as a pro-tip if you ever need to get a subset of courses that live in a specific subaccount, you can use the subaccount ID to access a list of just those courses. This helps in larger Canvas instances.

Hope this helps!

Edit: Found the name of the call you're making (I've been using the API for so long that I don't really look at the docs anymore) -- it's called List active courses in an account 

View solution in original post

James
Community Champion

@DavidGeismar2 

To add to what Melody wrote, if you look at the top of the documentation you pointed to, you sees "Returns the paginated list of active courses for the current user." It's not specifically course that you created, but courses where you are enrolled. If you are only enrolled in all courses you create, it would be the same list. But if you were added to some other courses, they would show up there, too.

The endpoint you found works for all users, including students. The endpoint that Melody gave for the whole institution needs a token from an administrator.

View solution in original post