Showing results for 
Search instead for 
Did you mean: 
Community Participant

How to create a new course using the API

Our goal is to create a Google form with a few fields like "Course Name", to allow our teachers to create new Courses.  We will put a link to the Google Form in Canvas. The API says to use this:


My question is, what exactly is the account_id?  When I try and use the Live API located at, the documentation states that the accound_id is an optional integer associated with the course.  How do I obtain this value for the user filling out the Google Form?


Also, live API allows you to do a test run, but the account_id is REQUIRED.  So is this value required or optional? And if it's required, how do I get this value from the user who's filling out the Google Form and launching the API to create the course?


Tags (2)
5 Replies
Community Participant

Also, in the API documentation for Creating a course.  It states that the account_id is the root account associated with the course.  Again, how do I get this value?


Hi Daniel,

The ID that you're looking for depends on how you have your Canvas instance setup.  Your top level account is ID 1... If your institution uses sub-accounts like mine does you would need to go to that sub-account and up in the address bar you can see what ID is associated with that sub-account.  What I did was create a table on the back end that I then use to pull which sub-account to associate said course with.  


For what you're looking for you might just provide the instructor a list of sub-accounts available and then on the back end of the google form have that associated with the ID of the account that you can put in when making the call. 

Hope this helps. 

Thanks Brian,

That helps.  Are you familiar with using Google Forms, and onFormSubmit?  We are using this to call the API and create the course.  Is there a way, during the onFormSubmit() to get the current user's info from Canvas?  In other words, how can I get the user's "id" from  Canvas during the onFormSubmit function?

Never mind.  This can be used:

GET /api/v1/users/self

Community Coach
Community Coach

 @daniel_olivas ,

Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment.  Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.