Canvas LMS - REST API and Extensions Documentation

Welcome to the canvas lms api documentation.

Canvas LMS includes a REST API for accessing and modifying data externally from the main application, in your own programs and scripts. This documentation describes the resources that make up the API.

To get started, you'll want to review the general basics, including the information below and the page on Authentication using OAuth2 .

API Changes

For API resources, such as the API Change Log for additions, changes, deprecations, and removals, view the Canvas API page in the Canvas Community.

Please carefully review the Canvas API Policy before using the API.

All API access is over HTTPS, against your normal Canvas domain.

All API responses are in JSON format .

All integer ids in Canvas are 64 bit integers. String ids are also used in Canvas.

To force all ids to strings add the request header Accept: application/json+canvas-string-ids This will cause Canvas to return even integer IDs as strings, preventing problems with languages (particularly JavaScript) that can't properly process large integers.

All boolean parameters can be passed as true/false, t/f, yes/no, y/n, on/off, or 1/0. When using JSON format, a literal true/false is preferred, rather than as a string.

For POST and PUT requests, parameters are sent using standard HTML form encoding (the application/x-www-form-urlencoded content type).

POST and PUT requests may also optionally be sent in JSON format format. The content-type of the request must be set to application/json in this case. There is currently no way to upload a file as part of a JSON POST, the multipart form type must be used.

As an example, this HTML form request:

would translate into this JSON request:

With either encoding, all timestamps are sent and returned in ISO 8601 format (UTC time zone):

Authentication

API authentication is done with OAuth2. If possible, using the HTTP Authorization header is recommended. Sending the access token in the query string or POST parameters is also supported.

OAuth2 Token sent in header:

OAuth2 Token sent in query string:

Read more about OAuth2 and how to get access tokens.

Note that if you make an API call using HTTP instead of HTTPS, you will be redirected to HTTPS. However, at that point, the credentials have already been sent in clear over the internet. Please make sure that you are using HTTPS.

About this Documentation

This documentation is generated directly from the Canvas LMS code. You can generate this documentation yourself if you've set up a local Canvas environment following the instructions on Github . Run the following command from your Canvas directory:

  • Purpose and Principles
  • Who has access to learning data?
  • Where can I access learning data?
  • How do I request learning data?
  • What if I need different or additional data?
  • What are my responsibilities with learning data?
  • How is learning data protected?

Get Started with the Canvas API

Did you know that Canvas has an API that allows users to interact with Canvas using code? While most users use the Canvas website to develop teaching materials or as students, to submit assignments, access grades, and so forth, the Canvas API allows you to do the same things with code and to create useful tools that expand the functionality of Canvas.

All UBC students, faculty, TAs, and staff are able to access the Canvas API simply by virtue of having a Canvas account. The types of data you’re able to access through the API depend on your role in Canvas. You will have the same permissions when accessing Canvas through the API as you do when using the Canvas website — that means students, for example, can access things like your class schedule, due dates, and discussion posts, as well as your own grades and assignment submissions.

This guide shows you how to access the Canvas API and make API requests. It’s meant to be accessible to beginners, but having a bit of programming experience may come in handy.

What exactly is an API?

API stands for A pplication P rogramming I nterface. APIs allow you to interact with an application using code. If you’re not quite sure what that means, check out this explanation .

How do I access the Canvas API?

This next section walks you through the process of accessing and submitting requests to the Canvas API.

Step 1: Generate your Canvas access token

Accessing the Canvas API requires a token, which you can think of as your username and password squished into one long random string. Anything you can do in Canvas can be done by someone else if they have your token, so don’t share your token with anyone else (or ask others to share their token with you)!

Follow these steps to generate your personal access token.

  • Log into Canvas at canvas.ubc.ca . Click Account in the left menu, and then click Settings .

canvas api submit assignment

  • Scroll to Approved Integration and click  + New Access Token .

canvas api submit assignment

  • Fill in the Purpose field.
  • For added security, set an expiry date for your token . This way, if you accidentally share your token or your token is stolen, at the very least it won’t be valid forever.
  • Click Generate Token. Now copy your freshly generated token and save it somewhere secure.

One last reminder to never share your token with anyone. If you think your token may have been exposed (for example, by accidentally posting it to GitHub), delete your token from Canvas right away. Instructions for creating and deleting access tokens as a student are available on the Canvas Guides .

Step 2: Make an API request to Canvas

Curl is a command line tool for making requests to URLs and is the simplest tool for making an API request to Canvas. This step shows you how use Curl and the token you just generated to make a request to the Canvas API to display basic information about your Canvas user profile.

  • If you’re on a Mac, start by opening Terminal. If you’re using Windows, open Command Prompt. (Note that Windows users may need to install Git for Curl to work properly.)
  • Enter the following text, substituting $token with the token you just generated in Canvas (make sure you retain the quotation mark at the end):

You should receive a response back that looks like:

If that worked, congratulations! You’ve just made first API request to Canvas. The response you received back from Canvas via the API is in JSON format, which is designed to be readable by both humans and computers.

Step 3: Learn how to make requests to the API using other programming languages

While Curl is a great way to get started with the Canvas API, you may find it easier in the long run to make more complex API requests using programming languages like JavaScript and Python.

You can make the same Canvas API request we just made in Curl with Node.js and JavaScript by following the instructions in this GitHub repository . To make an equivalent request using Python, follow these instructions on GitHub .

Canvas API Resources

Want to learn more about working with the Canvas API? Check out the groups, documentation, and other opportunities that can help you build your skills.

Groups and events

UBC’s Learning Analytics Hackathons offer students an opportunity to work with real learning data and explore how analytics can support learning. Several past Learning Analytics Hackathons have also focused on teaching participants how to access and make requests to the Canvas API. Hackathons are usually held in the fall and spring — stay tuned for upcoming fall 2019 Hackathon dates.

The Canvas Developer Community is an online community for anyone involved in building LTI or API integrations for Canvas. This is a place to ask and answer questions, participate in group discussions, and share resources related to the Canvas API.

Documentation

  • The Canvas API Getting Started Guide is a comprehensive resource designed to assist everyone with the Canvas API, from total beginners to seasoned programmers.  
  • Canvas’s API documentation describes the resources that make up the Canvas API.
  • The UBC Canvas API Community (CAPICO) GitHub contains scripts for the Canvas API created by members of the UBC community.
  • The Python Canvas API package GitHub repository can help you get up and running with the Canvas API using Python.
  • The Node.js Canvas API package GitHub repository can help you get up and running with the Canvas API using JavaScript/Node.js.

Canvas LMS - REST API and Extensions Documentation

Learning_outcome_created.

Definition: The event is emitted anytime a outcome is created in the account by an end user or API request.

Trigger: Triggered when a new learning outcome is created.

Payload Example:

Event body schema, learning_outcome_group_created.

Definition: The event is emitted anytime a new outcome group is created in the account by an end user or API request.

Trigger: Triggered when a new group of learning outcomes is created.

learning_outcome_group_updated

Definition: The event is emitted anytime an existing outcome group is updated by an end user or API request. Only changes to the fields included in the body of the event payload will emit the updated event.

Trigger: Triggered when a group of learning outcomes is modified.

learning_outcome_link_created

Definition: The event is emitted anytime an outcome is linked to a context by an end user or API request. Only changes to the fields included in the body of the event payload will emit the updated event.

Trigger: Triggered when an outcome is linked inside of a context.

learning_outcome_link_updated

Definition: The event is emitted anytime an outcome context link is changed by an end user or API request.

Trigger: Triggered when an outcome link is changed inside of a context.

learning_outcome_result_created

Definition: The event is emitted anytime a submission is assessed against an outcome. The following setup should be enabled in Canvas in order for the event to be triggered:

  • Administrator has set up learning outcomes at the account/sub-account level
  • Instructor has added outcome to assignment rubric
  • Student submitted a rubric based assignment
  • Instructor graded a rubric based assignment at the outcome level => there is a result associated with assignment outcome

Trigger: Triggered when a submission is rated against an outcome.

learning_outcome_result_updated

Definition: The event is emitted anytime a existing outcome rating for a submission is updated. Only changes to the fields included in the body of the event payload will emit the updated event.

Trigger: Triggered when a submission outcome rating is updated.

learning_outcome_updated

Definition: The event is emitted anytime an outcome is updated by an end user or API request. Only changes to the fields included in the body of the event payload will emit the updated event.

Trigger: Triggered when an outcome is updated.

outcome_proficiency_created

Definition: The event is emitted anytime a new outcome_proficiency (mastery scale) is created by an end user or API request.

Trigger: Triggered when a new outcome_proficiency is saved.

outcome_proficiency_updated

Definition: The event is emitted anytime an outcome_proficiency (mastery scale) is updated or its associated ratings are updated by an end user or API request.

Trigger: Triggered when an outcome_proficiency is saved.

PHOTO 303: Pro Photo Studio Syllabus and Info

PHOTO 303: Pro Photo Studio Syllabus and Info

Assignment Submission Guidelines

The page will explain the four types of assignments in photo 303.

  • Photography Assignments ( Submit jpegs to Canvas * )
  • Research Assignments (required for each photography assignment complete the Research Forms on the Assignment Pages in the syllabus )
  • Video Tutorial Assignments and Synopses (S ubmit doc or docx files to Canvas** )
  • Quizzes on video tutorials, Essential Definitions , and information covered in class ( take Semester Quiz on April 10 or 11  (2024) at the Testing Center *** )

* You will submit only jpeg image files to Canvas, however you will shoot and edit in RAW, psd, or tiff, depending on the situation. This is part of your “workflow”. ** Only doc, docx, or txt files will be submitted to Canvas; pdf files will not be accepted by Canvas for these assignments. *** On April 3, 2024 be on the lookout for a scheduling email from the Testing Center.

These guidelines are intended to simplify our assignment submission process.

There will be four photographic assignments and four associated research assignments. For simplicity, these assignment follow the same pattern throughout the semester where the Research Assignment is due one week before the Photography Assignment. There are also 11 Video Tutorial Assignments.

All assignments are due by the time scheduled in Canvas. Late (no forgiveness on this without prior arrangement) or incomplete work (without an official excuse) will initially lose one letter grade and then an additional letter grade for every day it is late. An “A” assignment that is more than four days late or incomplete will automatically receive a failing grade. (Note that an assignment that would normally receive a C will receive a failing grade if it is two days late.)

Submit your  image files directly using Canvas submission area  for the photo and .doc (or similar file types) for the research assignments. Your instructor will explain which image format to use for assignment. You may be instructed to submit .jpg, .psd, RAW format or more than one format.

Photography Assignment Submissions:

Photography assignments include the photographs required for the assignment and any additional information regarding those photographs.

  •  technical info including f/stop, shutter speed, iso, camera model, lens and focal length
  • brief information regarding the position of lights, subject, camera etc
  • a brief explanation of the choices made to accomplish the image and the assignment goals

Important: Use of RAW format during shooting is required. Note that under some circumstances you may be asked to additionally submit original RAW files so keep these files available! These files will be important if your instructor has concerns about image quality and adjustments. Improving a score, in some cases, may be as simple as readjusting an original RAW file.

Convert or save the images to jpeg in Photoshop, Lightroom or other appropriate software as your last step before assignment upload – after editing.

Submit only corrected jpeg files to Canvas for scoring.

Read the assignment descriptions regarding additional requirements involving in peer review, critique, group participation etc.

Students working in groups must all submit significantly different photographs for the assignments including different subject choices, composition, props, lighting, etc.

Research Assignment Submissions link:

Research Assignments Guidelines

Tutorial Assignment Submissions link:

Video Tutorial Assignment Submission Guidelines

Assignment redo policy (see also the Evaluation Policy page):

  • Your instructor will accept assignment resubmissions if students wish to improve their work.
  • All resubmissions must be submitted at least two weeks before the last day of this class and be previously discussed with the instructor .
  • Students must individually confer with the instructor about what should be improved and include that information in the resubmission.
  • If there is no improvement or the assignment second attempt is less successful than the first, your assignment grade will remain the same – you will not be penalized.
  • Only one assignment resubmission is accepted per assignment.
  • If the original research assignment was late or incomplete, the highest score you can earn on your associated photo assignment redo is 85%.

There will be one scheduled examination in the Testing Center using Canvas, however your instructor may give the class an additional “pop quiz” at any time.

The Testing Center quiz will be between 20 and 30 questions drawn from a bank of over 100. They may be multiple choice, true/false, fill in the blank, or essay style.

You will receive an email from the Testing Center regarding scheduling your quiz.

Quiz material: PHOTO 303 Essential Information, any information covered in class, any information that appears in the video tutorials.

Canvas LMS - REST API and Extensions Documentation

Uploading files.

There are two ways to upload a file to Canvas: either by sending the file data in a POST request, or by sending Canvas a publicly accessible HTTP or HTTPS URL to the file.

Uploading via POST

There are three steps to uploading a file directly via POST:

  • Notify Canvas that you are uploading a file with a POST to the file creation endpoint. This POST will include the file name and file size, along with information about what context the file is being created in.
  • Upload the file using the information returned in the first POST request.
  • On successful upload, the API will respond with a redirect. This redirect needs to be followed to complete the upload, or the file may not appear.

Step 1: Telling Canvas about the file upload and getting a token

The first step is to POST to the relevant API endpoint, depending on where you want to create the file. For example, to add a file to a course , you'd POST to /api/v1/courses/:course_id/files . Or to upload a file as part of a student homework submission , as the student you'd POST to /api/v1/courses/:course_id/assignments/:assignment_id/submissions/self/files or /api/v1/courses/:course_id/assignments/:assignment_id/submissions/comments/self/files for submission comments.

Note* The endpoint you choose to post files to will change the permissions set on the file. i.e. only files posted to the submissions comments endpoint can be attached to a submissions comment.

Example Request:

Example Response:

At this point, the file object has been created in Canvas in a "pending" state, with no content. It will not appear in any listings in the UI until the next two steps are completed. The returned Signature is valid for 30 minutes.

Step 2: Upload the file data to the URL given in the previous response

Using the data in the JSON response from Step 1, the application can now upload the actual file data, by POSTing a specially formulated request to the URL given in the upload_url field of the response.

Depending on how Canvas is configured, this upload URL might be another URL in the same domain, or a Amazon S3 bucket, or some other URL. In order to work with all Canvas installations, applications should be very careful to follow this documentation and not make any undocumented assumptions about the upload workflow.

This second request must be POSTed as a multipart/form-data request to accomodate the file data. The parameters POSTed with this request come directly from the upload_params part of the JSON response in Step 1.

The only addition is the file parameter which must be posted as the last parameter following all the others.

The access token is not sent with this request.

IMPORTANT: The request is signed, and will be denied if any parameters from the upload_params response are added, removed or modified. The parameters in upload_params may vary over time, and between Canvas installs. It's important for the application to copy over all of the parameters, and not rely on the names or values of the params for any functionality.

This example assumes there is a file called my_local_file.jpg in the current directory.

Step 3: Confirm the upload's success

If Step 2 is successful, the response will be either a 3XX redirect or 201 Created with a Location header set as normal.

In the case of a 3XX redirect, the application needs to perform a GET to this location in order to complete the upload, otherwise the new file may not be marked as available. (Note: While a POST would be truer to REST semantics, a GET is required for forwards compatibility with the 201 Created response described below.) This request is back against Canvas again, and needs to be authenticated using the normal API access token authentication.

In the case of a 201 Created, the upload has been complete and the Canvas JSON representation of the file can be retrieved with a GET from the provided Location.

Uploading via URL

Instead of uploading a file directly, you can also provide Canvas a public HTTP or HTTPS URL from which to retrieve the file.

Step 1a: Posting the file URL to Canvas

The first step is the same as with the "Uploading via POST" flow above, with the addition of a few new parameters:

Step 1b: Understanding the response

Canvas' file management is in a moment of transition. For the duration of this transition, there are two possible behaviors. The newer behavior includes additional fields in the response to the first request and expects an additional action from the application.

In the deprecated behavior, Canvas will initiate a "cloning" of the provided URL by downloading it via Canvas servers. The initial POST was sufficient to start this and no other action is necessary from the application.

In the newer behavior, Canvas delegates the cloning of the URL to the same service that accepts direct uploads. The cloning is kicked off by a POST by the application to the provided upload_url with the provided upload_params , in parallel with a direct upload. The service then informs Canvas directly when it is complete.

In either case, the cloning of the URL will be performed in the background, and the file will not necessarily be immediately available when the API calls complete. Instead, a progress object is provided which can be periodically polled to check the status of the upload.

You can distinguish the new behavior (and expected follow up) from the old behavior precisely by the presence or absence of the upload_url key.

Step 2: POST to the URL given in the previous response

If the response to the initial POST includes an upload_url , you must POST to it with the upload_params just as if you were performing a direct upload. The only exception is that the file parameter is omitted. The Content-Type is still expected to be multipart/form-data.

This step is not necessary with the old behavior.

Step 3: Check to see when the upload is complete

If the application needs to know the outcome of the upload, it can use the file.file_uploads.html to query the status. On success, the created attachment's id will be returned in the results of the Progress object as id .

Instructure Logo

You're signed out

Sign in to ask questions, follow content, and engage with the Community

  • Canvas Question Forum

Late assignments

  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Printer Friendly Page

STEVENNATHMAN

  • Mark as New
  • Report Inappropriate Content
  • All forum topics
  • Previous Topic

mzimmerman

Ally Icon not appearing on image/in Files

Discussion board sort by likes, canvas annotation assignment - re-submission issue, access code required on classic proctored quiz, how to know when a user accepts an invitation and ..., no module icon on the left, gradebook string/char entries, community help, view our top guides and resources:.

To participate in the Instructurer Community, you need to sign up or log in:

IMAGES

  1. How to Submit an Assignment on Canvas

    canvas api submit assignment

  2. Submit an Assignment in Canvas

    canvas api submit assignment

  3. How to Submit an assignment on Canvas

    canvas api submit assignment

  4. How to Submit an Assignment in Canvas

    canvas api submit assignment

  5. Scan and Submit a PDF to a Canvas Assignment

    canvas api submit assignment

  6. Submit an Assignment in Canvas

    canvas api submit assignment

VIDEO

  1. How To SUBMIT ASSIGNMENT in Canvas

  2. For Students How to Complete and Submit Canva Assignments in Canvas

  3. Submit Assignment on Canvas

  4. How to Submit an Assignment in Canvas

  5. Canvas Modules & Assignments

  6. Using the Text Box Feature to Submit an Assignment in Canvas

COMMENTS

  1. Submissions

    Submit the assignment as a set of one or more previously uploaded files residing in the submitting user's files section (or the group's files section, for group assignments). To upload a new file to submit, see the submissions Upload a file API. Requires a submission_type of "online_upload".

  2. Solved: Submit Assignment via API

    Submit Assignment via API. 09-21-2016 07:45 PM. I followed the documentation here to submit a file ... Uploading Files - Canvas LMS REST API Documentation. The end result is a file added to the user's personal file space, and I got back a file id. I can preview the file and I can download this file. Then I want to use this file as assignment ...

  3. Submit file to assignment via API

    Unfortunately, teachers cannot submit assignments on behalf of students this way. To use the API on behalf of another user, one must be an administrator with the "masquerade" permission. Letting teachers submit assignments was supposed to be on the feature list for Q4 2019, but I don't know what happened to that.

  4. Canvas LMS REST API Documentation

    This documentation describes the resources that make up the API. To get started, you'll want to review the general basics, including the information below and the page on Authentication using OAuth2. API Changes. For API resources, such as the API Change Log for additions, changes, deprecations, and removals, view the Canvas API page in the ...

  5. Submitting an Assignment via API

    The user who is making the API call is the one that needs the ability to masquerade as another user. The person being masqueraded as just needs the ability to submit the assignment. Whoever you give access to run the program after the oAuth2 dance will the ability to masquerade. If you don't put the as_user_id in there, it will try to submit it ...

  6. Services

    Canvas LMS - REST API and Extensions Documentation. Expand all. Basics. ... Account Asset Assignment Attachment Content Conversation Course Discussion Enrollment Grade Group Learning Logged Module Outcome Plagiarism Quiz Rubric Sis Submission Syllabus User Wiki. Caliper IMS 1.1. Assessment Basic Forum Grading Navigation Events Session.

  7. Get Started with the Canvas API

    While most users use the Canvas website to develop teaching materials or as students, to submit assignments, access grades, and so forth, the Canvas API allows you to do the same things with code and to create useful […] Search. The University of British Columbia. UBC - A Place of Mind.

  8. Assignment

    publish_provisional_grades (**kwargs) ¶. Publish the selected provisional grade for all submissions to an assignment. Use the "Select provisional grade" endpoint to choose which provisional grade to publish for a particular submission.

  9. Examples

    assignments = course. get_assignments (bucket = 'ungraded') for assignment in assignments: print (assignment) Create an Assignment ¶ Using canvasapi.course.Course.create_assignment() :

  10. Submission

    upload_comment (file: Union[os.PathLike, str, io.IOBase, _io.FileIO], **kwargs) ¶. Upload a file to attach to this submission as a comment.

  11. Learning

    Definition: The event is emitted anytime a submission is assessed against an outcome. The following setup should be enabled in Canvas in order for the event to be triggered: Administrator has set up learning outcomes at the account/sub-account level. Instructor has added outcome to assignment rubric.

  12. How do I submit an online assignment?

    You can submit online assignments in Canvas using several submission types. Instructors can choose what kind of online submissions they want you to use. You may also have the option to resubmit assignments if your instructor allows. Files uploaded using the Rich Content Editor count toward your user...

  13. Assignment Submission Guidelines

    The page will explain the four types of assignments in PHOTO 303. Photography Assignments (Submit jpegs to Canvas *)Research Assignments (required for each photography assignment complete the Research Forms on the Assignment Pages in the syllabus); Video Tutorial Assignments and Synopses (S ubmit doc or docx files to Canvas**); Quizzes on video tutorials, Essential Definitions, and information ...

  14. API to Validate links in content

    1 Solution. According to Chat GPT this is not possible. I hope that this is just a hallucination and that there is a way. Unfortunately, Canvas does not provide a direct API endpoint to run the "Validate Links in Content" feature on a specific group of courses. This feature is typically accessed through the Canvas user interface and is not ...

  15. 2024 Aud Eng and Part Syllabus

    Canvas provides a venue for course announcements, a relay of course documents and assignments, a portal for submitting assignments, and any online tools the class decides to use. Shared google sheets, docs and slides may also be used over the course of the mini. ASSIGNMENTS (Assignments and rubrics are available on Canvas.) DISCUSSION BOARD:

  16. "On paper" assignments

    Students cannot submit an on paper assignment but I would assume that as the teacher I can record that the assignment has been submitted. When I look in SpeedGrader the only options I get are "Late", "Missing", "Excused" and "None". Surely I should be able to record that a student has submitted their paper assignment to me on time!

  17. Uploading Files

    On successful upload, the API will respond with a redirect. This redirect needs to be followed to complete the upload, or the file may not appear. Step 1: Telling Canvas about the file upload and getting a token. The first step is to POST to the relevant API endpoint, depending on where you want to create the file.

  18. Use APi and Python to search for Courses with Quizzes

    Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

  19. API to Validate links in content

    1 Solution. According to Chat GPT this is not possible. I hope that this is just a hallucination and that there is a way. Unfortunately, Canvas does not provide a direct API endpoint to run the "Validate Links in Content" feature on a specific group of courses. This feature is typically accessed through the Canvas user interface and is not ...

  20. Late assignments

    I can send you the link to the 2 different cases where this happened. Steve Nathman. 817-698-1331. Northwest High School. [email protected]. I also have this question. 0 Likes. Reply. All forum topics.