# Introduction

Explore services, tools, and guides to build seamless integrations in the Instructure ecosystem.

Instructure's Developer Portal is your gateway to integrating our learning management system with other tools, automating workflows, and building custom applications. Designed for flexibility and ease of use, our APIs and resources empower developers to create dynamic, efficient learning solutions. Start exploring and bring your ideas to life with the support of our comprehensive documentation and tools.

{% if space.vars.ENVIRONMENT == "cd" %}

<table data-view="cards" data-full-width="false"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>Services</strong></td><td><ul><li><a href="/pages/OdH6WXwOdmsdyTGIod4C">Canvas LMS</a></li></ul></td><td><a href="/files/MztT4egHzeUrBE0OI1Ju">/files/MztT4egHzeUrBE0OI1Ju</a></td></tr><tr><td><strong>LTI</strong></td><td><ul><li><a href="/pages/4g3m57tbZMoufbYxIQmL">Canvas LTI documentation</a></li><li><a href="https://www.imsglobal.org/spec/lti/v1p3/">LTI v1.3 Specification</a></li><li><a href="https://www.imsglobal.org/spec/security/v1p0/">1EdTech Security Framework</a></li><li><a href="https://www.imsglobal.org/spec/lti-dl/v2p0">Deep Linking</a></li><li><a href="https://www.imsglobal.org/spec/lti-nrps/v2p0">Names and Roles Provisioning Service</a></li><li><a href="https://www.imsglobal.org/spec/lti-ags/v2p0/">Assignment and Grades Service</a></li><li><a href="https://www.imsglobal.org/spec/lti/v1p3/impl/">LTI Advantage Implementation Guide</a></li><li><a href="https://www.imsglobal.org/spec/lti/v1p3/migr">LTI Migration Guide</a></li><li><a href="https://github.com/imsglobal/ltibootcamp">1EdTech LTI Boot Camp Resources</a></li></ul></td><td><a href="/files/p4dIx6GMYrswDomYHxWs">/files/p4dIx6GMYrswDomYHxWs</a></td></tr></tbody></table>
{% endif %}

{% if space.vars.ENVIRONMENT == "test" || space.vars.ENVIRONMENT == "beta" || space.vars.ENVIRONMENT == "prod" %}

<table data-view="cards" data-full-width="false"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>Services</strong></td><td><ul><li><a href="/pages/OdH6WXwOdmsdyTGIod4C">Canvas LMS</a></li><li><a href="/pages/hMNvLHsRK19WJUXZaPTr">Catalog</a></li><li>Certify</li><li><a href="/pages/ApvQkaRt2ANytUftFk5a">Commons</a></li><li><a href="/pages/Y0gzudpTPXY9Zy1za9Rd">Data Access Platform</a></li><li><a href="https://api.ed-fi.org/">Data Hub</a></li><li><a href="/pages/HPi6hLNUMgkXfxUUVf5S">Instructure UI</a></li><li><a href="/pages/AinWwAvlZUBclRsccvTV">Journey</a></li><li>Mastery Connect</li><li><a href="/pages/4zeDeMRph9N7WZolCf5T">New Quizzes</a></li><li><a href="/pages/AChtLgWUE3YvZT9jZirD">Parchment Digital Badges</a></li><li><a href="/pages/pZyZsPEQEPBbAzVr26wL">Studio</a></li></ul></td><td><a href="/files/MztT4egHzeUrBE0OI1Ju">/files/MztT4egHzeUrBE0OI1Ju</a></td></tr><tr><td><strong>LTI</strong></td><td><ul><li><a href="/pages/4g3m57tbZMoufbYxIQmL">Canvas LTI documentation</a></li><li><a href="https://www.imsglobal.org/spec/lti/v1p3/">LTI v1.3 Specification</a></li><li><a href="https://www.imsglobal.org/spec/security/v1p0/">1EdTech Security Framework</a></li><li><a href="https://www.imsglobal.org/spec/lti-dl/v2p0">Deep Linking</a></li><li><a href="https://www.imsglobal.org/spec/lti-nrps/v2p0">Names and Roles Provisioning Service</a></li><li><a href="https://www.imsglobal.org/spec/lti-ags/v2p0/">Assignment and Grades Service</a></li><li><a href="https://www.imsglobal.org/spec/lti/v1p3/impl/">LTI Advantage Implementation Guide</a></li><li><a href="https://www.imsglobal.org/spec/lti/v1p3/migr">LTI Migration Guide</a></li><li><a href="https://github.com/imsglobal/ltibootcamp">1EdTech LTI Boot Camp Resources</a></li></ul></td><td><a href="/files/p4dIx6GMYrswDomYHxWs">/files/p4dIx6GMYrswDomYHxWs</a></td></tr><tr><td><strong>Partner Facing Services</strong></td><td><ul><li><a href="/pages/k2tDHLc2a8pKNHknsKzM">Data Sync</a></li><li><a href="/pages/lrnwCe3eccJW7qvLhhc5">Elevate Standards Alignment</a></li></ul></td><td><a href="/files/qjbZ8BQn2WNcvpWzHIAQ">/files/qjbZ8BQn2WNcvpWzHIAQ</a></td></tr></tbody></table>
{% endif %}

{% if space.vars.ENVIRONMENT == "internal" %}

<table data-view="cards" data-full-width="false"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>Services</strong></td><td><ul><li><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/aspen/aspen.md">Aspen</a></li><li><a href="/pages/OdH6WXwOdmsdyTGIod4C">Canvas LMS</a></li><li><a href="/pages/hMNvLHsRK19WJUXZaPTr">Catalog</a></li><li><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/cedar/cedar.md">Cedar</a></li><li>Certify</li><li><a href="/pages/ApvQkaRt2ANytUftFk5a">Commons</a></li><li><a href="/pages/Y0gzudpTPXY9Zy1za9Rd">Data Access Platform</a></li><li><a href="https://api.ed-fi.org/">Data Hub</a></li><li><a href="/pages/HPi6hLNUMgkXfxUUVf5S">Instructure UI</a></li><li><a href="/pages/AinWwAvlZUBclRsccvTV">Journey</a></li><li>Mastery Connect</li><li><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/new-quizzes/internal/api-endpoints.md">New Quizzes Internal</a></li><li><a href="/pages/IdOfqHHnKRM9EoltRc42">New Quizzes Public</a></li><li><a href="/pages/AChtLgWUE3YvZT9jZirD">Parchment Digital Badges</a></li><li><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/platform-identity/README.md">Platform Identity</a></li><li><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/pine/pine.md">Pine</a></li><li><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/public-product-api/README.md">Public Product</a></li><li><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/redwood/redwood.md">Redwood</a></li><li><a href="/pages/pZyZsPEQEPBbAzVr26wL">Studio</a></li></ul></td><td><a href="/files/MztT4egHzeUrBE0OI1Ju">/files/MztT4egHzeUrBE0OI1Ju</a></td></tr><tr><td><strong>LTI</strong></td><td><ul><li><a href="/pages/4g3m57tbZMoufbYxIQmL">Canvas LTI documentation</a></li><li><a href="https://www.imsglobal.org/spec/lti/v1p3/">LTI v1.3 Specification</a></li><li><a href="https://www.imsglobal.org/spec/security/v1p0/">1EdTech Security Framework</a></li><li><a href="https://www.imsglobal.org/spec/lti-dl/v2p0">Deep Linking</a></li><li><a href="https://www.imsglobal.org/spec/lti-nrps/v2p0">Names and Roles Provisioning Service</a></li><li><a href="https://www.imsglobal.org/spec/lti-ags/v2p0/">Assignment and Grades Service</a></li><li><a href="https://www.imsglobal.org/spec/lti/v1p3/impl/">LTI Advantage Implementation Guide</a></li><li><a href="https://www.imsglobal.org/spec/lti/v1p3/migr">LTI Migration Guide</a></li><li><a href="https://github.com/imsglobal/ltibootcamp">1EdTech LTI Boot Camp Resources</a></li></ul></td><td><a href="/files/p4dIx6GMYrswDomYHxWs">/files/p4dIx6GMYrswDomYHxWs</a></td></tr><tr><td><strong>Partner Facing Services</strong></td><td><ul><li><a href="/pages/k2tDHLc2a8pKNHknsKzM">Data Sync</a></li><li><a href="/pages/lrnwCe3eccJW7qvLhhc5">Elevate Standards Alignment</a></li></ul></td><td><a href="/files/qjbZ8BQn2WNcvpWzHIAQ">/files/qjbZ8BQn2WNcvpWzHIAQ</a></td></tr></tbody></table>
{% endif %}

### Alternatively, consider the following choices

<table data-view="cards"><thead><tr><th></th><th></th><th data-type="content-ref"></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><strong>Detailed Docs</strong></td><td>Explore comprehensive, easy-to-use API documentation to unlock the full potential of our ecosystem.</td><td></td><td><a href="/pages/rl0zYBp1o3OsgyRIIp79">/pages/rl0zYBp1o3OsgyRIIp79</a></td><td><a href="/files/NyjGKmPQvNsLJa6jPk0n">/files/NyjGKmPQvNsLJa6jPk0n</a></td></tr><tr><td><strong>Simple search</strong></td><td>Find API endpoints, guides, and developer tools all in one convenient location.</td><td></td><td><a href="https://developerdocs.instructure.com?q=">https://developerdocs.instructure.com?q=</a></td><td><a href="/files/OZLHsoWaupL9nn9GLlqE">/files/OZLHsoWaupL9nn9GLlqE</a></td></tr><tr><td><strong>Partner Portal</strong></td><td>Manage your products and connect directly with educational institutions via the Partner Portal.</td><td></td><td><a href="https://app.learnplatform.com/">https://app.learnplatform.com/</a></td><td><a href="/files/oirvgoZ3Nv6eyBM31lXP">/files/oirvgoZ3Nv6eyBM31lXP</a></td></tr></tbody></table>


# Get Started

Hello! Welcome to Instructure's Developer Documentation portal.

This portal contains API documentation for all Instructure products.

Below are some examples of things you can do using Instructure product APIs:

### Integrate Canvas LMS into Your Applications

* Integrate Canvas LMS into your applications.
* For example, [automate course creation](/services/canvas/resources/courses)
* [Synchronize student data](/services/canvas/resources/users) between Canvas and your SIS or CRM
* Retrieve [grades](/services/canvas/resources/grade_change_log) and assessment results with API

### Access Rich Educational Data with Data Access Platform (DAP)

* Access rich educational data with Data Access Platform (DAP)
* For example, get detailed analytics about your student performance
* Create institutional reports
* Or integrate Canvas data into your business intelligence tools

### Improve Your Assessments with Quizzes

* Improve your assessments with [quizzes](https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/quizzes/openapi_quiz.md)
* You can quickly create and share quizzes
* You can get quiz results for analysis
* Save time by [managing quiz schedules and settings](/services/canvas/resources/quiz_assignment_overrides)

### Improve Your Classes

* Improve your classes
* With [personalized course information](/services/canvas/resources/courses) for the students
* [Notify students](/services/canvas/resources/account_notifications) about important events or milestones
* [Give instant feedback](/services/canvas/resources/submissions) on assignments and quizzes

### LLM Integration

* If you would like to use the page with LLMs, you can feed the LLM this url: <https://developerdocs.instructure.com/llms-full.txt>

## Quickstart Guide

### 1. Get Your Access Key

To access API endpoints for most of our services you need to get an Access Key. The way of getting these Access keys may be different for each service. Go into the subsection of the service you would like to use and look for a subpage called Authentication, OAuth, Developer Keys.

**Examples:**

* For Canvas LMS, find the Get started guide [here for OAuth](/services/canvas/oauth2/file.oauth) and [here for Developer Keys](/services/canvas/oauth2/file.developer_keys)
* For Data Access Platform, [here is the info about Authentication](/services/dap/query-api/oauth_login)
* For Elevate Standards Alignment, [here is the Authentication setup](/services/ab-connect/introduction/authentication)

### 2. Make Your First Request!

1. Take your authentication key or secret you got in the previous step.
2. Find an API you would like to try.
3. If there is a "Test it" button, you can click on it and test it on the spot.
4. Otherwise, use Postman or Terminal with curl for testing it.

### 3. Understand the Responses

When you make an API call, you'll typically get a response in JSON format. Here's how to quickly understand and use these responses:

#### ✅ Successful Response (with status 200 or 201):

A successful response usually looks something like this (this is just an example):

```json
{
  "id": 123,
  "name": "Introduction to Biology",
  "course_code": "BIO101"
}
```

Each response includes data fields (like `id`, `name`, and `course_code`) clearly describing what you've requested. You can use these fields directly in your applications.

#### ⚠️ Error Response (status 4xx):

If something goes wrong, you'll get an error response, for example:

```json
{
  "errors": [
    {
      "message": "Invalid access token."
    }
  ]
}
```

Errors come with clear messages indicating the problem. Common issues include authentication errors, incorrect parameters, or permission issues.

#### 📑 Pagination and Large Data:

Some services, for example Canvas LMS, split API calls into multiple pages when you request a lot of data (like a long list of courses or users):

* Check for a Link header in the response, which provides URLs for the next or previous page of results.
* Example header:

```bash
Link: <https://canvas.instructure.com/api/v1/courses?page=2>; rel="next"
```

You can follow these links to fetch all the data. Find more info about [Canvas pagination here](/services/canvas/basics/file.pagination).

### 🛠️ Helpful Tips:

* Use tools like [Postman](https://www.postman.com/) or browser extensions (like JSONView) to visualize responses clearly.
* Always refer to the specific API's documentation page for detailed descriptions of each data field.


# Services

Explore Instructure's portfolio of services, including the Elevate Standards Alignment API, Catalog, Canvas LMS, and more! Below you can find a comprehensive overview of tools and platforms designed to enhance educational experiences and administrative functionalities.

{% if space.vars.ENVIRONMENT == "test" || space.vars.ENVIRONMENT == "beta" || space.vars.ENVIRONMENT == "prod" %}

<table data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><a href="/pages/lrnwCe3eccJW7qvLhhc5">Elevate Standards Alignment</a></td><td><a href="/pages/lrnwCe3eccJW7qvLhhc5">/pages/lrnwCe3eccJW7qvLhhc5</a></td></tr><tr><td align="center"><a href="/pages/hMNvLHsRK19WJUXZaPTr">Catalog</a></td><td></td></tr><tr><td align="center"><a href="/pages/OdH6WXwOdmsdyTGIod4C">Canvas LMS</a></td><td><a href="/pages/OdH6WXwOdmsdyTGIod4C">/pages/OdH6WXwOdmsdyTGIod4C</a></td></tr><tr><td align="center">Certify</td><td></td></tr><tr><td align="center"><a href="/pages/ApvQkaRt2ANytUftFk5a">Commons</a></td><td></td></tr><tr><td align="center"><a href="/pages/Y0gzudpTPXY9Zy1za9Rd">Data Access Platform</a></td><td><a href="/pages/Y0gzudpTPXY9Zy1za9Rd">/pages/Y0gzudpTPXY9Zy1za9Rd</a></td></tr><tr><td align="center"><a href="https://api.ed-fi.org/">Data Hub</a></td><td></td></tr><tr><td align="center"><a href="/pages/k2tDHLc2a8pKNHknsKzM">Data Sync</a></td><td><a href="/pages/k2tDHLc2a8pKNHknsKzM">/pages/k2tDHLc2a8pKNHknsKzM</a></td></tr><tr><td align="center"><a href="/pages/HPi6hLNUMgkXfxUUVf5S">Instructure UI</a></td><td></td></tr><tr><td align="center"><a href="/pages/AinWwAvlZUBclRsccvTV">Journey</a></td><td><a href="/pages/AinWwAvlZUBclRsccvTV">/pages/AinWwAvlZUBclRsccvTV</a></td></tr><tr><td align="center">Mastery Connect</td><td></td></tr><tr><td align="center"><a href="/pages/4zeDeMRph9N7WZolCf5T">New Quizzes</a></td><td><a href="/pages/4zeDeMRph9N7WZolCf5T">/pages/4zeDeMRph9N7WZolCf5T</a></td></tr><tr><td align="center"><a href="/pages/AChtLgWUE3YvZT9jZirD">Parchment Digital Badges</a></td><td></td></tr><tr><td align="center"><a href="https://github.com/portfolium/api/tree/master/application/views/swagger">Portfolium</a></td><td></td></tr><tr><td align="center"><a href="/pages/pZyZsPEQEPBbAzVr26wL">Studio</a></td><td><a href="/pages/pZyZsPEQEPBbAzVr26wL">/pages/pZyZsPEQEPBbAzVr26wL</a></td></tr></tbody></table>
{% endif %}

{% if space.vars.ENVIRONMENT == "internal" %}

<table data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/aspen/aspen.md">Aspen</a></td><td></td></tr><tr><td align="center"><a href="/pages/hMNvLHsRK19WJUXZaPTr">Catalog</a></td><td></td></tr><tr><td align="center"><a href="/pages/OdH6WXwOdmsdyTGIod4C">Canvas LMS</a></td><td><a href="/pages/OdH6WXwOdmsdyTGIod4C">/pages/OdH6WXwOdmsdyTGIod4C</a></td></tr><tr><td align="center"><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/cedar/cedar.md">Cedar</a></td><td></td></tr><tr><td align="center">Certify</td><td></td></tr><tr><td align="center"><a href="/pages/ApvQkaRt2ANytUftFk5a">Commons</a></td><td></td></tr><tr><td align="center"><a href="/pages/Y0gzudpTPXY9Zy1za9Rd">Data Access Platform</a></td><td><a href="/pages/Y0gzudpTPXY9Zy1za9Rd">/pages/Y0gzudpTPXY9Zy1za9Rd</a></td></tr><tr><td align="center"><a href="https://api.ed-fi.org/">Data Hub</a></td><td></td></tr><tr><td align="center"><a href="/pages/k2tDHLc2a8pKNHknsKzM">Data Sync</a></td><td><a href="/pages/k2tDHLc2a8pKNHknsKzM">/pages/k2tDHLc2a8pKNHknsKzM</a></td></tr><tr><td align="center"><a href="/pages/lrnwCe3eccJW7qvLhhc5">Elevate Standards Alignment</a></td><td><a href="/pages/lrnwCe3eccJW7qvLhhc5">/pages/lrnwCe3eccJW7qvLhhc5</a></td></tr><tr><td align="center"><a href="/pages/HPi6hLNUMgkXfxUUVf5S">Instructure UI</a></td><td></td></tr><tr><td align="center"><a href="/pages/AinWwAvlZUBclRsccvTV">Journey</a></td><td><a href="/pages/AinWwAvlZUBclRsccvTV">/pages/AinWwAvlZUBclRsccvTV</a></td></tr><tr><td align="center">Mastery Connect</td><td></td></tr><tr><td align="center"><a href="/pages/IdOfqHHnKRM9EoltRc42">New Quizzes Public</a></td><td><a href="/pages/IdOfqHHnKRM9EoltRc42">/pages/IdOfqHHnKRM9EoltRc42</a></td></tr><tr><td align="center"><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/new-quizzes/internal/api-endpoints.md">New Quizzes Internal</a></td><td><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/new-quizzes/internal/api-endpoints.md">https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/new-quizzes/internal/api-endpoints.md</a></td></tr><tr><td align="center"><a href="/pages/AChtLgWUE3YvZT9jZirD">Parchment Digital Badges</a></td><td></td></tr><tr><td align="center"><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/platform-identity/README.md">Platform Identity</a></td><td></td></tr><tr><td align="center"><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/pine/pine.md">Pine</a></td><td></td></tr><tr><td align="center"><a href="https://github.com/portfolium/api/tree/master/application/views/swagger">Portfolium</a></td><td></td></tr><tr><td align="center"><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/public-product-api/README.md">Public Product</a></td><td><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/public-product-api/README.md">https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/public-product-api/README.md</a></td></tr><tr><td align="center"><a href="https://github.com/instructure/api-docu-portal/tree/prod/gitbook/services/redwood/redwood.md">Redwood</a></td><td></td></tr><tr><td align="center"><a href="/pages/pZyZsPEQEPBbAzVr26wL">Studio</a></td><td><a href="/pages/pZyZsPEQEPBbAzVr26wL">/pages/pZyZsPEQEPBbAzVr26wL</a></td></tr></tbody></table>
{% endif %}

{% if space.vars.ENVIRONMENT == "cd" %}

<table data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><a href="/pages/OdH6WXwOdmsdyTGIod4C">Canvas LMS</a></td><td><a href="/pages/OdH6WXwOdmsdyTGIod4C">/pages/OdH6WXwOdmsdyTGIod4C</a></td></tr></tbody></table>
{% endif %}


# Elevate Standards Alignment - AB Connect

## Welcome

Welcome to the AB Connect interactive documentation. The documentation and related API were developed to help you integrate AB Connect data and decision support services into your system to power the discovery of your content as well as its relationships to academic standards (e.g. alignments) and other content. AB Connect is built upon the most comprehensive collection of connected K-12 standards metadata, machine learning algorithms and subject matter expert validation available.

If you find your users asking questions like the following, AB Connect has a solution for you.

* I have a standard from Texas, is there a similar standard statement in Arizona?
* I have a very useful lesson plan that is aligned to a Florida standard, but I'm teaching in California. What California standard might this lesson plan help me fulfill?
* I have a very useful lesson plan aligned to a Nevada standard. Are there other similar lesson plans aligned to other state standards that I might use?
* I want to create a lesson around the topic of equivalent numbers. Is there instructional material related to this topic that I can use to build my lesson?
* I have an assessment item covering mass and energy equivalence. Is there any instructional material I could use to reinforce this concept?
* I started tagging my assessment items with a few main concepts. What other concepts within standards may be related to these main concepts?
* I have a lesson plan that is covering divisibility rules. What standards across 50 states cover this concept? What other materials cover this concept?
* I have lessons aligned to Ohio's 2011 Science standards and they've just released the 2018 standards. How can I remap my alignments quickly?

This documentation describes the AB Connect API in great detail offering examples and an interactive [Reference section](/services/ab-connect/reference/standards) to get you started right away. We invite you to learn more about AB Connect or take a test drive. [Check out the examples section](/services/ab-connect/introduction/examples) to see working examples built using AB Connect.

*© 2024 Instructure, Inc. All rights reserved.*

## Technical Overview

Version 4.1 of AB Connect is [RESTful](https://en.wikipedia.org/wiki/Representational_state_transfer) and is structurally compliant with [JSON API](http://jsonapi.org/). Since JSON API does not explicitly state syntax of filter statements, Academic Benchmarks adopted a simple filtering syntax based on [ODATA](http://www.odata.org/)'s query $filter. Note that ODATA's syntax is not directly compatible with JSON API but [this discussion thread](http://discuss.jsonapi.org/t/share-propose-a-filtering-strategy/257) was the inspiration for our solution.

## Getting Started

When you send data through the interactive endpoints in the [Reference section](/services/ab-connect/reference/standards), you must authenticate in order to make the call and the responses are handled by a production Academic Benchmarks server so the functionality is real and complete.

If you are already a licensed customer and don't know your credentials or would like to inquire about purchasing a license, please reach out to [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) at Instructure.

If you are not a customer but would like to become familiar with the API, you can request a sandbox account [here](https://community.instructure.com/en/esa-sandbox-request).


# Introduction


# Authentication

In order to use the interactive [Reference section](/services/ab-connect/reference/standards), you will need to properly authenticate. If you do not have credentials, you can [request a sandbox account](https://community.instructure.com/en/esa-sandbox-request). Alternatively, you can inquire about purchasing a license, or request access for your company's account, via [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29).

Once you have your partner ID and key, you can create signatures and start to make calls to the production version of AB Connect. From a high level, the signature is an HMAC SHA-256 hash of a message constructed in a specific format. Use the partner key that is given to you by AB Support for the hash key. The message has one required field (expires - expressed in seconds since epoch) and three optional values: user, method and resource. The delimiter between the fields is a bare newline character (no carriage return) typically denoted as "\n". The generalized form of the message is:

`<expires>[\nuser][\nmethod][\nresource]`

Here are some example messages and their interpretation:

* `1508419888` - Access expires on October 19th 2017 at 1:31:28 PM ET. Note that expirations are expressed in Eastern time in the US.
* `1508419888\nbmarley` - Same expiration time but the signature is only valid for Bob Marley's account. Note that if you supply a user, the user.id field must include the same value in the URL parameters.
* `1508419888\n\nGET` - This signature can only be used for GET HTTP requests. Notice that the method is uppercase. This is a good approach when using AB Connect from public (or customer) facing web clients. It ensures that a hacker can't manipulate your Assets.
* `1508419888\n\nGET\nstandards` - This signature can only be used for GET requests to standards. Notice that the resource is lowercase. If you have a web client that allows users to browse standards but you want to keep your Asset metadata profiles private, this will limit the scope accordingly.

NOTES:

* Each field can have only one value, so you can't mix methods or support multiple endpoints. E.g. if you want to allow read access to both Standards and Topics, you'll need to create two signatures and use the appropriate signature for each call.
* While the expires (`auth.expires`), signature (`auth.signature`) and optionally the user (`user.id`) are included in the URL parameters, the method and resource values are inferred from the actual call being made so there is no need to pass those as URL parameters.
* If you specify a resource, you must specify a method. Allowing "all methods" on one endpoint is not currently supported. So, for example, your message can not look like `1508419888\n\n\nassets`.

Once you have calculated the signature, include the authentication parameters in the URL of your call to AB Connect. The general form of the parameters is:

`&partner.id=<ID>&auth.signature=<signature generated above>&auth.expires=<signature expiry in seconds since epoch>`

or if you are including a user ID:

`&partner.id=<ID>&auth.signature=<signature generated above>&auth.expires=<signature expiry in seconds since epoch>&user.id=<user>`

So if your partner ID is `test_account` and your key is `ajk84Hjk93h59skaAJ8732` and you want to generate a read-only signature that expires on Wed Dec 06 2017 09:20:29 GMT-0500 (Eastern Standard Time)...

* Your message would be: `1512570029\n\nGET`
* Your signature would be a base64 encoding of the HMAC SHA-256 hash of the message: `Sdcfa9xgRAUzQnlLik5nKj1ntqdB85jFYyFCkNxwD/M=`
* URL encoding each parameter value and assembling the parameters together, the authentication portion of the URL would be: `&partner.id=test_account&auth.signature=Sdcfa9xgRAUzQnlLik5nKj1ntqdB85jFYyFCkNxwD%2FM%3D&auth.expires=1512570029`

You can use the following code examples as a starting point for constructing an authentication signature for use when calling AB Connect. Note that these examples do not necessarily follow coding best-practices - e.g. they do not have proper error handling in place. They are intended to be simple examples to show the concepts necessary to perform API authentication. Also note that these examples don't include any method or resource limiters in the signature.

## Best Practices for Web Clients

Due to the nature of web clients, anything available to the client application can be accessed by the user. The user can view the source and use Inspect/Developer mode to access variable values, etc. For this reason, you need to be particularly careful with security measures. If you are accessing AB Connect directly from a web client, consider the following when creating your signatures:

* Keep your partner key secret. Don't send it to the web client for any reason. If someone malicious gets a hold of your partner key, they can create any signature they want at any time they want and do damage to your Asset profiles. If you suspect your partner key has been compromised, contact AB Support and ask to have a new partner key issued.
* Keeping your partner key secure means you need to generate the signature on the server side and embed the signature in the page as it is served to the client. Alternatively, you can create a service that generates signatures on request for your web clients. However, if you do that, you'll need to layer your own security model on top of that to ensure the web client making the request has permissions to access the AB Connect signature.
* Make the life of the signature reasonably short. What is reasonable for your situation is up to you. Perhaps limit read capabilities to an hour and update (POST, PATCH, DELETE) to a few minutes. One thing to consider what is the user experience with the signature expires. Does the page force a re-load to gain a new token? Does it make an authenticated call to your server via AJAX to renew the signature? Does the user need to re-authenticate or do you trust a session cookie?
* Limit the method to the minimum required capabilities. Most web clients will only need read access (e.g. if you are offering the user a Standards or Asset browser). If you need to change permissions, consider creating a separate, short-lived signature for those situations.

## C\#

See also the C# example project in the authentication folder of our [github repository](https://github.com/instructure/abconnect-samples).

```
    using System;
    using System.IO;
    using System.Net;
    using System.Security.Cryptography;
    using System.Text;

    class Program
      {
      static void Main(string[] args)
      {
        var partnerID = "public";                   // ID provided by AB.
        var partnerKey = "2jfaWErgt2+o48gsk302kd";  // Key provided by AB.
        var userID = "Bob";                         // Optional. Partner defined string. Provides access only for queries with this `user.id`.

        // Seconds since epoch. Example is 24 hours.
        var expires = (long)Math.Floor(
          (DateTime.UtcNow.AddHours(24) - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds
        );

        var message = string.Format("{0}\n{1}", expires, userID);

        var keyBytes = Encoding.UTF8.GetBytes(partnerKey);
        var messageBytes = Encoding.UTF8.GetBytes(message);

        string signature;
        using (var hmac = new HMACSHA256(keyBytes))
        {
          signature = Convert.ToBase64String(hmac.ComputeHash(messageBytes));
        }

        var requestBuilder = new UriBuilder("https://api.abconnect.instructure.com/rest/v4.1/standards");
        // user.id is optional
        requestBuilder.Query = string.Format(
          "partner.id={0}&auth.signature={1}&auth.expires={2}&user.id={3}",
          WebUtility.UrlEncode(partnerID),
          WebUtility.UrlEncode(signature),
          expires,
          WebUtility.UrlEncode(userID)
        );

        var request = WebRequest.Create(requestBuilder.Uri);
        Console.WriteLine(new StreamReader(request.GetResponse().GetResponseStream()).ReadToEnd());
      }
    }
```

## Perl

See also the Perl example project in the authentication folder of our [github repository](https://github.com/instructure/abconnect-samples).

```
    #!/usr/bin/perl
    use strict;

    use Digest::SHA qw(hmac_sha256_base64);
    use LWP::UserAgent;

    my $partner_id = 'public';                  # ID provided by AB.
    my $partner_key = '2jfaWErgt2+o48gsk302kd'; # Key provided by AB.
    my $expires = time() + 86400;               # Seconds since epoch. Example is 24 hours.
    my $user_id = 'Bob';                        # Optional. Partner defined string. Provides access only for queries with this `user.id`.

    my $message = "$expires\n$user_id";
    my $signature = hmac_sha256_base64($message, $partner_key);

    my $uri = URI->new();
    $uri->scheme('https');
    $uri->host('api.abconnect.instructure.com');
    $uri->port(443);
    $uri->path('rest/v4.1/standards');
    # user.id is optional
    $uri->query_form(
      'partner.id'     => $partner_id,
      'auth.signature' => $signature,
      'auth.expires'   => $expires,
      'user.id'        => $user_id
    );

    my $req = HTTP::Request->new(GET => $uri);
    my $ua = LWP::UserAgent->new();
    my $response = $ua->request($req);

    print 'response code = '.$response->{_rc}."\n";
    if ($response->{_rc} && ($response->{_rc} == 200)) {
      if ($response->{_content}) {
        print $response->{_content};
      }
    }
```

## PHP

See also the PHP example project in the authentication folder of our [github repository](https://github.com/instructure/abconnect-samples).

```
    <!DOCTYPE html>
    <HTML>
    <HEAD>
    </HEAD>
    <BODY>
      <?php
        $partnerID   = 'public';                  // ID provided by AB.
        $partnerKey  = '2jfaWErgt2+o48gsk302kd';  // Key provided by AB.
        $authExpires = time() + 3600;             // Seconds since epoch. Example is 1 hour.  Keep this shorter due to web exposure.
        $userID      = 'Bob';                     // Optional. Partner defined string. Provides access only for queries with this `user.id`.

        $url = 'https://api.abconnect.instructure.com/rest/v4.1/standards?';

        $url .= 'partner.id=' . $partnerID;
        // "GET" results read only signature to minimize security risks with web client exposure.
        $message = $authExpires . "\n" . $userID . "\n" . "GET";
        $sig = urlencode(base64_encode(hash_hmac('sha256', $message, $partnerKey, true))); // build the signature with the key

        $url .= '&auth.signature=' . $sig;
        $url .= '&auth.expires=' . $authExpires;
        if ($url) {
          $url .= '&user.id=' . $userID;
        }

        print '<H3>Generated Request URL</H3>';
        print '<P>' . $url . '</P><BR />';

        $response = file_get_contents($url);

        print '<H3>JSON Response</H3>';
        print '<P>' . $response . '</P>';
      ?>
    </BODY>
    </HTML>
```

## Python2 (2.5 or Higher)

See also the Python2 example project in the authentication folder of our [github repository](https://github.com/instructure/abconnect-samples).

```
    import time
    import hashlib
    import hmac
    import base64
    import urllib

    partner_id = 'public'                    # ID provided by AB.
    partner_key = '2jfaWErgt2+o48gsk302kd'   # Key provided by AB.
    expires = str(int(time.time() + 86400))  # Seconds since epoch. Example expires in 24 hours.
    user_id = 'Bob'                          # Optional. Partner defined string. Provides access only for queries with this `user.id`.

    message = expires + "\n" + user_id
    digest = hmac.new(partner_key.encode(), message.encode(), digestmod=hashlib.sha256).digest()
    signature = base64.b64encode(digest).decode()
    encoded_sig = urllib.quote_plus(signature)

    # user.id is optional
    parms = 'partner.id=' + partner_id + \
            '&auth.signature=' + encoded_sig + \
            '&auth.expires=' + expires + \
            '&user.id=' + user_id
    result = urllib.urlopen('https://api.abconnect.instructure.com/rest/v4.1/standards?' + parms).read()
    print result
```

## Python 3

See also the Python3 example project in the authentication folder of our [github repository](https://github.com/instructure/abconnect-samples).

```
    import time
    import hashlib
    import hmac
    import base64
    import urllib.request

    partner_id = 'public'                    # ID provided by AB.
    partner_key = '2jfaWErgt2+o48gsk302kd'   # Key provided by AB.
    expires = str(int(time.time() + 86400))  # Seconds since epoch. Example expires in 24 hours.
    user_id = 'Bob'                          # Optional. Partner defined string. Provides access only for queries with this `user.id`.

    message = expires + "\n" + user_id
    digest = hmac.new(partner_key.encode(), message.encode(), digestmod=hashlib.sha256).digest()
    signature = base64.b64encode(digest).decode()
    encoded_sig = urllib.parse.quote_plus(signature)

    # user.id is optional
    parms = 'partner.id=' + partner_id + \
            '&auth.signature=' + encoded_sig + \
            '&auth.expires=' + expires + \
            '&user.id=' + user_id
    result = urllib.request.urlopen('https://api.abconnect.instructure.com/rest/v4.1/standards?' + parms).read()
    print (result)
```

## VB.Net

See also the VB example project in the authentication folder of our [github repository](https://github.com/instructure/abconnect-samples).

```
    Imports System.Security.Cryptography
    Imports System.Text
    Imports System.Net
    Imports System.IO

    Module AuthModule

        Sub Main()
            Dim PartnerId As String = "public"                  ' ID provided by AB.
            Dim PartnerKey As String = "2jfaWErgt2+o48gsk302kd" ' Key provided by AB.
            Dim UserId As String = "Bob"                        ' Optional. Partner defined string. Provides access only for queries with this `user.id`.

            ' Seconds since epoch. Example is 24 hours.
            Dim Expires = Math.Floor(
              (DateTime.UtcNow.AddHours(24) - New DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds
            )
            Dim Message = Expires & vbLf & UserId

            Dim KeyBytes() As Byte = Encoding.UTF8.GetBytes(PartnerKey)
            Dim MessageBytes() As Byte = Encoding.UTF8.GetBytes(Message)
            Dim Signature As String

            Using myHMACSHA256 As New HMACSHA256(KeyBytes)
                Signature = Convert.ToBase64String(myHMACSHA256.ComputeHash(MessageBytes))
            End Using

            Dim RequestBuilder As New UriBuilder("https://api.abconnect.instructure.com/rest/v4.1/standards")
            ' user.id is optional
            RequestBuilder.Query = String.Format(
              "partner.id={0}&auth.signature={1}&auth.expires={2}&user.id={3}",
              WebUtility.UrlEncode(PartnerId),
              WebUtility.UrlEncode(Signature),
              Expires,
              WebUtility.UrlEncode(UserId)
            )

            Dim Request = WebRequest.Create(RequestBuilder.Uri)
            Dim Response As WebResponse = Request.GetResponse()
            Dim ReceiveStream As Stream = Response.GetResponseStream()

            Dim Encode As Encoding = Encoding.GetEncoding("utf-8")

            Dim ReadStream As New StreamReader(ReceiveStream, Encode)
            Dim ReadBuffer(256) As [Char]

            Dim Count As Integer = ReadStream.Read(ReadBuffer, 0, 256)
            While Count > 0
                Dim StringData As New [String](ReadBuffer, 0, Count)
                Console.Write(StringData)
                Count = ReadStream.Read(ReadBuffer, 0, 256)
            End While
            Console.WriteLine("")
        End Sub

    End Module
```

## Java

See also the Java example project in the authentication folder of our [github repository](https://github.com/instructure/abconnect-samples).

```
    package AuthExample;

    import java.io.BufferedReader;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLEncoder;
    import java.util.Base64;
    import java.util.Calendar;
    import java.util.TimeZone;

    import javax.crypto.Mac;
    import javax.crypto.spec.SecretKeySpec;
    import javax.net.ssl.HttpsURLConnection;

    public class program {

      public static void main(String[] args) {
        String partnerID = "public";                   // ID provided by AB.
        String partnerKey = "2jfaWErgt2+o48gsk302kd";  // Key provided by AB.
        String userID = "Bob";                         // Optional. Partner defined string. Provides access only for queries with this `user.id`.

        // Seconds since epoch. Example is 24 hours.
        Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
        long expires = (long)Math.floor(cal.getTimeInMillis() / 1000) + 60*60*24;

        String message = String.format("%d\n%s", expires, userID); // format message for signature

        HttpsURLConnection connection = null;
        try {
          //
          // generate signature and base64 encode it
          //
          Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
          SecretKeySpec secret_key = new SecretKeySpec(partnerKey.getBytes("UTF-8"), "HmacSHA256");
          sha256_HMAC.init(secret_key);
          byte[] hmacBytes = sha256_HMAC.doFinal(message.getBytes("UTF8"));
          String signature = Base64.getEncoder().encodeToString(hmacBytes);
          //
          // pack the signature and other auth parameters in URL
          //
          String targetURL = String.format(
            "https://api.abconnect.instructure.com/rest/v4.1/standards?partner.id=%s&auth.signature=%s&auth.expires=%d&user.id=%s",
            URLEncoder.encode(partnerID, "UTF-8"),
            URLEncoder.encode(signature, "UTF-8"),
            expires,
            URLEncoder.encode(userID, "UTF-8")
            );
          //
          //Create connection
          //
          URL url = new URL(targetURL);
          connection = (HttpsURLConnection) url.openConnection();
          //
          // Get Response
          //
          InputStream is = connection.getInputStream();
          BufferedReader rd = new BufferedReader(new InputStreamReader(is));
          String line;
          while ((line = rd.readLine()) != null) {
            System.out.println(line);
          }
          rd.close();

        } catch (Exception e) {
          e.printStackTrace();
          System.exit(-1);
        } finally {
          if (connection != null) {
            connection.disconnect();
          }
        }
      }
    }
```

## node.js

See also the NodeJS example project in the authentication folder of our [github repository](https://github.com/instructure/abconnect-samples).

```
    #!/usr/bin/env node

    var partner_id = 'public'                             // ID provided by AB.
    var partner_key = '2jfaWErgt2+o48gsk302kd'            // Key provided by AB.
    var expires = Math.floor(Date.now() / 1000) + 86400;  // Seconds since epoch. Example expires in 24 hours.
    var user_id = 'Bob'                                   // Optional. Partner defined string. Provides access only for queries with this `user.id`.
    //
    // Build the signature
    //
    var message = '' + expires;
    if (user_id) {
        message +=  "\n" + user_id;
    }
    var crypto = require('crypto');
    var signature = crypto.createHmac('SHA256', partner_key).update(message).digest('base64')
    //
    // package the signature, expiration, etc. into a URL encoded query string fragment
    //
    var queryString = '&partner.id=' + encodeURIComponent(partner_id) + '&auth.signature=' + encodeURIComponent(signature) + '&auth.expires=' + encodeURIComponent(expires);
    if (user_id) {
        queryString += '&user.id=' + encodeURIComponent(user_id);
    }

    console.log("Authentication parameters: " + queryString);

    var requester = require('sync-request');

    var response;
    var body;
    try {
      response = requester('GET', 'https://api.abconnect.instructure.com/rest/v4.1/standards?' + queryString);
      body = response.getBody('utf-8');
    } catch (e) {
      console.log('' + e);
    }
    if (response) console.log("Response code: " + response.statusCode);
    if (body) console.log("Response body:\n" + body);
```


# Addressing Object Properties

There are several URL Parameters where you will need to name specific properties of an object (like filter and fields). Generally speaking, see the endpoint's Response Attributes section for the properties that are available. Here are a few rules to keep in mind when constructing the property names.

* The name of a property on an object is addressed using dot notation like `object.property`. E.g. `disciplines.grades`
* JSON constructs in AB Connect responses that are inserted simply to adhere to JSON API requirements are not included in the property naming. E.g. if you want to address the `standard_type` of a `standard` object, the name is simply `standard_type` - not `data.attributes.standard_type`. Generally speaking, JSON API keywords can be left out of the names - things like attributes, relationships and data. Note that meta properties on relationships are the acception. We include the `meta` part of the property path to eliminate conflicts between object and relationship property names.


# Requesting Additional Properties in the Response

By default, if the fields argument is not included in the request, AB Connect responds with the object ID and type. In order to request that AB Connect return additional properties in its response, use the `fields` URL parameter. The form is `fields[<type>]=<CSV list of properties>`.

To illustrate the usage, let's take a look at the properties of a Standard and how use of the `fields` parameter affects the system response. Let's begin with the default response.

```
`GET https://api.abconnect.instructure.com/rest/v4.1/standards/1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22`

{
    "links": {
        "self": "https://api.abconnect.instructure.com/rest/v4.1/standards/1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22"
    },
    "data": {
        "type": "standards",
        "id": "1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22"
    },
    "meta": {
        "took": 66
    }
}
```

As you can see, the response does not include much useful information. Let's make the call again asking just for the main text of the Standard, its number and the AB `standard_type`.

```
`GET https://api.abconnect.instructure.com/rest/v4.1/standards/1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22?fields[standards]=statement.descr,standard_type,number.enhanced`

{
    "links": {
        "self": "https://api.abconnect.instructure.com/rest/v4.1/standards/1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22?fields[standards]=statement.descr,standard_type,number.enhanced"
    },
    "data": {
        "attributes": {
            "number": {
                "enhanced": "CCSS.Math.Content.HSN-VM.A.1"
            },
            "standard_type": "objective",
            "statement": {
                "descr": "Recognize vector quantities as having both magnitude and direction. Represent vector quantities by directed line segments, and use appropriate symbols for vectors and their magnitudes (e.g., ?, |?|, ||?||, ?)."
            }
        },
        "type": "standards",
        "id": "1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22"
    },
    "meta": {
        "took": 156
    }
}
```

Conversely, if you really want it ALL, you can use an asterisk to indicate that you want the system to give you EVERYTHING! Note that this can have an impact on system performance so we strongly recommend you use the asterisk only for discovery when you are learning the API. To ensure the use of wildcards with the `fields` parameter does not impact overall system performance, such calls are throttled to 2 per second.

For brevity, we've removed some details in this example as the payload is quite large.

```
`GET https://api.abconnect.instructure.com/rest/v4.1/standards/1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22?fields[standards]=*`

{
    "links": {
        "self": "https://api.abconnect.instructure.com/rest/v4.1/standards/1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22?fields[standards]=%2A"
    },
    "data": {
        "type": "standards",
        "id": "1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22",
        "attributes": {
            "statement": {
                "addendums": [],
                "combined_descr": "Recognize vector quantities as having both magnitude and direction. Represent vector quantities by directed line segments, and use appropriate symbols for vectors and their magnitudes (e.g., 𝙫, |𝙫|, ||𝙫||, 𝘷).",
                "descr": "Recognize vector quantities as having both magnitude and direction. Represent vector quantities by directed line segments, and use appropriate symbols for vectors and their magnitudes (e.g., 𝙫, |𝙫|, ||𝙫||, 𝘷)."
            },
            "label": "Standard",
            "education_levels": {
                "grades": [
                    {
                        "code": "9",
                        "descr": "9th Grade",
                        "guid": "F1FA7154-3B53-11E0-B042-495E9DFF4B22",
                        "seq": 110
                    },
                    {
                        "seq": 120,
                        "guid": "F1FA7E92-3B53-11E0-B042-495E9DFF4B22",
                        "descr": "10th Grade",
                        "code": "10"
                    },
                    {
                        "code": "11",
                        "guid": "F1FA8BD0-3B53-11E0-B042-495E9DFF4B22",
                        "descr": "11th Grade",
                        "seq": 130
                    },
                    {
                        "guid": "F1FA9904-3B53-11E0-B042-495E9DFF4B22",
                        "descr": "12th Grade",
                        "seq": 140,
                        "code": "12"
                    }
                ],
                "ece_ages": []
            },
            "number": {
                "raw": "1.",
                "prefix_enhanced": "CCSS.Math.Content.HSN-VM.A.1",
                "enhanced": "CCSS.Math.Content.HSN-VM.A.1"
            },
            "utilizations": [
                {
                    "guid": "3A6BCD99-F093-4782-9708-5E65F2DEC3F2",
                    "type": "alignable"
                }
            ],
            "in_list": "N",
            "status": "active",
            "captured_by": "AB",
            "deepest" : "Y",
            "disciplines": {
                "subjects": [
                    {
                        "guid": "F1FB2F2C-3B53-11E0-B042-495E9DFF4B22",
                        "descr": "Mathematics",
                        "code": "MATH"
                    }
                ],
                "_content_connections": [],
                "strands": [
                    {
                        "guid": "81C28CFA-046C-11E0-9AE1-661C9DFF4B22",
                        "descr": "Patterns, Functions, and Algebra"
                    }
                ],
                "genres": [],
                "ece_domains": []
            },
            "key_ideas": [
                {
                    "concepts": [
                        {
                            "guid": "0AADCE68-3BA2-11E1-A29D-011A9DFF4B22",
                            "descr": "Vectors"
                        },
                        {
                            "descr": "Mathematical Notation",
                            "guid": "0CB810D8-3BA2-11E1-A29D-011A9DFF4B22"
                        }
                    ],
                    "guid": "75757524-D232-11DE-8EF1-B44B9DFF4B22"
                },
                {
                    "guid": "982B3456-D236-11DE-B34E-394D9DFF4B22",
                    "concepts": [
                        {
                            "descr": "Vectors",
                            "guid": "0AADCE68-3BA2-11E1-A29D-011A9DFF4B22"
                        },
                        {
                            "guid": "0BE351EA-3BA2-11E1-A29D-011A9DFF4B22",
                            "descr": "Vector Direction"
                        }
                    ]
                },
                {
                    "concepts": [
                        {
                            "descr": "Vectors",
                            "guid": "0AADCE68-3BA2-11E1-A29D-011A9DFF4B22"
                        },
                        {
                            "guid": "0BE36E64-3BA2-11E1-A29D-011A9DFF4B22",
                            "descr": "Vector Magnitude"
                        }
                    ],
                    "guid": "982B4BE4-D236-11DE-B34E-394D9DFF4B22"
                }
            ],
            "document": {
                "assessment_year": null,
                "disciplines": {
                    "primary_subject": {
                        "code": "MATH",
                        "guid": "F1FB2F2C-3B53-11E0-B042-495E9DFF4B22",
                        "descr": "Mathematics"
                    }
                },
                "adopt_year": "2010",
                "source_url": "http://www.corestandards.org/Math/",
                "revision_year": "2010",
                "guid": "6C2635F0-6EC0-11DF-AB2D-366B9DFF4B22",
                "date_modified_utc": "2018-02-13 16:26:49",
                "descr": "Mathematics",
                "obsolete_year": null,
                "implementation_year": null,
                "publication": {
                    "guid": "964E0FEE-AD71-11DE-9BF2-C9169DFF4B22",
                    "regions": [
                        {
                            "code": "US",
                            "guid": "91273AE8-F1B9-11E5-862E-0938DC287387",
                            "descr": "United States of America",
                            "type": "country"
                        },
                        {
                            "type": "other",
                            "guid": "A83297F2-901A-11DF-A622-0C319DFF4B22",
                            "descr": "CCSS",
                            "code": "CC"
                        }
                    ],
                    "descr": "Common Core State Standards",
                    "authorities": [
                        {
                            "acronym": "CC",
                            "descr": "NGA Center/CCSSO",
                            "guid": "A83297F2-901A-11DF-A622-0C319DFF4B22"
                        }
                    ],
                    "acronym": null,
                    "source_url": "http://www.corestandards.org/the-standards"
                }
            },
            "topic_organizer": null,
            "has_list": "N",
            "date_deleted_utc": null,
            "section": {
                "_id": 21003,
                "date_modified_utc": "2018-02-13 16:26:49",
                "guid": "25EC8E56-7053-11DF-8EBF-BE719DFF4B22",
                "descr": "High School - Number and Quantity",
                "obsolete_year": null,
                "seq": 2410,
                "assessment_year": null,
                "disciplines": {
                    "primary_subject": {
                        "code": "MATH",
                        "descr": "Mathematics",
                        "guid": "F1FB2F2C-3B53-11E0-B042-495E9DFF4B22"
                    }
                },
                "adopt_year": "2010",
                "implementation_year": null,
                "label": "Conceptual Category",
                "number": null
            },
            "alt_identifiers": [
                {
                    "type": "GUID",
                    "id": "05BAE0DE74104B1AADC31E85AA1A6128",
                    "source": "canonical"
                },
                {
                    "source": "canonical",
                    "id": "http://corestandards.org/Math/Content/HSN-VM/A/1",
                    "type": "URI"
                }
            ],
            "level": 3,
            "date_modified_utc": "2014-06-19 16:36:44",
            "guid": "1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22",
            "seq": 30,
            "extensions": [],
            "uri": "https://api.abconnect.instructure.com/rest/v4.1/standards/1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22",
            "legends": [
                {
                    "symbol_position": "before",
                    "descr": "Additional mathematics that students should learn in order to take advanced courses",
                    "symbol": "+"
                }
            ],
            "standard_type": "objective"
        },
        "relationships": {
            "concepts": {
                "data": [...]
            },
            "derivatives": {
                "data": [...]
            },
            "peers": {
                "data": [...]
            },
            "contexts": {
                "data": [
                    {
                        "type": "standards",
                        "id": "1F9A411A-7053-11DF-8EBF-BE719DFF4B22"
                    }
                ]
            },
            "topics": {
                "data": [
                    {
                        "type": "topics",
                        "id": "9E783750-4445-11E0-9271-67D4D51F4EFC"
                    }
                ]
            },
            "origins": {
                "data": []
            },
            "parent": {
                "data": {
                    "id": "1F9BE786-7053-11DF-8EBF-BE719DFF4B22",
                    "type": "standards"
                }
            },
            "ancestors": {
                "data": [
                    {
                        "type": "standards",
                        "id": "1F9A411A-7053-11DF-8EBF-BE719DFF4B22"
                    },
                    {
                        "id": "1F9BE786-7053-11DF-8EBF-BE719DFF4B22",
                        "type": "standards"
                    }
                ]
            },
            "peer_derivatives": {
                "data": []
            },
            "children": {
                "data": []
            }
        }
    },
    "meta": {
        "took": 152
    }
}
```

See the section on [Addressing Object Properties](/services/ab-connect/introduction/addressing-object-properties) for insight into property names.


# Filtering Using ODATA Like Statements

The main directive for filtering entities in AB Connect is the inclusion of the `filter` parameter in the URL query. This document outlines how to use filtering with AB Connect. Examples are given with different endpoints and objects but the general principles are independent of the object type or endpoint. In any case, the filter limits the results that are returned or updated by the request.

At its simplest, the filtering utilizes the following syntax:

```
`<endpoint URI>?filter[<object of filter>]=<URL encoded filter statement>`
```

E.g. the following URL retrieves alignable 5th grade math Standards from Kentucky.

```
`https://api.abconnect.instructure.com/rest/v4.1/standards?filter[standards]=(disciplines.subjects.code%20eq%20%27MATH%27%20and%20education_levels.grades.code%20eq%20%275%27%20and%20document.publication.authorities.descr%20eq%20%27Kentucky%20DOE%27%20and%20utilizations.type%20eq%20%27alignable%27)`
```

That's a bit messy so let's break it down. The first part is the primary resource endpoint.

```
`https://api.abconnect.instructure.com/rest/v4.1/standards`
```

The next bit is the filter parameter. The square brackets contain the type of object being filtered. In this case, we are limiting the Standards being returned.

```
`filter[standards]`
```

The value of the filter argument is the URL encoded filter string.

```
`(disciplines.subjects.code%20eq%20%27MATH%27%20and%20education_levels.grades.code%20eq%20%275%27%20and%20document.publication.authorities.descr%20eq%20%27Kentucky%20DOE%27%20and%20utilizations.type%20eq%20%27alignable%27)`
```

Let's decode it to make it readable:

```
`(disciplines.subjects.code eq 'MATH' and education_levels.grades.code eq '5' and document.publication.authorities.descr eq 'Kentucky DOE' and utilizations.type eq 'alignable')`
```

That makes it a little more readable and clarifies the intent. The specifics of the field names aren't critical here. See the endpoint specific documentation for an explanation of each field.

## Constructing the Filter Statement

At an atomic level, the most common filter statement appears like `<property> <comparator> '<value>'` but some functions are also supported (e.g. `isempty(<property>)`).

A `<property>` would be any attribute of the object being filtered. Examples of a property for a Standard would be `level` or `status`. Alternatively, a property can be the attribute of a complex property. E.g. for a Standard, `<property>` could also be `number.raw` or `disciplines.subjects.code`.

A `<value>` could be any value appropriate for the property in question. Values are delimited with single quotes.

Together, various operators, properties and values combine to build a logical statements. The following operators are supported by AB Connect in order of decreasing precedence by group.

| Group       | Operation | Description                                                                                                               |
| ----------- | --------- | ------------------------------------------------------------------------------------------------------------------------- |
| Grouping    | `( )`     | Precedence grouping                                                                                                       |
| Primary     | `func()`  | Function call. E.g. `isempty(concepts)` or `query('triangle pythagorean theorem')` - see below for details)               |
| Unary       | `not`     | Logical negation. E.g. `not propertyX in ('a', 'b, 'c')`                                                                  |
| Comparator  | `eq`      | Equals. E.g. `propertyX eq 'apple'`                                                                                       |
|             | `ne`      | Not equals. E.g. `propertyX ne 'fruit'`                                                                                   |
|             | `gt`      | Greater than. E.g. `propertyX gt 5`                                                                                       |
|             | `ge`      | Greater than or equal to. E.g. `propertyX ge 5`                                                                           |
|             | `lt`      | Less than. E.g. `propertyX lt 5`                                                                                          |
|             | `le`      | Less than or equal to. E.g. `propertyX le 5`                                                                              |
|             | `in`      | The value of the specified property is in the supplied list of values. E.g. `propertyX in ('value1', 'value2', 'value3')` |
| Conditional | `and`     | Combine two conditions and return true if both are true, otherwise false. E.g. `propertyX eq 5 and propertyY ne 'A'`      |
|             | `or`      | Combine two conditions and return true if either are true, otherwise false. E.g. `propertyX eq 5 or propertyY ne 'A'`     |

### Notes:

* Inequality operators can be used with date, number and text attributes but the results vary by attribute type. Date attributes filter chronologically. Number attributes filter numerically. Text attributes filter alphabetically.
* Custom attributes can be defined as text or numbers. If you aren't sure of the types for your custom attributes, contact [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) for guidance.
* It is possible to create custom attributes with the same name and different data types in different asset types (or when searching across multiple owners). The treatment of inequalities filtering across multiple data types is deterministic but relatively complex and isn't covered here. Where possible, we recommend you avoid this situation by ensuring your custom attributes don't have name conflicts across data types where possible. For details on the way AB Connect handles filtering across mixed types, contact [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29).

## Building Complex Statements

AB Connect also supports Boolean operations to combine atomic filter statements into complex statements. You can also use parentheses to group statements together.

* `disciplines.subjects.code eq 'MATH' and education_levels.grades.code eq '5'` 5th grade math
* `document.publication.authorities.descr eq 'Kentucky DOE' and not disciplines.subjects.code eq 'MATH'` Standards from Kentucky not related to math
* `(disciplines.subjects.code eq 'MATH' and education_levels.grades.code eq '5') or (disciplines.subjects.code eq 'ELA' and education_levels.grades.code eq '7')` 5th grade math and 7th grade language arts Standards

## Text Filters

One of the major improvements in AB Connect is the text filtering. The text filter is robust, will return results ordered by relevance and includes soft matches like partial matches. The format for text filtering is unique and utilizes a function style notation. There are two formats.

### Filtering a Specific Field

When filtering a particular field, include the field name as well as the value you are filtering for: `query(<field>, <string>)`. For example, to filter for Standards that contain the words "adding" and "fractions" in their statement, the filter would look like:

```
`filter[standards]=(query(statement.descr, 'adding fractions'))`
```

Note that the text filter is a very soft filter and will often return more Standards than you would expect. The results will be ordered by relevance so the top responses are usually the most important. For example, in the query statement above, the system would return Standards that contain the words "adding fractions" first, followed by Standards that contain "adding" or "fractions". It will also return Standards that contain "add", "addition", etc.

To be more specific, break phrases up into separate statements and be explicit about the Boolean operations to join the queries. The following will only return Standards if they contain both "fractions" and some form of derivation of the word "adding".

```
`filter[standards]=(query(statement.descr, 'fractions') and query(statement.descr, 'adding'))`
```

### Filtering Across Multiple Text Fields

To retrieve Standards that have the keywords in any general text field, remove the field name from the query statement: `query(<string>)`. E.g.

```
`filter[standards]=(query('adding fractions'))`
```

When using this approach, the system will search any fields it considers to be a text field. The specific fields vary by endpoint:

* Standards:
  * `statement.descr`
  * `statement.combined_descr`
  * `statement.addendums.descr`
  * `extensions.descr`
  * `legends.descr`
  * Text properties on related entities as described in [Filtering Resources by Properties on Related Resources](/services/ab-connect/introduction/related-objects#filtering-resources-by-properties-on-related-resources)
* Assets:
  * `title`
  * Any custom attributes
  * Text properties on related entities as described in [Filtering Resources by Properties on Related Resources](/services/ab-connect/introduction/related-objects#filtering-resources-by-properties-on-related-resources)
* Topics:
  * `descr`
  * `section.descr`
* Concepts:
  * `descr`
  * `context`

## Filtering by Number in Standards

In Standards documents, numbers are often separated, delimited or decorated with symbols (e.g. "24.B (i)"). Trying to ensure users are typing the numbers EXACTLY as they are entered in the Standards document is difficult. For this reason, AB Connect supports a soft match on the Standards' `number.raw`, `number.enhanced`, `number.prefix_enhanced`, `number.alternate` and `number.root_enhanced` fields when the query function is used. It treats any separator between alphanumeric values as a break between numbers and looks for Standards that match numbers returning results by how closely they match the results. In the example listed earlier, it will return Standards that have numbers that contain 24, B AND i first without regards to the separators used in the filter. It will follow that with Standards that contain two of the three, then Standards that contain any one of the numbers. Filtering for "24.B.i" will return the same results in the same order as filtering for "24-b-i" and "24.B (i)".

## Escaping Single Quotes

In ODATA, literal strings are quoted using single quotes ('). To include a single quote in a string literal in the filter, use a backslash to escape it ('). For example, to search for the word "don't" in Standards, you would use the following filter:

```
`filter[standards]=(query('don\'t'))`
```

## Checking for Empty Properties

Sometimes it is handy to search for properties that are empty. What "empty" means depends on the property type so AB Connect has an `isempty` function that will match true on objects with no properties, arrays with no elements and scalar properties with null values. For example, the following filter will return all assets that are missing a subject.

```
`filter[assets]=isempty(disciplines.subjects)`
```


# Sorting

By default, list results are returned in order of decreasing relevance. However, you can specify a sort field using the `sort` argument in the URL query string. The format of the requests is:

```
`sort[object of sort]=<property name>`
```

E.g.

```
`sort[standards]=number.enhanced`
```

You can specify multiple criteria to ensure that items that may have duplicate values in one property have a secondary sort to guarantee order. E.g.

```
`sort[standards]=number.enhanced,statement.descr`
```

The default behavior is to sort in ascending order by the specified property. However, if you'd like descending order, prepend the property name with a hyphen/minus (U+002D) "-". E.g.

```
`sort[standards]=-number.enhanced`
```

## Notes:

* Custom attributes can be defined as text or numbers. If you aren't sure of the types for your custom attributes, contact [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) for guidance.
* It is possible to create custom attributes with the same name and different data types in different asset types (or when searching across multiple owners). If you sort on custom attributes of different types, ascending sorts put number attribute values above text attribute values. Descending sorts reverse the order. Note that within a given type, numbers are sorted numerically and text attributes are sorted alphabetically.


# Facets

Facets are common filter criteria that will help you present useful filter options to your end users. To request a list of facets for your license and filter criteria, use the facet argument in the GET query. The results are returned in the meta section of the response.

The form of the request is:

`facet=<CSV list of facet attributes>`

Calculating the facet summaries returned in the `meta.facet` section of the response does incur some calculation overhead. It is negligible in most circumstances but you have control over how much faceting the server performs. The URL query parameter `facet_summary` allows you to specify which data fields are processed with the call. A few useful examples:

* `facet_summary=*` - Return all of the facets available for the endpoint. See [Using Facets as an Entry Point for Browsing Assets](#using-facets-as-an-entry-point-for-browsing-assets). Note that using an asterisk can have an impact on system performance so we strongly recommend you use the asterisk only for discovery when you are learning the API. To ensure the use of wildcards with the `facet_summary` parameter does not impact overall system performance, such calls are throttled to 2 per second.
* `facet_summary=<CSV list of facet attributes>` - Return the summaries of the listed facets.

The facets that are available vary by endpoint and licensing. While some facets values offer additional properties, all of them have at least a `guid` and `descr` property. Note that Topic facets also offer information about their parents so a calling application can easily assemble the required tree without the added overhead of calls to the Topics endpoint.

## Using Facets as an Entry Point for Browsing Standards

By way of example, let's examine the facet capability of the Standards endpoint. This can be used as a convenient starting point for users browsing for Standards. It can also be used as a means for examining "categories" of Standards in your license. To get started, if you call the endpoint requesting all facet summaries without any filtering, the system will respond with the types of facets available and the number of elements in each facet. For convenience, we'll set the `limit` to 0 here so the system doesn't bother to respond with any actual Standards because at this point, we are only interested in the facets themselves which come back via the meta portion of the response.

```
`GET https://api.abconnect.instructure.com/rest/v4.1/standards?limit=0&facet_summary=*`

{
    "links": {
        "self": "https://api.abconnect.instructure.com/rest/v4.1/standards?limit=0&facet_summary=*"
    },
    "data": [],
    "meta": {
        "count": 378522,
        "facets": [
            {
                "count": 14,
                "facet": "education_levels.grades"
            },
            {
                "facet": "education_levels.ece_ages",
                "count": 8
            },
            {
                "count": 54,
                "facet": "document.publication.authorities"
            },
            {
                "facet": "disciplines.strands",
                "count": 111
            },
            {
                "facet": "disciplines.subjects",
                "count": 17
            },
            {
                "count": 440,
                "facet": "document"
            },
            {
                "facet": "document.publication.regions",
                "count": 54
            },
            {
                "count": 5542,
                "facet": "section"
            },
            {
                "facet": "disciplines.ece_domains",
                "count": 6
            },
            {
                "facet": "document.publication",
                "count": 163
            }
        ],
        "limit": 0,
        "took": 336,
        "offset": 0
    }
}
```

The facet counts respect both your license limitations and the current filter. In this case, we are not specifying a filter, so the counts reflect our licensing.

If you wanted to build a user interface that offers the user control over each facet in filtering the Standards, you could request the elements for each facet and populate lists with the results. You may find that offering 10 facets is overwhelming for your users so you may want to select a few key facets. Perhaps we start by allowing the users to select an authority and subject. Let's retrieve the details of those two facets. The facet "names" are the values of the `facet` properties - in this case, `document.publication.authorities` and `disciplines.subjects`. Note that you can see in the response above that there are 17 subjects and 54 authorities in this license (although yours will vary). The example response below has been simplified to improve readability.

```
`GET https://api.abconnect.instructure.com/rest/v4.1/standards?facet=document.publication.authorities,disciplines.subjects&limit=0`

{
    "links": {
        "self": "https://api.abconnect.instructure.com/rest/v4.1/standards?facet=document.publication.authorities,disciplines.subjects&limit=0"
    },
    "data": [],
    "meta": {
        "count": 378522,
        "facets": [
            {
                "facet": "disciplines.subjects",
                "details": [
                    {
                        "data": {
                            "descr": "Language Arts",
                            "guid": "F1FAC302-3B53-11E0-B042-495E9DFF4B22",
                            "code": "LANG"
                        },
                        "count": 120749
                    },
                    {
                        "count": 88449,
                        "data": {
                            "descr": "Science",
                            "guid": "F1FB3DD2-3B53-11E0-B042-495E9DFF4B22",
                            "code": "SCI"
                        }
                    },
                    {
                        "count": 85870,
                        "data": {
                            "code": "MATH",
                            "guid": "F1FB2F2C-3B53-11E0-B042-495E9DFF4B22",
                            "descr": "Mathematics"
                        }
                    },
                    {
                        "data": {
                            "code": "SOC",
                            "guid": "F1FB4B38-3B53-11E0-B042-495E9DFF4B22",
                            "descr": "Social Studies"
                        },
                        "count": 83445
                    },
                    {
                        "data": {
                            "code": "SCIT",
                            "descr": "Science and Technology",
                            "guid": "F1FC8A52-3B53-11E0-B042-495E9DFF4B22"
                        },
                        "count": 6638
                    },
                    ...
                ],
                "count": 17
            },
            {
                "details": [
                    {
                        "data": {
                            "acronym": null,
                            "descr": "Virginia DOE",
                            "guid": "912F0480-F1B9-11E5-862E-0938DC287387"
                        },
                        "count": 20833
                    },
                    {
                        "data": {
                            "guid": "9129D578-F1B9-11E5-862E-0938DC287387",
                            "acronym": null,
                            "descr": "Maryland DOE"
                        },
                        "count": 17919
                    },
                    {
                        "data": {
                            "descr": "Pennsylvania DOE",
                            "acronym": null,
                            "guid": "912DF40A-F1B9-11E5-862E-0938DC287387"
                        },
                        "count": 15428
                    },
                    {
                        "data": {
                            "guid": "9127D390-F1B9-11E5-862E-0938DC287387",
                            "descr": "New York DOE",
                            "acronym": null
                        },
                        "count": 14565
                    },
                    {
                        "data": {
                            "acronym": null,
                            "descr": "Georgia DOE",
                            "guid": "91296E80-F1B9-11E5-862E-0938DC287387"
                        },
                        "count": 13192
                    },
                    ...
                ],
                "facet": "document.publication.authorities",
                "count": 54
            }
        ],
        "limit": 0,
        "took": 459,
        "offset": 0
    }
}
```

Once a user has selected an authority (Georgia DOE) and subject (Science), you may want to offer them a list of relevant strands. Note that there are 111 strands in this sample license. Let's limit the scope to Georgia DOE and Science and get the list of relevant strands to offer the user.

```
`GET https://api.abconnect.instructure.com/rest/v4.1/standards?facet=disciplines.strands&filter[standards]=(document.publication.authorities.guid eq '91296E80-F1B9-11E5-862E-0938DC287387' and disciplines.subjects.code eq 'SCI')&limit=0`

{
    "links": {
        "self": "https://api.abconnect.instructure.com/rest/v4.1/standards?facet=disciplines.strands&filter[standards]=(document.publication.authorities.guid%20eq%20%2791296E80-F1B9-11E5-862E-0938DC287387%27%20and%20disciplines.subjects.code%20eq%20%27SCI%27)&limit=0"
    },
    "data": [],
    "meta": {
        "took": 119,
        "facets": [
            {
                "facet": "disciplines.strands",
                "details": [
                    {
                        "count": 1416,
                        "data": {
                            "descr": "Nature of Science",
                            "guid": "81C5F6E2-046C-11E0-9AE1-661C9DFF4B22"
                        }
                    },
                    {
                        "data": {
                            "guid": "81C4A2BA-046C-11E0-9AE1-661C9DFF4B22",
                            "descr": "Life Science"
                        },
                        "count": 353
                    },
                    {
                        "data": {
                            "guid": "81C51DF8-046C-11E0-9AE1-661C9DFF4B22",
                            "descr": "Physical Science"
                        },
                        "count": 296
                    },
                    {
                        "data": {
                            "descr": "Scientific Inquiry",
                            "guid": "81C58A0E-046C-11E0-9AE1-661C9DFF4B22"
                        },
                        "count": 276
                    },
                    {
                        "data": {
                            "guid": "81C62CFC-046C-11E0-9AE1-661C9DFF4B22",
                            "descr": "Earth Science"
                        },
                        "count": 240
                    },
                    {
                        "data": {
                            "guid": "81C5544E-046C-11E0-9AE1-661C9DFF4B22",
                            "descr": "Environmental Science"
                        },
                        "count": 65
                    },
                    {
                        "count": 28,
                        "data": {
                            "descr": "Space Science",
                            "guid": "81C63AA8-046C-11E0-9AE1-661C9DFF4B22"
                        }
                    }
                ],
                "count": 7
            }
        ],
        "limit": 0,
        "count": 2690,
        "offset": 0
    }
}
```

Now you see that there are only 7 relevant strands. One thing to note: the `detail.count` property is the number of Standards that match the associated criteria. For example, there are 28 Space Science related Standards in Georgia.

You can continue this approach to help the user narrow the Standards down to a manageable count and then present them to the user for selection.

## Using Facets as an Entry Point for Browsing Assets

Using faceting on Assets is similar to that of Standards with one major exception. Asset faceting can include custom attributes. E.g. if your Assets represent assessment items and you have an `item_type` field that may contain values like "Multiple Choice", "Essay", etc. you can request the facet summary by explicitly requesting `facet_summary=custom_attributes.item_type` and/or retrieve the details with `facet=custom_attributes.item_type`. The custom attributes may contain unique values (like a URL or external ID) and calculating the facets can impact performance.

## Notes

* Although this section focused on the Standards endpoint as an example, all endpoints except Clarifier support faceting.
* The facet results appear in the meta section of the JSON API response.
* Facet summaries that have high counts (counts in the thousands) may not be exact - they are approximate for performance reasons. If you need an exact count, you must request the facet. The count returned with the facet is accurate as are the counts returned with each facet value.
* If you do not supply a `facet_summary` parameter, the system does not return any facet information.
* If the `facet` or `facet_summary` arguments are combined with filter criteria, the results respect the filter requirements.
* AB Connect does not support paging of facet data.
* When requesting facets with a large number of values (count > 10,000) only the first 10,000 entries are returned. In general faceting on a large number of values has performance implications and should be avoided.
* A quick way to retrieve facet information without cluttering the response with actual Standards data is to use the `limit` argument and set the `limit` to `0`. For example:
  * `https://api.abconnect.instructure.com/rest/v4.1/standards?limit=0&facet_summary=*` returns a minimal set of data including the facets and counts for your license. You can use this as a starting point if you are dynamically building a UI to allow users to select facet criteria.
  * `https://api.abconnect.instructure.com/rest/v4.1/standards?limit=0&filter[standards]=(document.publication.authorities.descr%20eq%20%27Kentucky%20DOE%27)&facet_summary=*` returns the facets and counts for Kentucky DOE Standards.


# Paging Data

All AB Connect v4.1 endpoints deal with lists of data. Unless you are requesting a single element using its GUID (or ID), the response will contain a list - even if there is just a single element in the list. For efficiency reasons, AB Connect breaks the list up into pages. The default page size is 10 elements except for the Clarifier which returns 5 Concepts and 5 Standards by default. The `limit` and `offset` arguments help your application manage the list of data by setting the page size and enabling the application to walk through the pages of the list. This way, you can strike the proper balance between efficiency and performance.

Note that in order to maintain server stability, page sizes are capped at 100 objects per page to prevent resource depletion on the server.

This section illustrates the general use of limit and offset but doesn't go into the details of any given particular endpoint.

## Walking the List

As mentioned above, AB Connect limits the size of a response to 10 elements by default. This limit only applies to the primary list of elements for the endpoint. E.g. the Standards endpoint will break the Standards list into pages. However, if you request the Standards endpoint to include related Concepts, all Concepts related to each Standard will be returned in the single call regardless of length of the Concepts list.

When responding with a list, AB Connect supplies paging URLs in the links section of the response can use the `next` and `previous` links to walk the response list.

```
    {
        "links": {
            "last": "https://api.abconnect.instructure.com/rest/v4.1/<object>?offset=248960",
            "next": "https://api.abconnect.instructure.com/rest/v4.1/<object>?offset=10",
            "self": "https://api.abconnect.instructure.com/rest/v4.1/<object>"
        }
    }
```

The first page of data includes `next` and `last` links. The `next` link supplies the URL to retrieve the next set of data based on your current page size (which is specified by the `limit` argument and defaults to 10). Note the use of the `offset` argument above to support the paging. Offset indicates how far into the list you'd like AB Connect to dive when responding to the request.

One of the middle pages of data should include not just `next` and `last` but also `first` and `previous` links to support bidirectional paging.

```
    {
        "links": {
            "last": "https://api.abconnect.instructure.com/rest/v4.1/<object>?offset=248960",
            "next": "https://api.abconnect.instructure.com/rest/v4.1/<object>?offset=20",
            "first": "https://api.abconnect.instructure.com/rest/v4.1/<object>",
            "self": "https://api.abconnect.instructure.com/rest/v4.1/<object>?offset=10",
            "prev": "https://api.abconnect.instructure.com/rest/v4.1/<object>"
        }
    }
```

If you'd like to make the page responses larger or smaller, you can use the limit parameter. E.g.

```
`https://api.abconnect.instructure.com/rest/v4.1/<object>?...&limit=25`
```

In which case, the number of elements from the list that you receive for each request changes. This is also reflected in the links you get in response in order to enable the system to properly track page size as you navigate the list.

```
    {
        "links": {
            "last": "https://api.abconnect.instructure.com/rest/v4.1/<object>?limit=25&offset=248950",
            "next": "https://api.abconnect.instructure.com/rest/v4.1/<object>?limit=25&offset=25",
            "self": "https://api.abconnect.instructure.com/rest/v4.1/<object>?limit=25"
        }
    }
```

Between these two parameters, you should be able to control how your system receives responses and tune it for optimum performance.

## No Limits

When would you ever want your response to contain 0 elements? In addition to the object data contained in the response, most endpoints can return data in the `meta` object (like facets). If you want to explore the meta object without inducing the overhead of processing data elements in the list, set the `limit` to 0. E.g.

```
`https://api.abconnect.instructure.com/rest/v4.1/standards?limit=0&facet_summary=*`
```

Will return something similar to the following:

```
    {
        "links": {
            "self": "https://api.abconnect.instructure.com/rest/v4.1/standards?limit=0"
        },
        "data": [ ],
        "meta": {
            "offset": 0,
            "limit": 0,
            "took": 232,
            "count": 248969,
            "facets": [
                {
                    "facet": "document.publication.authorities",
                    "count": 54
                    ...
                },
                ...
            ]
        },
    ...
    }
```


# Call Throttling

As adoption of AB Connect increases, We need to ensure all partners have an optimal integration experience. In order to achieve this goal, API controls limit call frequency and payload sizes. Payload sizes have been constrained with a cap on the `limit` for a page (see [Paging Data](/services/ab-connect/introduction/paging) for details on payload constraints). The remainder of this section describes call throttling also known as rate limiting.

To ensure one client can not adversely affect another client's system performance rate limiting has been implemented on a per account basis. The rate limiting uses a [token bucket model backed by Amazon's API Gateway](https://aws.amazon.com/blogs/aws/new-usage-plans-for-amazon-api-gateway/). In summary, each account has a bucket. The system adds 5 tokens to an account's bucket every second and the bucket can hold up to 25 tokens. Each API call an account makes removes one token from the bucket. If you have not made any calls for a period of time and your bucket is full, you can make a burst of up to 25 calls. However, once your bucket is empty, you'll need to wait before making another call or you'll receive an HTTP 429 response.

Some accounts may have different limits and it is possible that these thresholds change over time, so it is recommended that implementation of a client-side throttling solution that is either self-adjusting or is easy to adjust manually. Depending on the client side architecture and implementation language, there may be client side throttling frameworks available that handle the complexity for your system.

If you have a particular need for a larger bucket size or bucket fill rate, contact [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Token%20Bucket) for additional plans.


# Working with Related Object

While the definition of a Standard or Topic can be helpful in adding value to your system, there is a lot of power in the relationships available in AB Connect. E.g. The Topics covered by a Standard are represented by a relationship between the Standard and one or more Topics. Assets are related to Standards when they are aligned. Standards are related to other Standards (like Peers).

AB Connect exposes these relationships via the `data.relationships` property. This section explains how to access the power of these relationships.

## Addressing Meta Properties on Relationships

Some relationships in AB Connect have properties. E.g. Relationships between Assets and Standards have a disposition, prediction score, dates, etc. These properties are represented in the JSON as meta properties on the relationship. AB Connect allows you to address the relationship meta properties for use in either [fields statements](/services/ab-connect/introduction/requesting-additional-properties) or [filter statements](/services/ab-connect/introduction/introduction-to-odata-filters). When referencing these properties, include `meta.` as part of the property path. E.g. `fields[assets]=alignments.meta.date_created_utc`

## Paging Related Objects

Resources can have many related objects - sometimes thousands. In order to maintain system performance, AB Connect limits the number of related objects that are returned when requesting a resource. Use paging on the relationship endpoint to retrieve more (or all) of the related objects.

Some relationships have limited cardinality. E.g. a Standard can have zero or one "parent". Other relationships are not limited but commonly have a small set of related entities. E.g. a Standard typically has a handful of Concepts, however in some extreme situations a Standard may have 50 Concepts. To optimize transmissions, AB Connect will return up to the first 25 related objects but if there are more than 25 related objects, AB Connect returns the first 10 relationships with paging URLs. Note that neither the page size (`limit`) nor the `offset` can be changed at this point - but can be changed on the relationship endpoint.

Here is an example of a response showing a Standard's related Peers and the paging URLs to retrieve more peer data. To get this data, you might make a call like:

```
`https://api.abconnect.instructure.com/rest/v4.1/standards?fields[standards]=peers,statement,number&filter[standards]=not isempty(peers) and utilizations.type eq alignable&include=peers`
```

```
    ...
    {
        "id": "00003506-B001-11DA-93BA-9A7258581090",
        "type": "standards",
        "relationships": {
            "peers": {
                "data": [
                    {
                        "type": "standards",
                        "id": "665CDF54-29E7-11D8-9805-987DA0705AD0"
                    },
                    {
                        "id": "BA13F3EA-29EB-11D8-9212-963E918BB192",
                        "type": "standards"
                    },
                    ...
                    {
                        "type": "standards",
                        "id": "6573F63E-D88E-11D9-8407-9AE6FB2C8371"
                    }
                ],
                "links": {
                    "related": "https://api.abconnect.instructure.com/rest/v4.1/standards/00003506-B001-11DA-93BA-9A7258581090/peers",
                    "next": "https://api.abconnect.instructure.com/rest/v4.1/standards/00003506-B001-11DA-93BA-9A7258581090/peers?offset=10",
                    "last": "https://api.abconnect.instructure.com/rest/v4.1/standards/00003506-B001-11DA-93BA-9A7258581090/peers?offset=80"
                }
            }
        }
    },
    ...
```

To load the next page of Peers related to the Standard (00003506-B001-11DA-93BA-9A7258581090), follow the `next` URL:

`https://api.abconnect.instructure.com/rest/v4.1/standards/00003506-B001-11DA-93BA-9A7258581090/peers?offset=10&fields[standards]=statement,number`

### Notes

* The data available on the relationship endpoints is a conflation between the related object (attributes and relationships) and the relationship properties (meta).
* Objects returned on the relationship endpoint do not support accessing *their* relationships nor including the further related data. For example, when viewing an Asset, you can see the alignments for that Asset, include related aligned Standards and page through the alignments at the relationship endpoint (assets/GUID/alignments). However, when you are viewing the properties of the aligned Standards on the alignment endpoint (assets/GUID/alignments), you can not include peers to those alignments nor can you page the peer standards. If you need to dig deeper into the aligned standards, you must request the data via the Standards endpoint.
* See [the sections on relationships](/services/ab-connect/reference/relationships) for details on working with the relationship endpoints.

## Including Related Resource Properties

The JSON API standard supports an `include` argument in the query string. The value of the `include` argument is a comma separated list of relationships on the specified endpoint. If the `include` statement appears in the query string, the resources returned in the `relationships` section and named in the statement are included in the response. This helps the caller avoid a second set of calls to retrieve the object details.

Note that it is important that you specify the **relationship** name in the `include` statement rather than the object type. For example, when retrieving Standards there are a number of relationships that are available: `parent`, `ancestors`, `children`, `derivatives`, `origins`, `associations`, etc. Most of them are relationships to other Standards. If you asked the system to include "standards", it would not know which set you are actually requesting. You must explicitly request `children` (for example).

The generic form of the statement is:

```
`<endpoint URI>?include=<CSV list of relationships>`
```

For example:

```
`https://api.abconnect.instructure.com/rest/v4.1/topics/2CED2B98-4FD7-11E0-964D-6C069DFF4B22?fields[topics]=standards&include=standards`
```

Will return the details of the Standards related to the requested Topic.

### Notes:

* If you include a relationship that does not appear in the request as a "relationship" by being included through the fields argument then the include block will be left out of the response.
  * E.g. `https://api.abconnect.instructure.com/rest/v4.1/standards/1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22?include=ancestors` will **NOT** return the `ancestors` resources because that relationship is not delivered.
  * E.g. `https://api.abconnect.instructure.com/rest/v4.1/standards/1F9D5A8A-7053-11DF-8EBF-BE719DFF4B22?fields[standards]=ancestors&include=ancestors` will have the `ancestors` listed in the relationships and their details in the `included` block

## Filtering Related Objects

Sometimes it is convenient to filter the objects that are returned in the relationship. Meta properties on the relationship can always be used in filtering related objects. However, there are some scenarios where it is helpful to filter the related objects on key properties. E.g. one may only be interested in California Standards aligned to an Asset. To implement filtering related objects on all properties presents architectural challenges so to strike a balance and facilitate common use cases, AB Connect allows the caller to filter related object on specific properties on certain relationships.

When filtering on related objects, use the *relationship* name in the filter statement. E.g.

```
https://api.abconnect.instructure.com/rest/v4.1/assets?filter[assets]=disciplines.subjects.code eq 'MATH'&filter[alignments]=document.publication.authorities.guid eq '912830F6-F1B9-11E5-862E-0938DC287387' AND meta.date_created_utc gt '2020-03-12'
```

Will return math Assets and the `alignments` relationship for each Asset will only include Texas Standards aligned after March 12th 2020.

### Filtering Objects Related to Assets

This section describes properties that can be be used when filtering objects related to the Asset.

#### Aligned Standards

When filtering aligned Standards, use the *relationship* name in the filter statement. E.g.

```
...&filter[alignments]=document.publication.authorities.guid eq '912830F6-F1B9-11E5-862E-0938DC287387'&...
```

Supported properties include:

* `ancestors.id`
* `concepts.context`
* `concepts.descr`
* `disciplines.subjects.descr`
* `disciplines.subjects.guid`
* `document.descr`
* `document.guid`
* `document.publication.descr`
* `document.publication.guid`
* `document.publication.authorities.descr`
* `document.publication.authorities.guid`
* `document.publication.regions.descr`
* `document.publication.regions.guid`
* `education_levels.grades.descr`
* `education_levels.grades.guid`
* `number.raw`
* `number.enhanced`
* `number.prefix_enhanced`
* `section.guid`
* `section.descr`
* `status`
* `statement.descr`
* `topics.descr`

Notes:

* `deleted_alignments` are filterable in a similar fashion as `alignments`.
* You can use any of the "meta" properties on the relationship in the filtering - e.g. `meta.score`, `meta.tags`, etc. See the relationship definition for a complete list of meta properties.

#### Topics

Only data associated with accepted and predicted Topics are filterable. Filtering on Topics properties will not return any rejected Topics. The only supported property is the Topic description.

Note that the relationship and type of Topics is the same in this instance:

```
...&filter[topics]=query(descr,'square')&...
```

#### Concepts

Only data associated with central and relevant Concepts are filterable. Filtering on Concept properties will not return any not\_applicable or avoid Concepts. The only supported properties are the Concept description and context.

Note that the relationship and type of Concepts is the same in this instance:

```
...&filter[concepts]=query(descr,'square') AND query(context,'exponents')&...
```

### Filtering Concepts Related to Standards

When retrieving Concepts related to a Standard, you can filter the list on context and description.

```
...&filter[concepts]=query(descr,'square') AND query(context,'exponents')&...
```

## Filtering Resources by Properties on Related Resources

One common need is to search across object relationships - for example, search for Assets based on properties of related Standards. Since this is a common need, AB Connect supports searching Assets based on key properties of related entities. E.g.

```
`filter[assets]=(alignments.document.publication.authorities.descr eq 'California DOE')`
```

This will return Assets aligned to Standards in California. This can be combined with other properties on the Asset or related entities. E.g. to find Assets related to California Standards on a particular Topic

```
`filter[assets]=(alignments.document.publication.authorities.descr eq 'California DOE' and alignments.topics.descr eq 'Exponents and Roots')`
```

And combining that with Asset properties...

```
`filter[assets]=(alignments.document.publication.authorities.descr eq 'California DOE' and alignments.topics.descr eq 'Exponents and Roots' and education_levels.grades.code eq '8')`
```

The text fields on the related entities are also indexed with the Asset full text search. This strengthens the Asset full text search in two ways.

1. When searching Assets for a key word or phrase, the engine will respond with Assets that are associated with that word or phrase through relationships and not just with the Asset properties.
2. Full text search results include the text of related entities when ranking results. E.g. If an Asset is related to multiple Concepts, Topics or Standards that contain the word "triangle" it will appear higher in the search results than an Asset that only mentions the word in a text field or has a few related entities that contain "triangle".

The following list shows related entity properties that can be included in an Asset search:

* Standards
  * `alignments.ancestors.id`
  * `alignments.concepts.context` - this field is also included in full text searches once for each Standard that has this Concept in a Key Idea
  * `alignments.concepts.descr` - this field is also included in full text searches once for each Standard that has this Concept in a Key Idea
  * `alignments.document.disciplines.subjects.descr`
  * `alignments.document.disciplines.subjects.guid`
  * `alignments.document.descr` - this field is also included in full text searches
  * `alignments.document.guid`
  * `alignments.document.publication.descr` - this field is also included in full text searches
  * `alignments.document.publication.guid`
  * `alignments.document.publication.authorities.descr`
  * `alignments.document.publication.authorities.guid`
  * `alignments.document.publication.regions.descr`
  * `alignments.document.publication.regions.guid`
  * `alignments.education_levels.grades.descr`
  * `alignments.education_levels.grades.guid`
  * `alignments.number.raw`
  * `alignments.number.enhanced`
  * `alignments.number.prefix_enhanced`
  * `alignments.section.guid`
  * `alignments.section.descr` - this field is also included in full text searches
  * `alignments.status`
  * `alignments.statement.descr` - this field is also included in full text searches
  * `alignments.topics.descr` - this field is also included in full text searches once for each Standard that covers this Topic
* Topics - Only data associated with accepted and predicted Topics are searchable on the Asset
  * `topics.descr` - this field is also included in full text searches
* Concepts - Only data associated with central and relevant Concepts are searchable on the Asset
  * `concepts.context` - this field is also included in full text searches
  * `concepts.descr` - this field is also included in full text searches

Notes:

* Assets can be filtered by `deleted_alignments` properties in a similar fashion as `alignments`, however, no `deleted_alignments` properties are included in an Asset's full text search.
* The Academic Benchmarks Topics and Concepts are licensed separately. See the section on [Licensing Considerations](/services/ab-connect/introduction/licensing) for a discussion on the licensing required for access to those taxonomies.

It is also possible to search on the properties of the relationship between Assets and entities with simple relationships to Assets (Standards, Topics, Concepts, etc.). In order to do that, address the relationship properties as if they were properties on the related entity itself. E.g. you can filter on accepted Standards with `alignments.meta.disposition eq 'accepted'`. To search for Assets that have accepted relationships with a specific standard, your filter statement will look like:

```
`filter[assets]=(alignments.id eq '0029A5C3-3C0C-4127-9766-C44E5E255C26' and alignments.meta.disposition eq 'accepted')`
```

Note that you can use any of the "meta" properties on the relationship in the filtering - e.g. `alignments.meta.score`, `alignments.meta.tags`, etc. See the relationship definition for a complete list of meta properties.

### Filtering Standards and Relationships

Like Assets, Standards can also be filtered by some key properties on related entities. The following list shows related entity properties that can be included in a Standard search:

* Concepts
  * `concepts.context` - this field is also included in full text searches
  * `concepts.descr` - this field is also included in full text searches

### Filtering by Other Properties and Relationships to Other Resources

To search for resources by properties on related entities other than those listed above, use the search capability to locate the related entities of interest, build a list of related entities and then search the resource by the related entity IDs. For example, if you'd like to find Standards in Virginia that cover Exponents in the 8th grade, first search for the Topic. Topics are grade banded so you'll want to include the grade in your filter to ensure you are getting the correct Topic for the grade.

```
`filter[topics]=(query(descr, 'exponents') and education_levels.grades.code eq '8')`
```

The result is Topic `06EA4018-32ED-11E0-8DE3-079AD51F4EFC`. Then search the Standards for items in Virginia related to this Topic.

```
`filter[standards]=(document.publication.authorities.descr eq 'Virginia DOE' and education_levels.grades.code eq '8' and topics.id eq '06EA4018-32ED-11E0-8DE3-079AD51F4EFC')`
```

If the result of the first search resulted in multiple related Topics (say you also wanted to include Standards related to "Problem Solving"), you can include them all in the Standards filter using the "IN" clause. E.g.

```
`filter[standards]=(document.publication.authorities.descr eq 'Virginia DOE' and education_levels.grades.code eq '8' and topics.id in ('06EA4018-32ED-11E0-8DE3-079AD51F4EFC','067C7C8E-EBE5-11E5-AE48-F5189AAB8BA3'))`
```

Although we use Standards and their relationships to Topics in this example, the same approach can be taken for searching for any objects based on their relationship to other objects. E.g.

* Locating Standards related to Concepts or other Standards
* Locating Topics related to Standards or other Topics
* Locating Assets related to other Assets or to properties of Standards, Topics or Concepts not listed above.

When searching across relationships and specifying the filter criteria, the filter property name is based on the relationship rather than the related object type. For example, `standards` is a resource type and the Standards endpoint has relationships with other Standards. However, those relationships are named `parent`, `ancestors`, `origins`, `derivatives`, `children`, `peers`, etc. If the filter referenced the *type* instead of the relationship *name*, the filter would read `filter[standards]=(standards.id eq 'F97EA8C2-D9AE-11E2-8230-99ABD51F4EFC')` and the system would have no way to know which relationship you were filtering on. Instead, if you were looking for Standards that were under a given Standard (i.e. Standards that had a certain Standard as an `ancestor`) the proper filter notation would be `filter[standards]=(ancestors.id eq 'CB411CD4-D90D-11E2-8BD3-EF629DFF4B22')`.


# Error Responses

Errors are returned as HTTP codes in the 4XX range. All errors are accompanied by a JSON response that provides the details of the error so corrective action can be taken.

```
    {
      "errors": [
        {
          "source": {
            "pointer": "a JSON Pointer RFC6901 to the associated entity in the request document E.g. \"/data\" for a primary data object, or \"/data/attributes/title\" for a specific attribute.",
            "parameter": "a string indicating which URI query parameter caused the error."
          },
          "detail": "<long error message>",
          "status": "<error code - same as HTTP status code>",
          "title": "<brief error message - typically same as the HTTP status title>"
        },
        ...
      ]
    }
```

See the documentation for the individual endpoint for the specifics of the errors that apply to that endpoint.


# Character Set Support

### Licensing Considerations

Access to the Academic Benchmarks data and services is licensed by breadth of coverage (authority and subject area) as well as depth of metadata and functionality. If you attempt to access a feature or piece of data and receive a 401 error, check your credentials and the details of the error message body. It may be that your current license does not support the call you are making. In some instances, you'll get a valid response, but the data related to one of these features will simply not be included in the response. E.g. if you are licensed for Standards, but not Topics, when you retrieve a Standard the `topics` relationship will not exist.

To clarify or discuss your licensing, contact [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) at Instructure or your sales representative.

### Character Set Support

UTF-8 is the recommended character set for transmitting data using AB Connect - AB Connect stores data in UTF-8 and it is the most common character set on the web. However, as adoption for Unicode and UTF-8 has evolved over the life of Academic Benchmarks, we've built support for a few other character sets to support legacy situations. AB Connect supports RESPONSES in UTF-8, latin1, ISO-8859-1 or Windows-1252 character sets.

**Note that at this time AB Connect does not support REQUESTS in any character set other than UTF-8.**

To request a specific character set response, include the `Accept-Charset` HTTP header in your request and supply one of the supported values:

* utf-8
* iso-8859-1
* latin1
* windows-1252

In the case that utf-8 is desired, there is no need to actually include the `Accept-Charset` header as utf-8 is the default.

The AB Connect response includes a `Content-Type` header indicating the data type (application/json) as well as the character set of the response. E.g.

```
`Content-Type: application/json; charset=utf-8`
```


# Licensing Considerations

Access to the Academic Benchmarks data and services is licensed by breadth of coverage (authority and subject area) as well as depth of metadata and functionality. If you attempt to access a feature or piece of data and receive a 401 error, check your credentials and the details of the error message body. It may be that your current license does not support the call you are making. In some instances, you'll get a valid response, but the data related to one of these features will simply not be included in the response. E.g. if you are licensed for Standards, but not Topics, when you retrieve a Standard the `topics` relationship will not exist.

Similarly, the `associations` relationship on Standards provides Satchel Rosetta Exchange CASE identifiers and requires a Professional license. See the [Associations (Satchel Rosetta)](/services/ab-connect/reference/associations) reference for details.

To clarify or discuss your licensing, contact [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) at Instructure or your sales representative.


# How To Articles, Recommendations and Suggestions

## How to Navigate the Standards Organizational Structure

Standards are organized hierarchically under *authorities*. An authority is an organization that has defined a set of academic Standards (e.g. Alabama DOE or NGA Center/CCSSO). Authorities have groups of Standards that we refer to as *publications*. Publications typically cover multiple subject areas. An example of a publication is New York's Next Generation Learning Standards. It covers both math and ELA. Within a publication, we organize Standards into *documents* based on subject and adoption year. So within New York's Next Generation Learning Standards, one of the documents is Mathematics 2017. Each document is organized into *sections*. A section is a group in the document that covers the Standards for a particular set - typically a grade (e.g. 2nd Grade) or course (e.g. Algebra II). Once you've gotten to the section level, the rest of the data is organized into a hierarchical structure of the Standards by level and are related by parent/child relationships. Let's walk through an example:

First, to retrieve a list of authorities in your license, use faceting and list the authorities (`document.publication.authorities`). E.g.:

```
`https://api.abconnect.instructure.com/rest/v4.1/standards?facet=document.publication.authorities&limit=0&filter[standards]=status EQ 'active'`
```

The results from that call will include a set of authority facets in the `meta.facet` part of the JSON. For this example, let's look at the New York Standards.

```
    ...
    {
        "data": {
            "guid": "9127D390-F1B9-11E5-862E-0938DC287387",
            "acronym": null,
            "descr": "New York DOE"
        },
        "count": 20047
    },
    ....
```

Now that you have the GUID for the New York DOE authority, you can use that to narrow your focus to NY and request publications.

```
`https://api.abconnect.instructure.com/rest/v4.1/standards?filter[standards]=(document.publication.authorities.guid EQ '9127D390-F1B9-11E5-862E-0938DC287387' AND status EQ 'active')&facet=document.publication&limit=0`
```

We'll pick the Next Generation Learning Standards and look at the documents.

```
    ...
    {
        "count": 2650,
        "data": {
            "title": "Next Generation Learning Standards",
            "acronym": null,
            "guid": "4D7B5584-9C82-11E7-8A3F-4EABBF03DF2F",
            "descr": "Next Generation Learning Standards"
        }
    },
    ...
```

Let's take that publication GUID and look for related documents.

```
`https://api.abconnect.instructure.com/rest/v4.1/standards?filter[standards]=(document.publication.guid EQ '4D7B5584-9C82-11E7-8A3F-4EABBF03DF2F' AND status EQ 'active')&facet=document&limit=0`
```

Let's focus on the math document.

```
    ...
    {
        "count": 1300,
        "data": {
            "descr": "Mathematics",
            "adopt_year": "2017",
            "guid": "49C1ACA6-9CC6-11E7-8E55-D1F6CCC8CA83"
        }
    }
    ...
```

With the math document GUID, you can list the related sections.

```
`https://api.abconnect.instructure.com/rest/v4.1/standards?filter[standards]=(document.guid EQ '49C1ACA6-9CC6-11E7-8E55-D1F6CCC8CA83')&facet=section&limit=0`
```

Let's look at the Algebra II section.

```
    ...
    {
        "count": 149,
        "data": {
            "guid": "48382382-9CC7-11E7-BC16-0295BF03DF2F",
            "descr": "Algebra II",
            "seq": 2430
        }
    },
    ...
```

Now we are ready to start to navigate the Standards. To start that process, look for Standards in the Algebra II section. The Standards are organized in a hierarchy but are not necessarily returned in that order so limit the response to the top level of the hierarchy and sort by the sequence so you are reproducing the section as a user would expect to see it. If you are using these calls to build a tree in a UI, you may want to request the `children` property be included in the response so your front-end code can decide whether or not to add an icon to allow the browser to expand this Standard to show its children. I'll leave it out of this example so I don't clutter the data response, but you could include that information using a fields parameter in the URL like: `fields[standards]=seq,number,statement,children`.

```
`https://api.abconnect.instructure.com/rest/v4.1/standards?filter[standards]=(section.guid eq '6C23310C-6EC0-11DF-AB2D-366B9DFF4B22' and level eq 1)&sort[standards]=seq&fields[standards]=seq,number,statement,children`
```

We'll ignore data paging here and assume that you can manage that part. Looking at the results, there are only a couple of branches at this level. We've simplified the data here to make it easier to read:

```
    ...
    {
        "attributes": {
            "number": {
                "raw": "5.OA",
                "enhanced": "CCSS.Math.Content.5.OA",
                "prefix_enhanced": "CCSS.Math.Content.5.OA",
                "alternate": "5.OA"
            },
            "statement": {
                "addendums": [],
                "descr": "Operations and Algebraic Thinking",
                "combined_descr": "Operations and Algebraic Thinking"
            }
        },
        "id": "1D9D7C1A-7053-11DF-8EBF-BE719DFF4B22",
        "type": "standards"
    },
    {
        "type": "standards",
        "id": "1DACEABA-7053-11DF-8EBF-BE719DFF4B22",
        "attributes": {
            "statement": {
                "combined_descr": "Number and Operations in Base Ten",
                "descr": "Number and Operations in Base Ten",
                "addendums": []
            },
            "number": {
                "raw": "5.NBT",
                "enhanced": "CCSS.Math.Content.5.NBT",
                "prefix_enhanced": "CCSS.Math.Content.5.NBT",
                "alternate": "5.NBT"
            }
        }
    }
    ...
```

Now that we have the top level of Standards, we need to look at the children Standards. We'll start with the Operations and Algebraic Thinking branch and look for its children by searching for Standards that have this particular Standard as a parent. Again, we are sorting by the sequence order.

```
`https://api.abconnect.instructure.com/rest/v4.1/standards?filter[standards]=(parent.id eq '1D9D7C1A-7053-11DF-8EBF-BE719DFF4B22')&sort[standards]=seq&fields[standards]=seq,number,statement,children`
```

The results look something like the data below (again simplifying the response for clarity).

```
    ...
    {
        "attributes": {
            "number": {
                "raw": null,
                "prefix_enhanced": "CCSS.Math.Content.5.OA.A",
                "enhanced": "CCSS.Math.Content.5.OA.A",
                "alternate": "5.OA.A"
            },
            "statement": {
                "combined_descr": "Write and interpret numerical expressions.",
                "addendums": [],
                "descr": "Write and interpret numerical expressions."
            }
        },
        "id": "1D9F7E02-7053-11DF-8EBF-BE719DFF4B22",
        "type": "standards"
    },
    {
        "attributes": {
            "number": {
                "prefix_enhanced": "CCSS.Math.Content.5.OA.B",
                "enhanced": "CCSS.Math.Content.5.OA.B",
                "raw": null,
                "alternate": "5.OA.B"
            },
            "statement": {
                "descr": "Analyze patterns and relationships.",
                "addendums": [],
                "combined_descr": "Analyze patterns and relationships."
            }
        },
        "id": "1DA6C82E-7053-11DF-8EBF-BE719DFF4B22",
        "type": "standards"
    }
    ...
```

Now you can repeat that process for each Standard in this list - searching for Standards that have each of these as parents - until you reach the bottom of the hierarchy. As you do this, there are a few things to keep in mind:

* Most documents are not consistent in the number of levels they have. The bottom level is often the level that represents a single learning objective but sometimes the bottom is an example and the level above is the objective.
* Check the `utilization.type` of a Standard to validate its usage. `alignable` Standards are the learning objectives. These typically have Key Ideas, Topics and Concepts associated with them.

## Special Considerations When Rendering Standards In User Interfaces

### Representing Standards As Chips

A common modern user interface element in selection scenarios is the "chip". A chip is a compact element that typically represents a more complex object in a tight space. If you are not familiar with chips, you can see examples on the [Material Design site](https://material.io/design/components/chips.html#input-chips). The dominant attribute of chips is compactness. For this reason, the representation of a Standard as a chip is challenging. We find that using the enhanced (or pre-fix enhanced) number is the best representation of a standard on a chip combined with hover text or an info icon to allow the user to easily find a more complete definition of the Standard.

Be aware that numbers are not guaranteed to be unique and some Standards do not have numbers. When working with Standards that aren't numbered, you may want to fallback to showing the first 10-15 characters of the text. While that is not likely to be too informative, when you combine it with the ability to see more details about the standard, it should be enough for a user to understand its usage.

### Handling Standards That Have Lists and Addenda

Standards with addenda with `position` set to `after` that have `has_list` set to `Y` are very rare, but they do occur periodically, and the rendering requires special treatment. In this case, addenda with `position` set to `after` should be displayed after the list of items. The final rendering is determined by your application, but here is an example and two likely renderings.

* Statement: Determine the equation of a linear relation, given:
  * Before Addendum: It is expected that students will:
  * After Addendum: to solve problems.
  * Child List Standards:
    * a graph
    * a point and the slope
    * two points
    * a point and the equation of a parallel or perpendicular line

## Working With Deleted Standards

Standards are occasionally deleted when the authority makes changes that impact the intent of the Standard. When this happens, the Standard is deleted and the related GUID is "retired" so the integrity of related alignments is not tarnished by a change in the intent of the Standard. You can still access these Standards via AB Connect but there are a couple of things to keep in mind:

* When looking up a standard by GUID (`https://api.abconnect.instructure.com/rest/v4.1/standards/<GUID>`), the system will respond with the standard regardless of whether it is deleted or not.
* When filtering Standards, deleted Standards are excluded from filter results unless the filter criteria explicitly includes Standards with `deleted` status. E.g. `status EQ 'deleted'` or `status IN ('active','deleted')`
* AB Connect tracks deleted Standards back to January 2008. Due to the evolution of the AB Connect data model, the amount of metadata available on deleted standards varies over time. Standards deleted in January 2008 have less metadata than modern standards.

## How To Populate Your Local Cache With AB Connect Data

Many AB Connect customers cache the data locally to support analytics and other operations that require performant combination of AB Connect data with local data. This article discusses the options for downloading that initial cache.

The first consideration is when your v4.1API access was enabled vs. when you became an Academic Benchmarks partner. If you are a new partner, the easiest approach is to implement use of the Events endpoint and start with `seq GT 0`. This will download all events as each document is added to your license and you can use these events to populate your local cache. See Using Events As A New Partner in the [Events documentation](/services/ab-connect/reference/events) for more details.

However, if you were a partner before v4.1was enabled for your account (or you became a customer before November 2018), the initial events to add documents to your license don't exist. In that case, a common approach is to have your system [Navigate the Standards Organizational Structure](#how-to-navigate-the-standards-organizational-structure) and cache the Standards as the system walks the structure.

## How To Efficiently Update Your Local Cache With The Latest AB Connect Data

Many Academic Benchmarks partners opt to take advantage of AB Connect's fast search architecture to directly power their system search, standards and alignment activities while others prefer to cache the data locally. If you cache data, AB Connect has solutions that make updates and workflows like alignment maintenance efficient.

### Standards Updates

Standards evolve over time. Authorities frequently make minor changes to individual standards and periodically adopt new documents that replace existing standards. When a new document is adopted, it may be added to your standards delivery. Either way, it is important that you keep your cache fresh. While it is possible to purge your cache and retrieve the entire set of Standards periodically, that is inefficient and does not support the maintenance of alignments and other related data. It is more efficient and useful to request differential updates. With AB Connect, you do this using the `events` endpoint. You can read more about Events and keeping your cache current in the section on the [Events endpoint](/services/ab-connect/reference/events).

### Alignment Updates

As standards evolve and your content library changes and expands, you will need to update your local storage of alignments. See the paragraph titled "Locating Recent Changes to Relationships Between Assets and Standards" in the [Managing and Predicting Relationships](https://developerdocs.instructure.com/services/ab-connect/introduction/pages/YcYUS1ZchguVbdEtyBoO#managing-relationships-between-assets-and-standards#creating-relationships) section for information on retrieving alignment changes.

### Asset Updates

If AB Connect is the system of truth for your content's metadata profiles, you can update your cache by locating and retrieving modified Assets. The following filter returns assets updated since September 2018.

```
  /assets?filter[assets]=(date_modified_utc gt '2018-09-12 12:00:00')
```

## How To Map Alignments From One Document To Another

Content publishers often partner with Academic Benchmarks as they expand their offerings by bringing content to new market segments and geographies through alignment to new standards. With such expansion, many publishers experience the challenge of aligning content and maintaining alignments across multiple states and authorities. AB Connect offers a wide array of metadata and functionality to assist. There are a couple of approaches you can take using AB Connect to address this challenge.

### Relationships

AB Connect includes standards relationships, which allow publishers to leverage existing standards alignments and expedite alignment of content from one authority to another, or across multiple states and markets segments. The advantage of this approach is a degree of automation that can drastically reduce the number of correlations that need to be hand reviewed.

#### Crosswalks

Some standards documents have direct relationships to other documents - either historical (2021 document replaces the 2017 document) or from other authorities (a state derives its standards from the Common Core). For documents without a data relationship or a state published relationship to other standards, Academic Benchmarks subject matter experts curate a crosswalk relationship. E.g. Texas standards are not related to the Common Core. Academic Benchmarks curates relationships between various documents and captures the relationships in the Crosswalks field.

Standards related as Crosswalks share at least one skill. Crosswalks are based on close relationships where they are established by the authority and hand curation where they are not. Not all documents are directly crosswalked to every other document. At the time of the writing of this documentation, math, science and ELA in the US should all be mapped to at least one common document but the scope of coverage in subjects and regions will continue to expand. You can use the `predictions` endpoint to help get Crosswalks between documents that are not directly connected. See [Generating Predictions](/services/ab-connect/reference/relationships#generating-predictions) for details.

Note that Crosswalks are not available on all accounts. See the section on [Licensing Considerations](/services/ab-connect/introduction/licensing) for a discussion on the licensing required for access to Crosswalks.

#### Derivatives

If your content is aligned to a national document, you can use the Derivatives Relationship on the national standards to locate standards in a derived document - E.g. Common Core Math to California Common Core Content Standards.

Derivatives carry two key pieces of metadata to assist with automation: "same text" and "same Concepts." The former is true ("Y" in the API data model) if the standard in the national document is character for character the same as the standard in the derived document. The latter is true if the standard in the national document covers the same concepts. Derivatives with the same text and concepts can typically be automatically mapped to content. Most organizations automatically map derivatives with same concepts as well, but we recommend making that decision in coordination with your editorial team.

Notes:

* In many cases, an authority will clearly state that their Standards are derived from a national document but in cases where they disclaim derivation but are very closely modeled after the national document, AB Connect still exposes derivative relationships.
* While a Standard will often have a 1:1 mapping with a Standard in a derived state, it is possible that there are multiple Standards derived from the single national Standard. This typically happens when a state breaks out a compound Standard into multiple, more specific Standards.
* There are relationships where the Standards have the same text but same Concepts is N. This occurs when a state has limited or otherwise changed the intent of the Standard through verbiage found in the hierarchical parentage of the Standard.

#### Origins

If your content is aligned to a derived document and you want to map to the national document, the Origins Relationship helps you do that - E.g. Georgia Standards of Excellence ELA to Common Core ELA. It is the inverse of the derivatives relationship. The approach and metadata are the same as that described above in the Derivatives section. Note that just as there may be multiple standards derived from one national standard, it is possible that a derived standard is a combination of multiple origin standards.

#### Peer Derivatives

If your content is aligned to a derived document and you want to map to another state document derived from the same origin, you can use the Peer Derivatives Relationship. Peer derivatives are related through a common Origin Standard. An example of this relationship includes two states that have adopted the Common Core State Standards. The approach and metadata are largely the same as that of origins and derivatives but there is one caveat: the "same text" and "same concepts" metadata on the peer derivatives is with respect to the origin - not the standard you are starting from. In order to be confident that the existing alignment equates with an alignment to the new destination, both the origin AND the peer derivative same text (and/or same concepts) flags should be true. If the origin same text is Y but the peer derivative is N, then the text of the Standard you are starting with is not the same as the text of the peer derivative.

#### Peers

Derivatives, origins and peer derivatives are great where they exist, but how do you handle mapping alignments to non-derived authorities (e.g. Common Core to Texas) or where there is no derivative, origin or peer derivative in the destination document? Two additional relationships are provided between these documents: Peers and Crosswalks. This section gives an overview of Peers. See the above section for more details on Crosswalks.

Peers are standards that are related through alignments to common educational resources. These standards are crowd sourced from curated, targeted, resources. Due to the nature of peers, editorial staff typically review the system suggestions for applicability for their specific use case.

Note that peer relationships are strongest with math and ELA. They also offer relatively good coverage for science (grades 3-12) and some limited coverage for social studies (grades 6-12).

#### Topics

Where no other relationships yield good results, use Topics to casts a broad net and identify standards covering the same general topic in the desired document. This is a two-step process where you get the list of Topics a standard is related to and then look for standards in the destination state related to one or more of those Topics. Topics cover multiple grades, so you may want to add grade filtering when looking for similar standards.

Topics offer the loosest of the relationships and is good for identifying Standards that editorial staff may want to consider when other relationships don't provide more specific suggestions. Topics are available for the core 4 subject areas.

#### Resources

Academic Benchmarks has developed example application that can help accelerate the integration of relationships into your system and processes. See the [Standards Relationship Browser](/services/ab-connect/introduction/examples#standards-relationships-browser) and [Standards Relationship Report generator](/services/ab-connect/introduction/examples#standards-relationships-report) in our [Examples](/services/ab-connect/introduction/examples) section. They include code samples that can be downloaded from the AB Connect repository and used as a starting point for your implementation.

#### Limitations

1. In many instances the Standard in question does not have an exact match in the destination state. Since using relationships does not take the specifics of the content under consideration, your degree of automation is limited. Where there aren't exact matches, editorial staff will need to review system suggestions. With fewer and fewer states adhering to the Common Core, you may find that this isn't the most efficient approach for your team.
2. Content alignment is not a once and done situation. Standards are constantly evolving. Sometimes Standards within an existing document change. Other times the entire document is replaced by a new version. A one-time mapping using relationships doesn't address the maintenance of alignments over time.
3. Relationships tend to be strongest and most prevalent with ELA, math and science. Topics have good coverage of social studies.
4. Peer relationships are limited to authorities in the US.
5. Crosswalk relationships are currently focused on authorities in the US with limited support in other regions.

### Tagging Content and Recommending Relationships

While using relationships to move from one document to another is relatively easy and efficient, at the end of the process you only have one more document's worth of alignments. As you expand your perspective to additional documents, as well as changes over time, you'll need to repeat this process. As you approach alignments across many authorities at one time, however, our robust machine-learning powered recommendation engine that uses your previous decisions to inform predictions can set you up to handle changes over time with a more holistic approach to alignment.

To assist, Academic Benchmarks created a recommendation engine that uses metadata descriptions of content to recommend alignments. In AB Connect, the content is represented by an Asset object and the metadata description is often referred to as an Asset profile.

Using either the API with a user interface in your system or AB Connect's alignment web solution, aligners describe content by tagging it with standards and education search terms. The recommendation engine uses the profile to make recommendations for additional standards.

While this approach takes more upfront effort from aligners to describe the content, it has several distinct advantages:

1. It works across all authorities and most subjects.
2. The engine updates recommendations as Standards are changed and new Standards become available easing long term maintenance.
3. Recommendations are made in the context of the specific content. The process of using relationships ignores the subtlety of the content description and errors can drift into alignments.

## How To Offer Your Partners Advanced Discovery Of Your Assets

AB Connect can be a powerful solution for interoperability challenges between systems exchanging content. It is possible to share Assets with other AB Connect customers (referred to as Providers). The Provider who owns the Assets is referred to as the Owner. Providers that can search and read the Asset metadata profile are referred to as Consumers. When access is shared, the Consumer can use AB Connect to include the Owner's Assets in their search results and retrieve the Asset descriptions to power activities like displaying alignment information and finding related content. For example, if you are a Learning Management System (LMS) and have purchased lesson plans from one Provider and assessment questions from another, you can use AB Connect to search the lesson repository, retrieve the description of the plan and look for related questions in the assessment repository (Assets that cover the same Standards and Concepts as the lesson). This capability is facilitated using the Providers resource as well as the Owner property on the Assets. To share your Assets with other Providers, contact [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Asset%20Sharing). We can configure the sharing for you.

When using AB Connect for interoperability, you don't need to be concerned about the AB license status of your partners. AB Connect automatically handles the Consumer's licensing and only shares data with them that they have been licensed for. This is true for reading the Asset data as well as searching. E.g. if you are using Concepts in your Asset description, a Consumer that is only licensed for Standards will not be able to include Concepts in their search criteria. Similarly, if you are only licensed for Standards, Consumers of your Assets will not be able to find them using Concepts (or Topics) because your Asset descriptions will not include Concepts (or Topics).

See the `owner` property in the section on [Assets](/services/ab-connect/reference/assets#searching-for-assets) for details on searching by owner.

## Exchanging Alignment Data With Partners

A common need in the industry is to exchange alignment and taxonomic metadata with partners to support reporting and discoverability. E.g. a school district purchases lessons from a provider. An administrator at the district imports the lesson into their LMS. While the lesson data is enough to run the lesson, alignment and taxonomies are required in order to support full discovery of the plans and analytics of the lesson usage.

What's the best way to share the content metadata with your partners?

### Recommendation: AB Connect's Owner/Consumer Capability

AB Connect allows you (the Owner) to share your content's description (Asset metadata profile) with your partners (Consumers). The Consumers can retrieve your Asset's metadata directly from AB Connect using the AB Asset GUID. This approach has several advantages:

1. It is concise. One GUID is exchanged with your payload and it conveys the complete Asset metadata profile.
2. Alignments and other descriptive metadata change over time. New Standards documents are published. Alignments are adjusted. Standards are deleted. Concepts and Topics are added to the description. Exchanging the Asset GUID allows the Consumer to refresh the Asset profile dynamically.
3. Your AB Connect license is likely not the same as your partner's license. If you send them AB GUIDs that are not in their license, it is a violation of the license agreement and confusing for the recipient since they won't have matching data on their end. If you exchange data using the Asset profile, AB Connect filters the Consumer's view of the Asset to match their license.
4. Using this approach also enables your partners to search your Assets via AB Connect using the full Asset metadata profile. See the [section above on Advanced Discovery](#how-to-share-alignments-with-your-partners-and-offer-them-advanced-discovery-of-your-assets) for more information on this advantage.

To setup your account to share your Asset descriptions with your partners, contact [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29).

#### Exchanging The Asset GUID Via The Common Cartridge, Thin Common Cartridge, LTI or QTI

The taxonomic classification property in the LOM section of the manifest is a convenient place to pass the AB Asset GUID. As you can see in the example below, the GUID can be exchanged as a taxonomy entry using the source name `AcademicBenchmarksAssetGUID`.

For example:

```
  ...
    <metadata>
      ...
      <lom xmlns="http://ltsc.ieee.org/xsd/LOM">
        ...
        <classification>
          <purpose>
            <source>LOMv1.0</source>
            <value>discipline</value>
          </purpose>
          <taxonPath>
            <source>
              <string xml:lang="en">AcademicBenchmarksAssetGUID</string>
            </source>
            <taxon>
              <entry>
                <string xml:lang="en">7E80697A-7440-11DF-93FA-01FD9CFF4B22</string>
              </entry>
            </taxon>
          </taxonPath>
          ...
        </classification>
        ...
      </lom>
      ...
    </metadata>
  ...
```

### Alternative Approach

While using the Asset GUID to exchange metadata with your partners is a better approach, there may be situations where you are limited to passing Standard GUIDs to a partner. The following sections outline how to include AB GUIDs in your payload.

#### Exchanging AB Standards GUIDs Via Learnosity

Learnosity has integrated directly with AB Connect. [This section of their documentation](https://help.learnosity.com/hc/en-us/sections/360001598818-Academic-Benchmarks) describes their implementation and how to configure Learnosity to work with AB for your content. While you can use custom tags in Learnosity to store your AB GUIDs with any tag name you'd like, to maximize compatibility with Learnosity's integration with AB Connect, we recommend you use the tag name `lrn_ab_aligned`. Following the Learnosity API documentation on setting tags, the tags portion of the payload might look like:

```
  ...
  {
      "tags": [
          {
              "type": "lrn_ab_aligned",
              "name": "000DD508-29E9-11D8-8162-F2F2B6C137B9"
          },
          {
              "type": "lrn_ab_aligned",
              "name": "000b4dc7-adfc-46be-b72a-7a0ed91601fa"
          },
          {
              "type": "lrn_ab_aligned",
              "name": "00109D60-29E9-11D8-A8C1-FD5D7E873ABE"
          }
      ]
  }
  ...
```

**References**

* [Learnosity integration with Academic Benchmarks standards using Tags](https://help.learnosity.com/hc/en-us/articles/360006017517-Learnosity-integration-with-Academic-Benchmarks-standards-using-Tags)
* [Configuring Academic Benchmarks standards integration](https://help.learnosity.com/hc/en-us/articles/360005458497-Configuring-Academic-Benchmarks-standards-integration)
* [Intro to Tagging and Using it on the Authoring Site](https://authorguide.learnosity.com/hc/en-us/articles/360000581278-What-is-Tagging-)
* [Setting Up Tags](https://authorguide.learnosity.com/hc/en-us/articles/360000434818-Creating-Tag-Types-and-Tags-Using-the-Tag-Manager)
* [Tagging Using the Embeddable API](https://demos.learnosity.com/authoring/item-list.php)
* [Setting Tags via the Data API](https://reference.learnosity.com/data-api/endpoints/itembank_endpoints#setTags)

#### Exchanging AB Standard GUIDs Via Ed-Fi

The Ed-Fi data model supports the tagging of assessment items with AB Standards GUIDs. In the Ed-Fi model, they are referred to as `LearningStandards` and the AB GUID is stored as the `LearningStandardId`.

Note that the Ed-Fi ODS will typically only house standards for the given education agency and any related origin standards that they are derived from. You will be unable to add alignments to standards in other states/districts.

**References**

* Ed-Fi Data Standard v3.0
  * [Assessment Model Overview](https://techdocs.ed-fi.org/display/EFDS30/Assessment+-+UDM+v3.0)
  * [AssessmentItem Documentation](http://schema.ed-fi.org/datahandbook-v30/Ed-Fi-Handbook-Index.html#/AssessmentItem542)
  * [LearningStandard Documentation](http://schema.ed-fi.org/datahandbook-v30/Ed-Fi-Handbook-Index.html#/LearningStandard567)
* Ed-Fi Data Standard v2.2
  * [Assessment Model Overview](https://techdocs.ed-fi.org/display/EFDS22/Assessment+-+UDM+v2.2)
  * [AssessmentItem Documentation](http://schema.ed-fi.org/datahandbook-v22/Ed-Fi-UDM-Handbook-Index.html#/AssessmentItem542)
  * [LearningStandard Documentation](http://schema.ed-fi.org/datahandbook-v22/Ed-Fi-UDM-Handbook-Index.html#/LearningStandard567)

#### Exchanging AB Standards GUIDs Via The Common Cartridge, Thin Common Cartridge, LTI or QTI

IMS Global has a data element to help support the transmission of related Standards data. There does not appear to be a single page on the IMS site that concisely describes the exchange with explanations and examples, so we'll summarize it here.

**Recommended Representation**

The `curriculumStandardsMetadata` object has one optional property `providerId`. Per the IMS Global GUID registry the Academic Benchmarks provider ID is "**AB**".

The `setOfGUIDs` object has optional properties `region` and `version`. In spite of the inappropriate use of the phrase `region`, it is our recommendation that providers use the authority description (`document.publication.authorities[0].descr`) for this field. We'd recommend supplying the document adoption year (`document.adopt_year`) for the `version` and create a new `setOfGUIDs` for each document for which they are supplying Standards.

The `setOfGUIDs` body consists of repeated `labelledGUID` objects. That object consists of an optional `label` element and a required `GUID` element.

For example:

```
  ...
    <metadata>
      <curriculumStandardsMetadataSet xmlns=/xsd/imscsmetadata_v1p0>
        <curriculumStandardsMetadata providerId="AB">
          <setOfGUIDs region="NGA Center/CCSSO" version="2010">
            <labelledGUID>
               <GUID>7E80697A-7440-11DF-93FA-01FD9CFF4B22</GUID>
            </labelledGUID>
            <labelledGUID>
               <GUID>7E7EF798-7440-11DF-93FA-01FD9CFF4B22</GUID>
             </labelledGUID>
          </setOfGUIDs>
        </curriculumStandardsMetadata>
      </curriculumStandardsMetadataSet>
    </metadata>
  ...
```

**References**

* [Curriculum Standards Metadata section of the Common Cartridge](https://www.imsglobal.org/cc/ccv1p3/imscc_Implementation-v1p3.html#toc-48)
* [Thin Common Cartridge Curriculum Standards Metadata description](https://www.imsglobal.org/cc/CCv1p0thin/ims_thinCC_impl-v1p0.html#_Toc419292016) (defers to the Common Cartridge definition)
* [Thin Common Cartridge Example](https://www.imsglobal.org/cc/CCv1p0thin/ims_thinCC_impl-v1p0.html#_Toc419292024)
* [Common Cartridge XSD](http://www.imsglobal.org/profile/cc/ccv1p3/ccv1p3_imscsmd_v1p0.xsd)
* [IMS Global GUID registry](https://www.imsglobal.org/cc/guidregistry1.cfm)

#### Handling Problems Consuming Alignments From A Partner

In some situations, the consumer of alignment data may have difficulties resolving AB GUIDs they receive in a payload. The difficulties arise from two sources: stale partner caches of AB data and license differences. Both of these issues are addressed when using the API and using the Asset GUID as a means to exchange data. However, if you are exchanging individual Standards GUIDs, here are some tips:

1. If you receive a GUID that you don't recognize, it is either because it isn't a valid AB GUID, you aren't licensed for that particular GUID (e.g. it may be in a state or subject you haven't licensed), your cache is out of date or your partner's cache is out of date.
2. If you cache data, try refreshing your cache or call the API to retrieve that specific GUID. If your cache is stale and the GUID is new, the problem should be resolved. One alternative solution is to always use the API directly rather than cache data so you don't have to worry about a stale cache.
3. If your cache is up to date or you use the API dynamically, your partner may have a stale cache. In that case, the GUID they passed you may no longer be active. If you request the Standard by GUID from the API, even deleted Standards will be returned. You can check the Standard's status to confirm that it has been deleted.
4. Regardless of whether you cache data or not, if you aren't licensed for a GUID your partner passed to you, you won't be able to access it. However, you can verify this (and determine which additional units you may want to license) by requesting the Standard by GUID from the API. If it is a valid GUID but you aren't licensed for it, the API will respond with a 403. The error payload will include information that will help you work with [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) to add it to your license.
5. If requesting the Standard by GUID from the API doesn't resolve the issue, the GUID your partner passed is not a valid AB GUID. Contact your partner to help resolve the issue.

## Interpreting Courses

In addition to traditional Standards, some authorities provide course definitions that are groups of Standards defined elsewhere but combined separately into a course. Course definitions are captured into publications where the `publication_type` is set to `course`. Those are special publications where the top level of Standards represent courses. The Standards that must be covered in the course are available in the `course_standards` relationship on the Standard. So, for example, to see the Standards that comprise the Florida CPALMS Language Arts - Kindergarten (#5010041) course, you would use the falling call:

```
  /rest/v4.1/standards/2FADED92-647D-4183-89C1-17F28CF065ED?fields[standards]=statement,number,section,course_standards&include=course_standards
```

The `related_courses` relationship points in the opposite direction, so you can get a list of courses that a Standard is used in by examining the `related_courses` relationship. Since `related_courses` points in the opposite direction of `course_standards`, an alternative call to the one above that returns the same data would be:

```
  /rest/v4.1/standards?filter[standards]=related_courses.id eq '2FADED92-647D-4183-89C1-17F28CF065ED&fields[standards]=number,statement,section'
```

Or you could use a call like the following to get information on all of the courses that reference a standard:

```
  /rest/v4.1/standards/C3B5C384-E1BF-11DC-A10B-B5479DFF4B22?fields[standards]=statement,number,section,related_courses&include=related_courses
```

## Managing Alignments as Standards Evolve

From time to time, authorities edit their Standards and make minor or major changes. Minor changes are often reflected as change events on Standards but they can also result in the deleting of one Standard and a creation of another. This typically happens when the modification of the Standard is significant enough that it would impact alignments. In this case, the old GUID is retired and a new one to represent the new Standard is created. Major changes come in the form of new documents that replace all of the standards in older documents.

AB Connect offers a couple of solutions to help you manage your alignments as changes occur. One approach is to use AB Connect's prediction algorithms which maintain alignments based on the content description rather than fixed relationships with specific standards. This requires little to no extra work as alignments change. Another approach is to use the Standards relationships available in AB Connect. AB Connect supplies maps from outdated Standards to their replacements. We often refer to these as migration maps. These maps are exposed in the `replaces` and `replaced_by` relationships on the Standards. The `replaced_by` relationship points forward from outdated Standards to their replacements. The `replaces` relationship points backwards from the new Standards.

If you would like to use the prediction algorithms to maintain alignments, see the section on [Managing and Predicting Relationships](https://developerdocs.instructure.com/services/ab-connect/introduction/pages/YcYUS1ZchguVbdEtyBoO#managing-relationships-between-assets-and-standards/creating-relationships). If you would prefer to use the migration maps, the first step in the process would be to identify which workflow will work best for your organization. There are two general approaches that can be taken: starting with Standards or starting with Assets.

### Starting with Standards

You may want to start with Standards if you have a local cache and use the `events` endpoint to sync the cache. In this case, you would get notifications for Standards that have been deleted or new documents that are available. You may have a different process for determining which new Standards you need to migrate alignments to or which old Standards you need to update. But whatever the approach, you start with a list of either outdated Standards or new Standards and you need to update alignments to ensure they are current.

If you are starting with a deleted or outdated Standard, the first step is to locate its replacement(s)(their may be more than one replacement). You can use the `replaces` relationship to search for standards that replace the Standard in question. E.g.

```
  /rest/v4.1/standards?filter[standards]=replaces.id eq '0011921D-A923-435C-985F-FBB3C810E735'
```

You can combine search criteria if you need to narrow the focus. For example, you can add document GUIDs to look for replacements in the same document when an individual Standard has been deleted.

The example above returns standard `A34FE67F-9AEB-4A04-B14C-59BAE6A6404C` which is NOT a "same concept" match. In this case, the interpretation of the applicability of the new Standards to the alignment may need to be reviewed by an aligner.

If you are only interested in exact concept matches, you can add that as a criteria. E.g.

```
  /rest/v4.1/standards?filter[standards]=replaces.id eq '00CAA27E-AF8B-4385-AC22-285B911685B5' and replaces.same_concepts eq Y
```

But what about when a new document is added? How do you determine which Standards are being outdated? You can reverse the search direction. E.g. You know South Dakota released their 2018 English Language Arts Standards but you are currently aligned to the 2010 Standards. Where do you start? Grab a Standard from the 2018 document and either look at its `replaces` list or search for Standards in the 2010 document that are replaced by the Standard you are focusing on. We'll do the latter here because it is more interesting.

```
  /rest/v4.1/standards?filter[standards]=replaced_by.id eq '8CB54468-0F56-4767-95DE-6D684CC9244F' and document.guid eq 'E1C9B054-DA22-11E2-95B3-3B359DFF4B22'
```

Here you'll get `00000CD0-D9E7-11E2-BBB0-00249DFF4B22`. If you examine the relationship metadata you'll notice that they have the same concepts but not exact same wording.

Once you have the Standard that is being replaced and the Standard that is replacing it, the next step is to identify which Assets will need to be re-aligned. To locate Assets aligned to an outdated Standard (e.g. `0011921D-A923-435C-985F-FBB3C810E735`), you can use a call like:

```
  /rest/v4.1/assets?filter[assets]=alignments.id eq '00000CD0-D9E7-11E2-BBB0-00249DFF4B22'
```

How you update the alignments is dependent on your editorial processes. E.g. can you automatically migrate alignments to new Standards as long as they have the same concepts? Or do you require the same text? What if the text is the same but the Standard moved to a new grade? These are questions that the editorial staff has already answered but they will need to be codified and applied to any automation you build.

### Starting with Assets

Now let's flip that over. Rather than tightly monitor Standards, some organizations prefer a periodic review of their content alignments. In this case, you start with the Assets and look for alignments that need to be updated.

It is easy to locate Asset alignments to deleted standards. For a given Asset, you can find alignments to deleted standards using a call like:

```
  /rest/v4.1/assets/02213D12-0A8A-11E8-AA1B-EB8924FEA1B3/alignments?filter[alignments]=status eq 'deleted' and meta.disposition eq 'accepted'
```

Here we only search for Standards that are marked as `accepted`. There is no need to update `rejected` alignments and `predicted` alignments are automatically updated on the next snapshot (POST a set of predictions to the Asset).

Determining what alignments an Asset should have to new documents isn't possible directly from the Asset itself without using the alignment prediction functionality or examining the Standards (or at least documents) involved. So to add alignments to new documents, either use predictions, combine your asset centric approach with the Standards approach mentioned above or start with something like an alignment gap report.

One search you may find helpful is locating all Assets aligned to an older version of a document. So using the example that we used in the Standards centric approach above, the older document is South Dakota's 2010 Language Arts Standards (`E1C9B054-DA22-11E2-95B3-3B359DFF4B22`). To locate Assets that are good candidates for alignment to the 2018 document, use a call similar to:

```
  /rest/v4.1/assets?filter[assets]=standards.document.guid eq 'E1C9B054-DA22-11E2-95B3-3B359DFF4B22'
```

## Optimizing Use of AB Connect

When working with APIs, it's important to keep performance optimized. There are a few basic practices that can ensure top performance when working with AB Connect.

### Faceting

Calculating facets can be time consuming. Custom attributes on Assets can be particularly challenging as they may have unique values which will significantly impact performance. Only facet properties you need and avoid facetting properties that have unique values.

### Sparse Fieldsets

Another source of processing and network waste is the processing and returning large quantities of unused fields. We recommend using the `fields` parameter to request only the specific fields required for each call. Use `fields[]=*` only for discovery during programming. To ensure the use of wildcards with the `fields` parameter does not impact overall system performance, such calls are throttled to 2 per second.

### Request Only What You Need, Only When You Need It

Using sparse fieldsets and minimizing facet requests are simple changes that can have significant impact on the response times of calls, but the design of the your system's interaction with the API may have a larger impact.

It's tempting to make few calls and pull more data per call because you may need it. While this seems efficient on the surface, it can actually have notable impact on the overall API experience - particularly for user interfaces. In practice, it is typically more efficient and more interactive to make multiple calls and request only enough data to meet the immediate need.

Several examples:

#### Navigating Standards

One common mistake is to attempt to load a large set of Standards to populate a tree or set of drop-downs. This could take many seconds depending on whether you are loading a section, document or publication. A best practice is to lazy load the UI and request just enough information to show the user what they requested. The AB Connect Standards browser uses this approach for a very efficient interactive experience.

#### Searching for Assets

Another common scenario is searching for Assets and alignments. It is tempting to show all results or load large pages of Assets but this can result in a slow user experience and users don't typically scroll through large sets of data. It is better to show them a small page of results quickly and allow them to refine their search or page/infinite scroll the results.

#### Showing Appropriate Amount Of Information

It is tempting to show a lot of data in your search results but not only can this slow API response times but can clutter the user interface making it difficult to digest and navigate. Avoid things like attempting to show large quantities of properties or alignments in Asset search results. It's better to have a list or tiles with a simple title, perhaps a brief description, subject and grade. The user can use faceting to further narrow results and if they need details they drill down into the individual Asset to see things like alignments, concepts, etc.

#### Know Your Browser

Another common source of waste is retrieving and exposing irrelevant data to your users. If your user is an 8th grade math teacher from California, don't force them to select 8th grade math when searching for content. When displaying alignments, limit your queries to 8th grade math Standards in California. This will significantly reduce the data the system is processing and will speed up the response times.


# Examples

One of the challenges with adopting a new integration is coming up to speed on the basics of interacting with the partner system. To lower the slope of the learning curve, Academic Benchmarks has documented examples and developed apps. We are sharing the source to give developer's working examples of how to integrate with AB Connect.

Below are brief descriptions of efficient means for implementing solutions and useful examples apps with links to the [Instructure Github repository](https://github.com/instructure/abconnect-samples) where they can be downloaded. All samples and apps are offered as-is with no warranty. Although they are often usable as is, the main purpose is to illustrate how to interact with the AB Connect API. If any particular app doesn't do what you need, feel free to download a copy and modify it to meet your needs. This repository is not meant to host solutions for non-technical users nor is it a location to submit requests for changes or additions to the API or the samples listed here. Be sure to read the ReadMe for each app for details.

## Standards Relationships Browser

Among other things, AB Connect exposes the relationships between Standards. This app is a web page client that allows the user to browse Standards in their license, view the metadata profile of the Standard and find related Standards in other documents. The user is allowed to select from a set of relationships types when navigating across relationships. The types of relationships that are available is based on the licensing of the account used. If the account is not licensed for relationships, the app falls back to a simple Standards browser. This app is also an example of an integration with the embeddable Standards Browser widget (see [Using AB Connect's Embeddable Widgets](/services/ab-connect/introduction/widgets) ). You can find the source in the relationships-browser folder of our [public repository](https://github.com/instructure/abconnect-samples). You can find a [working version of the app here](https://widgets.academicbenchmarks.com/ABConnect/v4/relationships-browser/RelationshipBrowser.html).

## Simple Standards Browser

This is a very simple example app that does little more than illustrate a minimal integration with the embeddable Standards Browser widget. This app is a web page client that allows the user to browse Standards in their license and view the metadata profile of the Standard. See [Using AB Connect's Embeddable Widgets](/services/ab-connect/introduction/widgets) below for more information. You can find the source in the standards-browser-min folder of our [public repository](https://github.com/instructure/abconnect-samples). You can find a [working version of the app here](https://widgets.academicbenchmarks.com/ABConnect/v4/standards-browser-min/StandardsBrowser.html).

## Browse Standards by Topic

AB Connect includes a few taxonomies that can aid in the navigation of Standards and searchability of Assets. The Topics Browser is a basic example of how one could use topics to locate relevant Standards. You can find the source in the topicsBrowser folder of our [public repository](https://github.com/instructure/abconnect-samples). You can find a [working version of the app here](https://widgets.academicbenchmarks.com/ABConnect/v4/topicsBrowser/topicsBrowser.html).

## Show Alignments On Your Content Page

This example app is designed to give you a quick leg up on showing alignments on your web site. This small sample allows the user to search for content by `client_id` (usually your internal ID for the content), AB Asset GUID or general text search. It then shows the alignments for the first Asset it finds in AB Connect that matches the search criteria. The user can narrow the scope of the authorities to show only alignments in one state (for example). You can find the source in the display-alignments folder of our [public repository](https://github.com/instructure/abconnect-samples).

## Content Browser

This is a web page client that allows the user to use faceting to search their Asset repository on AB Connect. Note that the app requires that the account already has a set of Assets and at least a minimal configuration that should take a couple of minutes to get it up and running in a demo mode. You can find the source in the asset-browser folder of our [public repository](https://github.com/instructure/abconnect-samples).

## Standards Relationships Report

This example is similar to the browser app but is a node.js based and generates a report with a mapping of a set of Standards from one document to another. The input and output are done through Excel files. There is a template supplied as part of the repository. You'll need to use another means for gathering the input which is a set of Standard GUIDs. One quick way to build the list is to use something like Postman to gather the Standards of interest. You can find the source in the relationships-report folder of our [public repository](https://github.com/instructure/abconnect-samples).

## Standards Browser Widget Source

The source for the Standards Browser Widget documented in [Using AB Connect's Embeddable Widgets](/services/ab-connect/introduction/widgets) is accessable as well. This is a more complex example that spends more effort on the quality of the look and user experience. Where the other examples are good for accelerating API ramp up, the widget source code is best suited to situations where the widget itself is close to meeting your organization's needs but you need to add or modify some features. In that case, start with the existing widget and extend it to meet your needs. You can download the latest [source here](https://widgets.academicbenchmarks.com/ABConnect/v4/dist/widgets-src.zip).

Here are basic instructions for building the supplied source for distribution. All commands must be executed in the directory where you've unzipped the source.

1. Download the [source from here](https://widgets.academicbenchmarks.com/ABConnect/v4/dist/widgets-src.zip).
2. Unzip the file into a folder on your system.
3. Run the following commands in the folder where you placed the unzipped source.
4. `npm install`
5. `npm run build`
6. Use dist/widgets.js and dist/widgets.js.map

To obtain a production widgets bundle, follow these steps:

1. For a bash shell:
   1. `NODE_ENV=production npm run build`
2. For Windows cmd.exe:
   1. `set NODE_ENV=production`
   2. `npm run build`
3. Use dist/widgets.js

## Postman Collections

The illustrative-postman-collections folder in our [public repository](https://github.com/instructure/abconnect-samples) hosts a set of Postman collections that can help get you started with API calls for various scenarios. The ReadMe file gives the details of the available collections.


# Using AB Connect's Embeddable Widgets

## Overview

In continuing efforts to make the process of working with academic Standards easy and efficient, we have begun to create plug-able widgets that can be used directly in apps created by our partners. The widgets are designed to enable our partners to offer capabilities within their apps with only a few lines of code. We will continue to expand the capabilities of the widgets as well as add to the list of supported widgets over time.

Our initial offering is a widget that enables the end user to browse for and select Standards. We will continue to expand the capabilities to support faceted and full text search as well as search-by-number.

## Supporting Infrastructure

Instructure's Academic Benchmarks widgets are hosted on Amazon's Content Delivery Network (CDN) to ensure high availability and responsiveness.

## Standards Browser Integration

### Integration

The app is built on jQuery and completely embeds all requirements directly within the one package to ensure smooth integration. To plug the widget into your app, start by including the script into your HTML file:

`<script src="https://widgets.academicbenchmarks.com/ABConnect/v4/dist/widgets.js"></script>`

### Dependencies

The required version of jQuery is encapsulated within the widget JavaScript to avoid version dependency issues but the order in which your app loads the various libraries matters. If you use jQuery, you should always load jQuery before the AB Connect widgets. We've bundled a version of jQuery in such a way as not to interfere with other versions that may be included on the page. To ensure the smoothest integration possible, the widget will handle the encapsulated jQuery in the following manor:

1. If jQuery was loaded into the page before the widgets, then the widgets will be installed into it but the widgets will use the encapsulated version of jQuery internally.
2. If jQuery is not loaded at all, then the encapsulated version of jQuery (and widgets) will be installed into the page. (version 2.2.4)
3. If jQuery is loaded **after** the widgets, then the version of jQuery (and widgets) installed by AB Connect will be rendered inaccessible.

### Adding the Widget to Your Page

Once the script is included, create a div to hold the widget. Note that the widget was designed for a minimum size of 800 x 600 px. If it is given more space than that, it will expand to take advantage of it. You can give the div any name/class/tag you like.

`<div class="standardsBrowser" style="width: 800px; height: 600px;"></div>`

Initializing the browser is as simple as:

`$('.standardsBrowser').standardsBrowser(config);`

The `config` object can be used to define the behavior of the widget as well as how it interacts with your app.

### Configuration

The configuration object you include in the widget initiation can help control the behavior of the widget. This section describes the properties of the configuration object and how they are used to control the widget.

* `uiEntityState` - This is an object property that defines the initial values of elements in the UI as well as their visibility. Each property of the uiEntityState object contains an optional flag (named "show") indicating whether that element is visible and a value property indicating the initial value(s) of the element. If the "show" property is left out, the default is true. If the value property is left out, no initial selection is made. If the element property is not included, the element is visible with no initial selection. Properties:
  * `authority` - Indicates the drop-down listing the authorities available for browsing. The value property is the GUID of the initial authority selection.
  * `publication` - Indicates the drop-down listing the publications available for browsing. The value property is the GUID of the initial publication selection.
  * `document` - Indicates the drop-down listing the documents available for browsing. The value property is the GUID of the initial document selection.

E.g.:

```
    uiEntityState: {
      authority: {
        show: false,
        value: "A83297F2-901A-11DF-A622-0C319DFF4B22"
      },
      publication: {
        show: false,
        value: "964E0FEE-AD71-11DE-9BF2-C9169DFF4B22"
      },
      document: {
        show: false,
        value: "6C2635F0-6EC0-11DF-AB2D-366B9DFF4B22"
      }
    }
```

would pre-select the Common Core Math Standards and hide the lists so the user couldn't change the selection.

* `selectMode` - This is a property indicating whether the browser is in single select mode (single - the default) or multiple select mode (multiple). If false, the user can select multiple Standards at a time. Note that the selection is cleared when the user changes facet filtering, does a search or changes document. It is the responsibility of the parent app to offer a mechanism to build and manage a persistent list of Standards if appropriate for the app.
* `enableDoubleClick` - This is a Boolean property indicating whether the browser supports double clicks (true). Default: false.
* `showAssetCount` - This is a Boolean property indicating whether the browser should show a badge indicating the number of Assets that are related to the Standard. This can be used in situations where the parent app is using the Standards Browser as a first step in helping the user search for related Assets. Note that this capability requires that your organization stores your content metadata profile as Assets in AB Connect. The default is false.
* `assetCountFilter` - This is a string property that is added to the AB Connect query that is used to retrieve the Asset count when the showAssetCount is true. By default, the widget counts any Assets that are owned by your account and are related to the Standard in question. However, you can pass a query string that is then appended to the query with an AND operator to further limit the query. E.g. you may want to further limit the results to a particular type of Asset or Assets of a particular media type. This property is optional and only used if showAssetCount is true.
* `authCredentials` - This is an object property containing the authorization credentials. See the AB Connect [documentation on authentication](/services/ab-connect/introduction/authentication) for details.
  * `ID` - Your partner ID
  * `signature` -signature generated from your partner key and the expires value
  * `expires` -expiration date of the signature
  * `user` - optional parameter for an ID specific to this user
* `onStandardSelect` - An event handler defined by your app to handle selection events for Standards. The signature of the function must be function (event, GUID). The GUID of the Standard that was selected is the second parameter. This property is optional. Alternatively, you can register your event handlers directly via jQuery.
* `onStandardDoubleClick` - An event handler defined by your app to handle double-click events for Standards. The signature of the function must be function (event, GUID). The GUID of the Standard that was clicked is the second parameter. This property is optional.
* `onStandardDeselect` - An event handler defined by your app to handle deselection events for Standards. The signature of the function must be function (event, GUID). The GUID of the Standard that was deselected is the second parameter. Note that this event will fire multiple times in the event of multiple deselects (e.g. when multiple Standards are selected and the document or filter criteria changes). This property is optional.
* `onError` - An event handler defined by your app to handle error events. In the event of warnings or soft error situations, the widget will do it's best to recover and restore normal working behavior while logging the issue in the console. However, error conditions that are unrecoverable (e.g. authentication errors) will be surfaced to the parent app. The signature of the function must be function (event, message). Message is a human readable message describing the error that occurred. While this parameter is technically optional so the developer can alternatively choose to register this handler directly with jQuery, the developer MUST create a handler using one method or another or there will be no user feedback on error conditions.

Here is an example configuration object for an app that uses the browser for the selection of a single Standard.

```
var config = {
      selectMode: 'single',
      enableDoubleClick: false,
      authCredentials: {
        ID: gPartnerID,
        signature: gSignature,
        expires: gAuthExpires
      },
      onStandardSelect: function(event, GUID){
        standardSelected(GUID);
      },
      onStandardDeselect: function(event, GUID){
        noStandardSelected();
      },
      onError: function(event, message){
        alert(message);
      }
    };
```

### Events

The Standards Browser fires or forwards events to the parent app. Registering for most of the events is optional but the app **must** register for error events because the widget does not handle errors itself. Instead, it forwards them to the parent app so it can display the error using the same approach it displays errors from other elements of the UI.

The following events may be fired during the operation of the widget:

* `standardSelect` - A Standard has been selected. The GUID of the Standard is forwarded with the event. The parent app may choose to ignore such events or it may take some action like enable buttons that allow the user to take action (like add the Standard to a list or close the selection card or dialog).
* `standardDoubleClick` - A Standard has been double clicked. The GUID of the Standard is forwarded with the event. The parent app may choose to ignore such events or it may take some action like add the Standard to a list or close the selection card or dialog. Note that due to the way double clicks are handled in browsers, a double click action will actually create a select event for the Standard being clicked, followed by deselect events for ALL selected Standards followed by a double click event for the Standard being clicked.
* `standardDeselect` - A Standard has been deselected. The GUID of the Standard is forwarded with the event. The parent app may choose to ignore such events or it may take some action like disable buttons. Note that if the user has multiple Standards selected and does something like change the search criteria or publication, the parent app will receive multiple "standardDeselect" events rapidly - one for each selected Standard.
* `error` - An error has occurred and the widget is unable to self recover in a meaningful way.

### Methods

The Standards Browser supports the following methods to help the parent app interact with it.

* `getConfiguration` - Returns the uiEntityState object containing the current configuration. This will help the parent app re-launch the widget in the same state as it was when the user closed it. E.g. `var state = $('.standardsBrowser').standardsBrowser('getConfiguration');`
* `getSelection` - Returns an array of GUIDs listing every Standard that is currently selected in the UI. E.g. `var listGuids = $('.standardsBrowser').standardsBrowser('getSelection');`

### Examples

See the [Instructure Github repository](https://github.com/instructure/abconnect-samples) for examples illustrating how to embed the Standards Browser into your app.

* **Minimum Standards Browser** - This is a minimum app that hosts the Standards Browser. Beyond illustrating the basics of using embeddable widgets in an app, this example shows the basic JSON body of the currently selected Standard. You can see the [browser in action here](https://widgets.academicbenchmarks.com/ABConnect/v4/standards-browser-min/StandardsBrowser.html).
* **Integrated Relationship Browser** - This is a version of the Relationship Browser app that uses the Standards Browser rather in place of the home-grown browser from the original Relationship Browser app. You can [see it in action here](https://widgets.academicbenchmarks.com/ABConnect/v4/relationships-browser/RelationshipBrowser.html).

### Common Integration Scenarios

#### Simple Single Selector Pop-Up

One common situation is having the user select a single Standard. You may want to do this when prompting a teacher to select a Standard related to a test item or starting the process of searching for items by alignment. The integration may look something like this:

1. Create a pop-up window (or div) that contains the Standards Browser widget in single select mode and buttons for "OK" and "Close".
2. Disable the "OK" button by default.
3. Listen for onStandardSelect events. When you receive one, enable the OK button.
4. Listen for onStandardDeselect events. When you receive one, disable the OK button.
5. Listen for onStandardDoubleClick events. When you receive one, record the GUID, close the dialog and return control to the parent app.
6. If the user selects OK:
   1. Call getSelection to retrieve the selected Standard, record the GUID
   2. Optionally call getConfiguration on the StandardsBrowser to grab the user selections for restoration later
   3. Close the dialog and return control to the parent app

#### Multiple Selector with a Managed List of Standards

Another common situation is having the user manage a list of Standards. This may come up when you want to allow a teacher to search for materials related to curriculum for the next quarter. The integration may look something like this:

1. Create an area on the page that contains the Standards Browser widget in multiselect mode as well as a separate list (we'll call this standardsList) and arrow buttons to allow user to add Standards to the standardsList and remove Standards from the list (perhaps ">>" and "<<" or "Add" and "Remove" buttons). You may also want some sort of Action button.
2. Disable the "Add" button by default.
3. Listen for onStandardSelect events. When you receive one, enable the "Add" button.
4. Listen for onStandardDeselect events. When you receive one, check getSelection to see if there are any Standards still selected. If not, disable the "Add" button.
5. Listen for onStandardDoubleClick events. When you receive one, add the Standard related to the GUID to the list.
6. Listen for click events on the "Add" button. When you receive one, add the Standard related to the GUID to the list.
7. Listen for selection events on the standardsList. When you receive one, enable the "Remove" button.
8. Listen for deselection events on the standardsList. When you receive one, check to see if there are any Standards selected in the standardsList. If not, disable the "Remove" button.
9. Listen for click events on the "Remove" button. When you receive one, remove the selected Standard from the standardsList.
10. Listen for click events on the "Action" button. When you receive one:
    1. Gather the list of Standards from standardsList
    2. Optionally call getConfiguration on the StandardsBrowser to grab the user selections for restoration later
    3. Pass control to the parent app. You may want to remove or hide the StandardsBrowser at this point depending on the needs of your app.


# Reference


# Standards

The Standards resource can be used to access academic Standards and related metadata. The API provides a simple integration point, eliminates the need to manage Standards data in your organization and system, and provides the foundation for additional connected metadata. Use of the API ensures the most current Standards data is available to your application.

One of the greatest benefits of AB Connect is the ability to navigate relationships between Standards, other Standards and Topics. Retrieving the related Standards and Topics is done in a similar fashion as attributes, but they are contained in the JSON API relationships response. Note that due to the JSON API standard, only the type and ID are returned in the relationship data. Keep in mind that the JSON API ID is the same as the AB GUID for these entities. If you'd like to retrieve the data of the related resources, use the `include` parameter.

Standards can also have `associations` linking them to Satchel Rosetta Exchange CASE identifiers. This relationship provides the CASE CFItem GUIDs matched to each AB standard, enabling cross-referencing with other systems that use CASE identifiers. The `associations` relationship requires a Professional license. See the [Associations (Satchel Rosetta)](/services/ab-connect/reference/associations) reference for full details.

Standards can also be related to Assets. Note that if a Standard is related to an Asset, Topics related to that same Standard automatically become related to Asset as "predicted" relationships when you are licensed for the Academic Benchmarks Topic Taxonomy. Note that this implied relationship is bidirectional, so relating a Topic to an Asset directly also generates predicted Standards relationships. Relationships between Standards and Assets are managed through the Asset endpoint. See the documentation on the [Asset endpoint](/services/ab-connect/reference/assets) for details.

All calls against the Standards resource must be implemented as HTTP GET requests, and must include proper [Partner Authentication Credentials](/services/ab-connect/introduction/authentication).

## Single Standard

In its simplest form, you are able to retrieve the details of a specific Standard by appending the AB GUID to the path portion of the URL.

### Fetching a Standard

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/standards/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Searching for Standards

Using filtering and facets, it is possible to retrieve sets of Standards that match specific criteria. These Standards are returned in an array of Standard objects. See the Introduction for an explanation on [filtering](/services/ab-connect/introduction/introduction-to-odata-filters) and the use of [facets](/services/ab-connect/introduction/facets). This section covers the specifics of using these parameters with the Standards resource.

### Finding Sets of Standards

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/standards" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}


# Standard Collections

When there is a need to quickly identify and refer to a filtered collection of standards, the "Standard Collection" is what provides a solution. Standard Collection stores the `filters` object with a `name` and a `guid` as reference.

* The "filters" is a JSON object that stores "filters (standard hierarchy)", "globalFilters". Searching filters are generated from this object to narrow down the result set the client wants to use.
* The "name" identifies the standard collection in human readable format.
* The "guid" identifies the standard collection in machine readable format.

## The "filters" object

The "filters" object stores the filtering expression for the standard collection. This stores standard hierarchy and global filters which helps to filter to only the desired standards.

Here is a formal description about the `filters` object. For a practical explanation see the example below.

* `filters` (object, required) - JSON API object for `filters` object containing various fields like: "filters (standard hierarchy)", "globalFilters"
  * `filters` (object) - Standard hierarchy
    * `key` (string) - Standard hierarchy element ID (guid or "root")
    * `value` (object) - Standard hierarchy element parameters
      * `collections` (array) - Array of GUIDs for the elements which are one level below in the hierarchy.
      * `id` (GUID) - GUID of the element in the hierarchy. (Same as the `key`.)
      * `parentId` (GUID) - GUID for the element which is one level above in the hierarchy.
      * `state` (string) - State is saying if the item element in the hierarchy is selected or not. Values can be: "checked" `[+]`, "indeterminate" `[-]`, "unchecked" `[ ]`
      * `type` (string) - Type of position in the hierarchy. Values in hierarchical order: "region" > "publication" > "document" > "section" > "standard".
  * `globalFilters` (object) - Standard global filters: filtering by standard facets
    * `key` (string) - Standard facet description. (Eg: `"document.publication.regions":`)
    * `value` (object) - Standard facet parameters
      * `guid` (GUID) - GUID of the element in the hierarchy. (Eg.: `"A832862C-901A-11DF-A622-0C319DFF4B22"`)
      * `name` (text) - Value of the facet parameter. (Eg.: `"California"`)

## Example to build a "filter expression" from the "filters" object

Here is a `filters` object. Let's see how filter expression can be generated from it step-by-step:

```
        "filters": {
          "assetType": "NLP_MHE",
          "facets": [
            {
              "label": "Grade",
              "id": "Grade",

              "field": {
                "name": "education_levels.grades",
                "id": "education_levels.grades.guid"
              },
              "facet": {
                "name": "data.descr",
                "id": "data.guid"
              },
              "selectedFilters": [
                {
                  "data": {
                    "descr": "Kindergarten",
                    "guid": "F1F9FA12-3B53-11E0-A421-F4B24952E9DF",
                    "code": "K",
                    "seq": 20
                  }
                },
                {
                  "data": {
                    "descr": "9th Grade",
                    "guid": "ABBAABBA-ACDC-ACDC-B042-495E9DFF4B22",
                    "code": "9",
                    "seq": 20,
                  }
                },
              ],
            },
            {
              "id": "Subject",
              "label": "Subject",
              "field": {
                "name": "disciplines.subjects",
                "id": "disciplines.subjects.ids"
              },
              "facet": {
                "name": "data.descr",
                "id": "data.guid"
              },
              "selectedFilters": [
                {
                  "data": {
                    "descr": "Mathematics",
                    "guid": "495E9DFF-3B53-11E0-B042-C4B222F1FB2F",
                    "code": "MATH"
                  },
                  "count": 2488
                }
              ]
            }
          ]
        }
```

The left side of the expression starts with `filter[asset] =`. There are two elements in the `filters.facets` array, so there will be two expressions on the right side. For example expressions `expr_1` and `expr_2`. These are the basis of the filtering. The `expr_1` is built up from `filters.facets[0]` and the `expr_2` is built up from `filters.facets[1]`.

```
    filter[asset] = expr_1 and expr_2
```

Expressions are built up from a "field" and set of "values". The filter will give back those assets which have given the "values" on the given "field".

```
    expr: field in (values)
```

Let's find the "field" values. In the JSON object the "field" is defined by `field.id`.

```
facets[0].field.id = "education_levels.grades.guid"`
facets[1].field.id = "disciplines.subjects.ids"
```

Substitute these as "fields" into the filter expression.

```
    filter[asset] = education_levels.grades.guid in (values_1) and disciplines.subjects.ids in (values_2)
```

Let's find the "values". The variables' names that are holding the "values" are defined by the `facet.id`. The "values" are those items in the `selectedFilters` object which have the object-path defined in the `facet.id`.

The variable for "values\_1" is `facet.id = "data.guid"`. Let's gather the values from `selectedFilters.data.guid` and generate the "values\_1".

```
    selectedFilters[0].data.guid = "F1F9FA12-3B53-11E0-A421-F4B24952E9DF"
    selectedFilters[1].data.guid = "ABBAABBA-ACDC-ACDC-B042-495E9DFF4B22"
    ==> 
    values_1 = "F1F9FA12-3B53-11E0-A421-F4B24952E9DF", "ABBAABBA-ACDC-ACDC-B042-495E9DFF4B22"
```

The variable for "values\_2" is `facet.id = "data.guid"`. Let's gather the values from `selectedFilters.data.guid` and generate the "values\_2".

```
    selectedFilters[0].data.guid = "495E9DFF-3B53-11E0-B042-C4B222F1FB2F"
    ==> 
    values_2 = "495E9DFF-3B53-11E0-B042-C4B222F1FB2F"
```

Finally substitute the "values" into the filter expression:

```
    filter[asset] = education_levels.grades in ("F1F9FA12-3B53-11E0-A421-F4B24952E9DF", "ABBAABBA-ACDC-ACDC-B042-495E9DFF4B22") and disciplines.subjects.ids in ("495E9DFF-3B53-11E0-B042-C4B222F1FB2F")
```

This example will filter only those assets which are in the grade: "Kindergarten" or "9th Grade" and are in the subject: "Mathematics".

To get the available facets for standards check the `facet_summary` at [facets](/services/ab-connect/introduction/facets) for details.

## Standard Collection

When there is a need to quickly identify and refer to a filtered collection of standards, the "Standard Collection" is what provides a solution. Standard Collection stores the `filters` object `name` and a `guid` as reference.

### List All Standard Collections

* To **list** Standard Collections the partner has access to, send a GET to the endpoint.
* To **find** a Standard Collection by exact name, send a GET to the endpoint with the `collection_name` parameter. This gives back only the case sensitive exact match if there is any.
* To **search** Standard Collections by name, send a GET to the endpoint with the `search_collection_name` parameter. This search uses case insensitive partial matching.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/standard\_collections" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Create a new Standard Collection

To create a Standard Collection within the AB Connects system, you send a POST request to the endpoint. The body of the POST contains the Standard Collection definition in JSON format.

The response will be the same as a GET by GUID request for the created Standard Collection.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/standard\_collections" method="post" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Working with Standards Collection

### Retrieving the Details of a Standard Collection

To get the Standard Collections you've created, call the endpoint with a GET while supplying the AB GUID for the Standard Collection. To retrieve the GUID, use the list and search functionality.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/standard\_collections/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Modifying a Standard Collection

To update a Standard Collection, send a PATCH to the Standard Collection URL (with GUID) sending JSON in the body similar to that in the create statement. The JSON body only needs to contain the attributes that need to be updated. You can update the `name` or `filters` fields for the Standard Collection. You can update only one of these or all.

The response will contain the modified Standard Collection just as it would be in a GET by GUID request for the created Standard Collection.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/standard\_collections/{guid}" method="patch" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Deleting a Standard Collection

To delete a Standard Collection you've created, send a DELETE the endpoint while supplying the AB GUID for the Standard Collection. If you have the name for the Standard Collection but not the AB GUID, see the section on searching for Standard Collections.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/standard\_collections/{guid}" method="delete" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}


# Events

Standards evolve over time. An authority may make a major update to their Standards document. In this case, an authority re-issues an updated document that totally replaces the Standards of the past. This results in a new document being added to your license. Alternately, an authority may modify, remove or add individual Standards within the current document. If your organization is caching Standards data, it is important that you keep your cache fresh. While it is possible to purge your cache and retrieve the entire set of Standards periodically, that is inefficient and does not support the maintenance of alignments and other related data. It is more efficient and useful to request differential updates. With AB Connect, you do this using the `events` endpoint.

In addition to changes to Standards themselves, the `events` endpoint exposes changes to your access to Standards. Your access can change due to licensing changes or configuration of which Standards you have opted to have delivered. For the context of this documentation, we will refer to Standards as "deliverable" regardless of whether the changes were due to license or configuration changes because Events do not treat the various sources of the change differently. For information on changing your licensing or delivery, contact [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29).

## Delivery Related Events And the Interaction Between Deliverability And Change Events

When a document is added to your delivery, you will receive an Event with `target` set to `document` and `change_type` set to `added`. This Event indicates that you should request and download the Standards related to the specified document. E.g. you may receive an Event that looks something like:

```
    ...
    "data": {
        "id": "0ae17409-38fd-4e26-809d-03a309139be2",
        "type": "events",
        "attributes": {
            "seq": 12354,
            "date_utc": "2017-11-12 00:00:00",
            "change_type": "added",
            "target": "document",
            "section_guid": "721CFFCC-9BDD-11E6-ABFB-8C24CDC8CA83",
            "document_guid": "351CFFCC-9BDD-11E6-ABFB-8C24CDC8CA83",
            "affected_properties": []
        },
        "relationships": {
            "standard": {
               "data": {
                }
            },
            "nondeliverable_standard": {
                "data": { }
            },
            "deleted_standard": {
               "data": {
                }
            }
       }
    }
    ...
```

That would initiate a process that requests Standards related to that document:

```
`https://api.abconnect.instructure.com/rest/v4.1/standards?filter[standards]=document.id EQ '351CFFCC-9BDD-11E6-ABFB-8C24CDC8CA83'`
```

Similarly, if you receive an Event with `change_type` set to `removed`, your license requires that you purge the related document and references from your system.

Notes:

* Delivery Events can occur on sections as well as documents.
* Events that occur on Standards that are not delivered to you are not visible to you. The filtering of Events by deliverability is time sensitive so you will not receive Events that occurred on Standards that were not deliverable to you at the time of the Event, even if the Standard is deliverable at the time of the call.
* Since Standards changes are delivered based on the status at the time of the Event, it is possible for you to receive Events on Standards that you no longer have access to. So if you receive a change Event for a Standard and your change management process tries to look up the details of the Standard but doesn't have access, silently skip the process because a `removed` Event is somewhere later in the queue. For example:
  1. You are licensed to Standard A.
  2. You sync up all changes.
  3. Standard A changes so an Event is created and you have access to it.
  4. You remove Standard A from your delivery.
  5. You sync up changes.
  6. You get a change Event for Standard A but you no longer have access to it.
  7. You get a change Event to remove Standard A.

## Accurate Syncing

You can request individual Events but more commonly you would request Events that have occurred since your last sync. In previous versions, the filter for requesting updates focused the filter on the date. However, this can be problematic due to concurrency and race conditions. Now, AB Connect gives each Event a sequence number to ensure no Events are missed. After each refresh, store the sequence number of the last Event you received. Future requests should request Events with sequence numbers greater than the last one you received. E.g. if the last Event you received had a sequence number of 28974, the request may look like:

```
`https://api.abconnect.instructure.com/rest/v4.1/events?filter[events]=seq GT 28974&sort[events]=seq`
```

A couple of important notes about the sequence number:

* Sequence numbers will not appear incremental. Each Event in the system gets a unique number and since the Events include partner specific Events (like changes in license and Standards delivery settings), Events received by any individual partner will not have incremental numbers.

## Using Events As A New Partner

New partners can use `seq GT 0` to start. Since you will not receive Events that occur before your license was active, you won't be flooded with historical data. The first Events you will see will be Events to add documents (and possibly sections). You can use this approach to do the initial download of the Standards into your cache. However, if you've already downloaded all of the Standards you have access to, you will want to skip this first set of Events.

## Developing a Workflow

One of the advantages of using Events is that you can build a workflow around them. You may want to consider caching Events before acting on them in your system. That will allow you to put the changes into an editorial workflow so you can make decisions for accurately updating alignments and other relationships.

For example, if you receive an Event indicating a Standard has been deleted, you may want to flag content aligned to that Standard as being in need of an alignment review.

Unlike Standard change Events, deliverability Events should be acted upon immediately to ensure your system is in line with license agreements.

## Retrieving Events

Using filtering, it is possible to retrieve sets of Events. These Events are returned in an array of Events objects. See the Introduction for an explanation on [filtering](/services/ab-connect/introduction/introduction-to-odata-filters). This section covers the specifics of using these parameters with the Events resource.

A note on filtering Events. Events can be filtered on the properties of the Event object AND on the same subset of properties of the Standards that are listed in the section on [Filtering Resources by Properties on Related Resources](/services/ab-connect/introduction/related-objects#filtering-resources-by-properties-on-related-resources). The exceptions are the Event `affected_properties.new_value` and `affected_properties.previous_value` fields since those are of variant types.

### Finding Series of Events

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/events" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}


# Topics

The Topics resource can be used to access the Academic Benchmarks Topic Taxonomy and related metadata. The API provides a simple integration point, eliminates the need to maintain a copy of the taxonomy locally and provides the foundation for additional connected metadata. Use of the API ensures the most current taxonomy is available to your application.

One of the benefits of AB Connect is the ability to navigate relationships between Topics and Standards. Topics can also be related to other Topics by the nature of their position in the hierarchy of the Topic Taxonomy (parent/child). Retrieving related Standards and Topics is done in a similar fashion as attributes, but they are contained in the JSON API relationships response. Note that due to the JSON API standard, only the type and ID are returned in the relationship data. Keep in mind that the JSON API ID is the same as the AB GUID for these entities. If you'd like to retrieve the data of the related Standards or Topics, use the `include` parameter.

Topics can also be related to Assets. Note that if a Topic is related to an Asset, Standards related to that same Topic automatically become related to the Asset as "predicted" (and vice versa). Relationships between Topics and Assets are managed through the Asset endpoint. See the documentation on the [Asset endpoint](/services/ab-connect/reference/assets) for details.

All calls against the Topics resource must be implemented as HTTP GET requests, and must include proper [Partner Authentication Credentials](/services/ab-connect/introduction/authentication).

Note that the Academic Benchmarks Topic Taxonomy is licensed separately. If your credentials are correct and you are still receiving a 401 error (or no results), check with [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) to ensure you are licensed for Topics.

## Single Topic

In its simplest form, you are able to retrieve the details of a specific Topic by appending the AB GUID to the path portion of the URL.

### Fetching a Topic

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/topics/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Searching for Topics

Using filtering and facets, it is possible to retrieve sets of Topics that match specific criteria. These Topics are returned in an array of Topics objects. See the Introduction for an explanation on [filtering](/services/ab-connect/introduction/introduction-to-odata-filters) and the use of [facets](/services/ab-connect/introduction/facets). This section covers the specifics of using these parameters with the Topics resource.

### Finding Sets of Topics

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/topics" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}


# Concepts

Academic Benchmarks includes a controlled vocabulary of Concepts that has been used for over 15 years to aid in building relationships between content or assessment items (together referred to as Assets) and Standards. AB Connect Content Enrichment tools (Clarifier and prediction engine) are built on top of the Concepts. Each Concept represents a unique notion that a Standard or Asset covers. Academic Benchmarks unpacks Standards into groups of Concepts called `key_ideas` which can be retrieved via the Standards endpoint. Similarly, Assets can be related to Concepts which can act as an intermediary between Assets and Standards.

Topics are a similar intermediary controlled vocabulary but while Topics are comparatively broad or higher level than Standards, Concepts are very granular and operate at the unpacked Standard level.

The Concepts resource can be used to access the Academic Benchmarks Concepts and related metadata. Use of the API ensures the most current Concepts data is available to your application. At this point in time, the Concepts endpoint is relatively simple as the expectation is that partners will use Standards or Topics as a starting point for building an Asset's metadata profile and then refine it using the Clarifier. However, this endpoint does allow the caller to retrieve `context` of the Concept which can clarify ambiguous terms.

The relationship between Concepts and other objects are tracked and reported via the other objects. For example, to understand what Concepts a Standard encompasses, retrieve the `concepts` list via the Standard endpoint (or see the `key_ideas` field). Similarly, the Asset endpoint can be used to associate Assets with Concepts and retrieve the current relationship. See also the Clarifier endpoint to further explore potential relationships between Concepts, Standards and Assets.

All calls against the Concepts resource must be implemented as HTTP GET requests, and must include proper [Partner Authentication Credentials](/services/ab-connect/introduction/authentication).

Note that access to AB Concepts is licensed separately. If your credentials are correct and you are still receiving a 401 error (or no results), check with [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) to ensure you are licensed for Concepts. See the section on [Licensing Considerations](/services/ab-connect/introduction/licensing) for a discussion on the licensing required for access to Key Ideas and Concepts.

## Single Concept

In its simplest form, you are able to retrieve the details of a specific Concept by appending the AB GUID to the path portion of the URL.

### Fetching a Concept

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/concepts/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Searching for Concepts

Using filtering and facets, it is possible to retrieve sets of Concepts that match specific criteria. These Concepts are returned in an array of Concept objects. See the Introduction for an explanation on [filtering](/services/ab-connect/introduction/introduction-to-odata-filters) and the use of [facets](/services/ab-connect/introduction/facets). This section covers the specifics of using these parameters with the Concepts resource.

### Finding Sets of Concepts

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/concepts" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}


# Assets

Academic Benchmarks refers to partner content and assessment items as Assets. In AB Connect, an Asset is the metadata that describes the content - not the actual content itself. The Assets resource can be used to perform a host of operations on partner Assets to allow you to manage and relate your Assets. You can create, modify and delete Assets. You can also build a metadata profile for your Assets which allow you to take advantage of the power of the AB Connect prediction engine to establish and maintain relationships between your Asset, Standards and other Assets. See the section on [Licensing Considerations](/services/ab-connect/introduction/licensing) for a discussion on the licensing required for access to Assets.

In addition to the attributes and relationships built into AB Connect to support Content Enrichment and predictions, AB Connect allows you to define your own attributes to support needs such as advanced searching. These customer defined attributes are referred to as descriptors or custom attributes. They can be configured per Asset type either by you (if you have web access enabled for your account) or by [AB Support](mailto:absupport@instructure.com?subject=Setup%20custom%20properties).

Custom attributes are represented in the API in two ways: through the `descriptors` array or by direct named properties of the custom\_attributes object property. The name of the property is defined in the Asset setup screens. The `descriptors` array was the initial implementation and has been kept for backwards compatibility but the direct named attributes are easier to work with (particularly when filtering) and are the recommended approach. To illustrate the payload for custom attributes, if the Asset type has a property named "Color", it will be represented in the `descriptors` array as an anonymous name/value pair like:

```
    "descriptors": [
        {
            "name": "Color",
            "value": "blue"
        }
    ],
```

However, it will also be represented as a named attribute like:

```
    "custom_attributes": {
        "color": ["blue"]
    },
```

A couple of key points:

* When custom attributes are exchanged in JSON as named attributes, they are converted to lower case and any spaces or special characters are replaced by underscores. Multiple underscores in a row are collapsed into a single underscore. You won't need to think too much about this because the Asset type setup screen shows both the full property name and the JSON API attribute property name.
* It is the responsibility of the client application to control the values of the custom attributes, so if you have single-valued properties or controlled vocabularies in your use case, ensure they are handled properly before sending the data to AB Connect.
* The named attribute is an array. This is because custom attributes are multi-valued in AB Connect. In the `descriptors` array, this is represented by multiple anonymous objects with the same "name" and different "values". For example, if your Asset type is college logos, the University of Michigan Asset may have Color values of blue and yellow. The Color property would appear in the JSON as:

```
    "descriptors": [
        {
            "name": "Color",
            "value": "blue"
        },
        {
            "name": "Color",
            "value": "yellow"
        }
    ],
```

And:

```
    "custom_attributes": {
        "color": ["blue","yellow"]
    },
```

Finally, all calls against the Asset resource must be implemented as HTTP GET, POST, DELETE or PATCH requests, and must include proper [Partner Authentication Credentials](/services/ab-connect/introduction/authentication).

## Creating an Asset

To create an Asset within the AB Connects system, you send a POST to the endpoint. The body of the POST contains the Asset definition in JSON format. The only required fields are `client_id` and `asset_type`. You can define your `asset_type` using the Academic Benchmarks web interface or have support set it up for you. If you do not know your `asset_type` or need to have one setup for you, contact [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) for details.

Note: The Asset endpoint allows you to manipulate basic attributes of the Asset. To manage relationships, see the section on [Managing and Predicting Relationships](https://developerdocs.instructure.com/services/ab-connect/reference/pages/YcYUS1ZchguVbdEtyBoO#managing-relationships-between-assets-and-standards#creating-relationships).

### Creating an Asset

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets" method="post" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Retrieving Assets

To work with an Asset, you've created, call the endpoint with a GET while supplying the AB GUID for the Asset. If you have your organization's ID for the Asset but not the AB GUID, see the section on [finding Assets](#searching-for-assets) and search on `client_id` to retrieve the AB GUID.

### Retrieving the Details of an Asset

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Working with Assets

To work with an Asset you've created, call the endpoint while supplying the AB GUID for the Asset. If you have your organization's ID for the Asset but not the AB GUID, see the section on [finding Assets](#searching-for-assets) and search on `client_id` to retrieve the AB GUID.

### Modifying an Asset

To update an Asset, PATCH the Asset URL (with GUID) sending JSON in the body similar to that in the create statement. The JSON body only needs to contain the attributes that need to be updated. You cannot update the `client_id` or `asset_type` once the Asset is created. If one of those needs to change, you will need to delete the old Asset and create a new one.

Notes on PATCHing Assets:

1. You do not need to include every field in a PATCH body. However, any field you include will replace the current value of that field on the Asset. For simple fields like `title`, that's not surprising. However, if you PATCH an object or array, you need to send the final state of that array or object - not just a single element. E.g. if the Asset has a `descriptor` with 5 name/value pairs on it and you send a PATCH to change 1 name/value pair, be sure to have copies of the other 4 name/value pairs in the `descriptor` array or the resulting Asset will only have one `descriptor` name/value pair.
2. If you are doing a bulk update of Assets where you are requesting a large number of Assets, paging through the list and PATCHing the Assets as you page, be sure to sort the list on a field you are not modifying - preferably on a unique fields like the GUID. If you leave the sort order to the default (relevance) or sort on a field you are changing, you will likely get duplicate and skipped Assets as you page through the list.
3. To create and update relationships on assets, see the section on [Managing and Predicting Relationships](https://developerdocs.instructure.com/services/ab-connect/reference/pages/YcYUS1ZchguVbdEtyBoO#managing-relationships-between-assets-and-standards#creating-relationships).

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}" method="patch" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Deleting Assets

To delete an Asset you've created, call the endpoint while supplying the AB GUID for the Asset. If you have your organization's ID for the Asset but not the AB GUID, see the section on [finding Assets](#searching-for-assets) and search on `client_id` to retrieve the AB GUID.

### Deleting an Asset

Assets can be deleted by sending a DELETE to their "self" URL.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets" method="delete" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Searching for Assets

Using filtering it is possible to retrieve sets of Assets that match specific criteria. These Assets are returned in an array of Asset objects. See the Introduction for an explanation on [filtering](/services/ab-connect/introduction/introduction-to-odata-filters) and [faceting](/services/ab-connect/introduction/facets#using-facets-as-an-entry-point-for-browsing-assets). This section covers the specifics of using filtering with the Assets resource.

To find Assets related to Standards, search based on the Standard GUID in the `alignments.id` field. E.g.

```
filter[assets]=(alignments.id eq '6B29DCD6-29EB-11D8-9C6E-A97B3BAEC73A')
filter[assets]=(alignments.id in ('6B29DCD6-29EB-11D8-9C6E-A97B3BAEC73A','6DF95514-36D9-11E6-B844-14D399AB8BA3'))
```

A similar approach can be applied to Topics and Concepts.

If you have your organization's identifier for the Asset, but not the AB GUID for it, you can retrieve the GUID by doing a search on `client_id` to locate the Asset. E.g.

`filter[assets]=(client_id eq 'AJIH-45679')`

### Searching for Assets Owned by Another Provider

With AB Connect, it is possible to share your Assets with other AB Connect customers (Providers) to facilitate application interoperability. You can allow other Providers (the Consumer) to search sets of your Assets and retrieve the metadata profile describing your content. See the section on the [Providers](/services/ab-connect/reference/providers) endpoint for an overview.

Assets include an `owner` relationship that references the object of the Provider to which the Asset belongs. By default, the Assets endpoint only searches the Assets you own. To search the Assets of other Providers, include `owner.id` in your filter criteria. You can get the IDs of the Owners to which you have access using the Providers endpoint. Alternatively, you can use the special keyword `_all` to search across all repositories to which you have access. E.g. `filter[assets]=owner.id eq _all`. You can also use the keyword `_me` to limit the search to just the Assets you own, but this is redundant with the approach of not specifying the `owner.id` at all.

Note that if you are including other Owners in your request, you can not include `custom_attributes`. Cross-owner searches can only operate on built-in properties.

### Executing the Search

### Finding Sets of Assets

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}


# Asset Definitions

The Asset Definition endpoint provides direct access to the properties on Assets. Asset type is an attribute on an Asset.

The Asset Definitions resource can be used to access different asset types for setting up a browse and filter experience on the Asset resource. See the documentation on the [Asset endpoint](/services/ab-connect/reference/assets) for details.

All calls against the Asset Definitions resource must be implemented as HTTP GET requests, and must include proper [Partner Authentication Credentials](/services/ab-connect/introduction/authentication).

## Retrieving Asset Definitions

In its simplest form, you are able to retrieve the details of a specific Asset Definitions resource by appending the AB GUID to the path portion of the URL.

### Asset Definitions Fetching

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/asset\_definitions/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Searching for Asset Definitions

Using filterings, it is possible to retrieve sets of Asset Definitions that match specific criteria. These Asset Definitions are returned in an array of Asset Definitions objects. See the Introduction for an explanation on [filtering](/services/ab-connect/introduction/introduction-to-odata-filters).

### Finding Sets of Assets Definitions

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/asset\_definitions" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}


# Asset Collections

When there is a need to quickly identify and refer to a filtered collection of assets, the "Asset Collection" is what provides a solution. Asset Collection stores the `filters` object with a `name` and a `guid` as reference.

* The "filters" is a JSON object that stores "assetType" and "facets". Searching filters are generated from this object to narrow down the result set the client wants to use.
* The "name" identifies the asset collection in human readable format.
* The "guid" identifies the asset collection in machine readable format.

## The "filters" object

The "filters" object stores the filtering expression for the asset collection. This stores facets and asset types which helps to filter to only the desired assets.

Here is a formal description about the `filters` object. For a practical explanation see the example below.

* `filters` (object, required) - JSON API object for `filters` object containing various fields like: `assetType` and `facets`.
  * `assetType` (string) - The Asset type defines the Asset's structure and is setup by in Academic Benchmarks an Administrative User.
  * `facets` (array) - List of facets derived from the Asset Definition.
    * (object)
      * `label` (string) - Name of the facet. Derived from Asset Definition: `data[n].attributes.properties[m].label`
      * `id` (string) - Same as `label`.
      * `field` (object) - The field object for the property. Derived from Asset Definition: `data[n].attributes.properties[m].field`.
        * `name` (string) - The API-recognized name for the entity you are filtering by. This is the property you would use when asking for facets.
        * `id` (string) - API identifier for the field which uniquely identifies the entity being filtered by. This is the property you would use when constructing your filter statement as the key field.
      * `facet` (object) - The facets object for the property. Derived from Asset Definition: `data.[n].attributes.properties.[m].facet`
        * `name` (string) - The API Identifier for the human-readable property in the facets response.
        * `id` (GUID) - The API Identifier for the entity-unique property in the facets response. This is the property you would use when constructing your filter statement and thus must correspond with the values in this entity’s `field.id`.
      * `selectedFilters` (array) - The list of selected values for the queries.
        * (object) - This objects holds the elements to which the `facid.id` refers.
          * `data` (object) - The object details for this facet item. See the definition of the object for the specific facet for details, but they all have at least the `descr` and `guid`.
            * `descr` (string) - Facet value text.
            * `guid` (GUID) - Facet value GUID.
            * `code` (string) - Facet value code name.

## Asset filtering expression

Filtering an asset query by a "field" and different "values" in AB API looks like this:

```
    filter[asset] = field_1 in (value_A, value_B)
```

With multiple fields it look like this:

```
    filter[asset] = field_1 in (value_A, value_B) and field_2 in (value_C, value_D)
```

Similar filters are created from the `filters` object. The left side of the query is the same. On the right side the expressions divided by the `and` are generated from the `filters.facets` list elements. The `field_1` and `field_2` are defined by `field.id`. The "values" are those items in the `selectedFilters` object which have the object-path defined in the `facet.id`. If `facet.id == "a.b"` then the values will be `selectedFilters[i].a.b`.

## Example to build a "filter expression" from the "filters" object

Here is a `filters` object. Let's see how filter expression can be generated from it step-by-step:

```
        "filters": {
          "assetType": "NLP_MHE",
          "facets": [
            {
              "label": "Grade",
              "id": "Grade",

              "field": {
                "name": "education_levels.grades",
                "id": "education_levels.grades.guid"
              },
              "facet": {
                "name": "data.descr",
                "id": "data.guid"
              },
              "selectedFilters": [
                {
                  "data": {
                    "descr": "Kindergarten",
                    "guid": "F1F9FA12-3B53-11E0-A421-F4B24952E9DF",
                    "code": "K",
                    "seq": 20
                  }
                },
                {
                  "data": {
                    "descr": "9th Grade",
                    "guid": "ABBAABBA-ACDC-ACDC-B042-495E9DFF4B22",
                    "code": "9",
                    "seq": 20,
                  }
                },
              ],
            },
            {
              "id": "Subject",
              "label": "Subject",
              "field": {
                "name": "disciplines.subjects",
                "id": "disciplines.subjects.ids"
              },
              "facet": {
                "name": "data.descr",
                "id": "data.guid"
              },
              "selectedFilters": [
                {
                  "data": {
                    "descr": "Mathematics",
                    "guid": "495E9DFF-3B53-11E0-B042-C4B222F1FB2F",
                    "code": "MATH"
                  },
                  "count": 2488
                }
              ]
            }
          ]
        }
```

The left side of the expression starts with `filter[asset] =`. There are two elements in the `filters.facets` array, so there will be two expressions on the right side. For example expressions `expr_1` and `expr_2`. These are the basis of the filtering. The `expr_1` is built up from `filters.facets[0]` and the `expr_2` is built up from `filters.facets[1]`.

```
    filter[asset] = expr_1 and expr_2
```

Expressions are built up from a "field" and set of "values". The filter will give back those assets which have given the "values" on the given "field".

```
    expr: field in (values)
```

Let's find the "field" values. In the JSON object the "field" is defined by `field.id`.

```
facets[0].field.id = "education_levels.grades.guid"`
facets[1].field.id = "disciplines.subjects.ids"
```

Substitute these as "fields" into the filter expression.

```
    filter[asset] = education_levels.grades.guid in (values_1) and disciplines.subjects.ids in (values_2)
```

Let's find the "values". The variables' names that are holding the "values" are defined by the `facet.id`. The "values" are those items in the `selectedFilters` object which have the object-path defined in the `facet.id`.

The variable for "values\_1" is `facet.id = "data.guid"`. Let's gather the values from `selectedFilters.data.guid` and generate the "values\_1".

```
    selectedFilters[0].data.guid = "F1F9FA12-3B53-11E0-A421-F4B24952E9DF"
    selectedFilters[1].data.guid = "ABBAABBA-ACDC-ACDC-B042-495E9DFF4B22"
    ==> 
    values_1 = "F1F9FA12-3B53-11E0-A421-F4B24952E9DF", "ABBAABBA-ACDC-ACDC-B042-495E9DFF4B22"
```

The variable for "values\_2" is `facet.id = "data.guid"`. Let's gather the values from `selectedFilters.data.guid` and generate the "values\_2".

```
    selectedFilters[0].data.guid = "495E9DFF-3B53-11E0-B042-C4B222F1FB2F"
    ==> 
    values_2 = "495E9DFF-3B53-11E0-B042-C4B222F1FB2F"
```

Finally substitute the "values" into the filter expression:

```
    filter[asset] = education_levels.grades in ("F1F9FA12-3B53-11E0-A421-F4B24952E9DF", "ABBAABBA-ACDC-ACDC-B042-495E9DFF4B22") and disciplines.subjects.ids in ("495E9DFF-3B53-11E0-B042-C4B222F1FB2F")
```

This example will filter only those assets which are in the grade: "Kindergarten" or "9th Grade" and are in the subject: "Mathematics".

## Asset Collection

When there is a need to quickly identify and refer to a filtered collection of assets, the "Asset Collection" is what provides a solution. Asset Collection stores the `filters` object with a `name` and a `guid` as reference.

### List All Asset Collections

* To **list** Asset Collections the partner has access to, send a GET to the endpoint.
* To **find** an Asset Collection by exact name, send a GET to the endpoint with the `collection_name` parameter. This gives back only the case sensitive exact match if there is any.
* To **search** Asset Collections by name, send a GET to the endpoint with the `search_collection_name` parameter. This search uses case insensitive partial matching.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/asset\_collections" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Create a new Asset Collection

To create an Asset Collection within the AB Connects system, you send a POST request to the endpoint. The body of the POST contains the Asset Collection definition in JSON format.

The response will be the same as a GET by GUID request for the created Asset Collection. See in the "Retrieving the Details of an Asset Collection".

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/asset\_collections" method="post" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Working with Assets Collection

### Retrieving the Details of an Asset Collection

To get the Asset Collections you've created, call the endpoint with a GET while supplying the AB GUID for the Asset Collection. To retrieve the GUID, use the list and search functionality.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/asset\_collections/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Modifying an Asset Collection

To update an Asset Collection, send a PATCH to the Asset Collection URL (with GUID) sending JSON in the body similar to that in the create statement. The JSON body only needs to contain the attributes that need to be updated. You can update the `name`, `filters` or `advanced_search` fields for the Asset Collection. You can update only one of these or all.

The response will contain the modified Asset Collection just as it would be in a GET by GUID request for the created Asset Collection. See in the "Retrieving Assets Collection".

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/asset\_collections" method="patch" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Deleting an Asset Collection

To delete an Asset Collection you've created, send a DELETE the endpoint while supplying the AB GUID for the Asset Collection. If you have the name for the Asset Collection but not the AB GUID, see the section on searching for Asset Collections.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/asset\_collections" method="delete" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}


# Associations (CASE)

The `associations` relationship on Standards provides CASE (Competency and Academic Standards Exchange) identifiers matched to Academic Benchmarks standards. CASE is a machine-readable format for exchanging competency frameworks and academic standards. [Satchel Rosetta Exchange](https://rosetta.commongoodlt.com/) is a publicly available portal that aggregates learning standards from all 50 US states and dozens of other countries in CASE format, where each standard is identified by a globally unique CFItem GUID.

AB Connect automatically matches Satchel Rosetta Exchange CFItem identifiers to AB standards using similarity matching. Associations represent the best Satchel Rosetta Exchange counterpart for each AB standard — matches are not exhaustive but are selected by confidence. Multiple AB standards can share the same CASE GUID when they correspond to the same Satchel Rosetta Exchange item. Matches are refreshed weekly as part of the regular standards publish cycle.

Access to the `associations` relationship requires a Professional license. If your credentials are correct and you are still receiving a 401 error (or no results), check with [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) to ensure your license includes associations.

> CASE® is a registered trademark of 1EdTech Consortium, Inc. Satchel Rosetta Exchange was formerly known as CASE Network 2.

## Requesting Associations

Like other relationships, `associations` must be explicitly requested using the `fields` parameter:

```
`https://api.abconnect.instructure.com/rest/v4.1/standards/{guid}?fields[standards]=associations`
```

This returns the `associations` relationship data in the `relationships` section of the response. Each association contains the `type` and `id` (the CASE CFItem GUID) of the matched standard.

To include the full resource details of the associated standards, add the `include` parameter:

```
`https://api.abconnect.instructure.com/rest/v4.1/standards/{guid}?fields[standards]=associations&include=associations`
```

### Example Request

```
GET /rest/v4.1/standards/A2345678-1234-5678-9ABC-DEF012345678?fields[standards]=statement,number,associations&include=associations
```

### Example Response

```json
{
    "data": {
        "id": "A2345678-1234-5678-9ABC-DEF012345678",
        "type": "standards",
        "attributes": {
            "statement": {
                "descr": "Solve real-world and mathematical problems involving area..."
            },
            "number": {
                "enhanced": "CCSS.Math.Content.6.G.A.1"
            }
        },
        "relationships": {
            "associations": {
                "data": [
                    {
                        "type": "standards",
                        "id": "B9876543-ABCD-EF01-2345-6789ABCDEF01"
                    }
                ],
                "links": {
                    "related": "https://api.abconnect.instructure.com/rest/v4.1/standards/A2345678-1234-5678-9ABC-DEF012345678/associations"
                }
            }
        }
    },
    "included": [
        {
            "id": "B9876543-ABCD-EF01-2345-6789ABCDEF01",
            "type": "standards"
        }
    ]
}
```

## Filtering by Associations

You can filter standards to find only those that have CASE matches:

```
`filter[standards]=(not isempty(associations))`
```

This can be combined with other standard filters. For example, to find California standards with CASE associations:

```
`filter[standards]=(document.publication.authorities.descr eq 'California DOE' and not isempty(associations))`
```

Note that filtering by a specific CASE GUID (reverse lookup) is not currently supported. To find the AB standard for a known CASE identifier, retrieve standards with associations and match on the client side.

## Licensing

The `associations` relationship requires a Professional license. See [Licensing Considerations](/services/ab-connect/introduction/licensing) for more details on licensing in AB Connect.


# Managing and Predicting Relationships

One of the most powerful features of AB Connect is the ability to build, predict and navigate relationships. These relationships are managed by direct connection (e.g. relating a Standard to an Asset), indirect reference (e.g. relating entities based on mutual relationships with other entities), prediction (when the system suggests a relationship) and through other system derived means. The following sections explain how to manage these relationships.

Note that some relationships are complex having multiple properties that exist on the relationship. These relationships are represented in AB Connect as relational objects and have their own endpoints. These relationship objects are not covered here but have their own sections in the documentation.

## Content Enrichment Overview

AB Connect offers a Content Enrichment service which helps to establish, maintain and predict relationships between Assets (content, assessment items, etc.), Standards, Topics, Concepts and other Assets. This system uses the Asset metadata profile, learning algorithms and relationship data we've built over 15 years of aligning content. Content Enrichment makes your Assets more discoverable and aids in building relationships. Content Enrichment uses intermediaries like Topics, Concepts and Key Ideas when relating Asset and Standards.

The AB Topic Taxonomy is a broad taxonomy used for general categorization of Standards. Every Standard in the core four subjects (language arts, math, science and social studies) is associated with at least one Topic. The use of Topics builds relationships quickly and easily. When a Standard is related to an Asset, a predicted relationship between the Asset and one or more Topics is established. This is a bi-directional capability so establishing a relationship between a Topic and an Asset will create predicted relationships between the Asset and Standards (typically multiple Standards - across all authorities in your license). The use of Topics to enrich your Assets is a very efficient way to power search-by-Standard capabilities in your system and enable the fast discovery of relationships.

The AB Concept Taxonomy is a granular means for identifying precise relationships between Standards and Assets. Concepts represent individual notions covered by an Asset or Standard. Concepts are linked together to build Key Ideas that are then associated with Standards. Key Ideas are similar to unpacked Standards and are a key component to the AB Content Enrichment Engine. As an Asset's Concept profile is defined, the prediction engine is able to more accurately predict relationships between the Asset and new Standards. Note that the prediction engine utilizes the Disciplines and Education Levels specified in the Assets and Standards profiles (when present) to assist in predictions. Connecting an Asset to Concepts or Standards outside of the Asset's Discipline and Education Level profile will not aid or alter the predictions or clarifications. See [Managing Relationships Between Assets and Concepts](#managing-relationships-between-assets-and-concepts)

for details on tagging content with Concepts and the section on [Standards](/services/ab-connect/reference/standards) for information on retrieving Key Idea data from a Standard.

However you choose to enrich your content, calling the Predictions endpoint engages the engine to predict relationships between your Asset and other entities in the system. While many aspects of the Asset metadata profile can impact predictions, the predictions are not actually generated until the predictions endpoint is called. This is true for changes in disciplines, education levels and relationships to Standards, Topics, Concepts and donors. See [Managing and Predicting Relationships](#getting-and-updating-predictions) for details on using the prediction engine.

While a detailed explanation of Content Enrichment is beyond the scope of this API documentation, you can get more information by contacting [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) at Instructure or your sales representative.

Note that use of Academic Benchmarks Assets, Topics, Concepts and Clarifier is enabled through licensing. See the section on [Licensing Considerations](/services/ab-connect/introduction/licensing) for a discussion on how to enable these features.

### The Effect of Metadata on Predictions and Clarifications

AB Connect uses the metadata profiles of Topics, Standards and Assets to understand relationships, recommend additional relationships and determine where the recommendation engine needs further clarification. The profiles can impact the engine in many ways. A couple of things to be aware of when working with AB Connect and relationships between Assets, Topics and Standards:

* If disciplines and education levels are defined on an Asset, they should match or at least overlap with those on the Topic or Standard if you hope to have the relationship shape the recommendations made by the system. When the descriptions do not match, the engine ignores the relationship for the purpose of recommendations and requesting clarifications.
* Standards that do not have an utilization type of "alignable" typically do not impact future recommendations for the Asset relationships.
* If you are working with Assets that are using v2 of the prediction engine (see the prediction\_algorithm field), creating, deleting and modifying relationships between the Asset and Standards, Concepts or Topics upgrades the prediction algorithm to v3.

For example, if you have a 3rd grade Asset (`education_levels.grades.code eq '3'`) and create a relationship between that Asset and the middle school Topic "Solving Equations", the system will not predict any relationships to Standards because the grade ranges don't match between the Topic and Asset.

### Locating Recent Changes to Relationships Between Assets and Standards

Some AB Connect customers prefer to cache Asset and Standards data within their system and refresh the data periodically. To make this process more efficient and to support customer processes where changes may go through an internal review process, AB Connect allows you to search for Assets by the date that a relationship between a Standard and Asset changed. To do this, search for Assets where `date_alignments_modified_utc` is greater than a certain point in time. E.g.

```
    /assets?filter[assets]=(date_alignments_modified_utc gt '2017-09-12 12:00:00')
```

Once you have a list of Assets where their relationships with Standards have changed recently, you can filter on the related Standards by date to see which specific changes have been made. E.g.

```
    /assets/00005A1C-3229-11E6-9E77-9DD429C466BA/alignments?filter[alignments]=(meta.date_modified_utc gt '2017-09-12 12:00:00')
```

```
    /assets/00005A1C-3229-11E6-9E77-9DD429C466BA/alignments?filter[alignments]=(meta.date_created_utc gt '2017-09-12 12:00:00')
```

```
    /assets/00005A1C-3229-11E6-9E77-9DD429C466BA/deleted_alignments?filter[deleted_alignments]=(meta.date_deleted_utc gt '2017-09-12 12:00:00')
```

### Retrieving Standards Related to an Asset that Meet Certain Criteria

Some AB Connect customers display "alignments" (relationships between Assets and Standards) with their content. Often, they will know the Authority associated with the browser (e.g. a teacher registered in an LMS may have their state in their profile). In this case, it is possible to retrieve only the given Authority's Standards related to this Asset. To do this, search for Standards related to the Asset and filter the Standards by Authority. E.g.

```
    /assets/00005A1C-3229-11E6-9E77-9DD429C466BA/alignments?filter[alignments]=(meta.disposition eq 'accepted' and document.publication.authorities.descr eq 'Texas DOE')&fields[standards]=number.enhanced,statement.descr
```

This same concept can be used to filter on any of the "meta" fields on the relationship and the Standards properties listed in [Filtering Resources by Properties on Related Resources](/services/ab-connect/introduction/related-objects#filtering-resources-by-properties-on-related-resources).

### Retrieving Topics Related to an Asset that Meet Certain Criteria

Similar to the Standards based example above, you may want to retrieve related Topics that are accepted. To do this, search for Topics related to the Asset and filter the disposition. E.g.

```
    /assets/00005A1C-3229-11E6-9E77-9DD429C466BA/topics?filter[topics]=(meta.disposition eq 'accepted')
```

This same concept can be used to filter on any of the "meta" fields on the relationship and the Topics properties listed in [Filtering Resources by Properties on Related Resources](/services/ab-connect/introduction/related-objects#filtering-resources-by-properties-on-related-resources).

### Retrieving Concepts Related to an Asset that Meet Certain Criteria

Similar to the examples above, you may want to retrieve related Concepts that are central. To do this, search for Concepts related to the Asset and filter the emphasis. E.g.

```
    /assets/00005A1C-3229-11E6-9E77-9DD429C466BA/concepts?filter[concepts]=(meta.emphasis eq 'central')
```

This same concept can be used to filter on any of the "meta" fields on the relationship and the Concepts properties listed in [Filtering Resources by Properties on Related Resources](/services/ab-connect/introduction/related-objects#filtering-resources-by-properties-on-related-resources).

## Managing Relationships Between Assets and Standards

AB Connect allows you to connect your Assets directly to Standards. Establishing relationships between Assets and Standards can power services like searching for Assets by Standards and gap analysis. Building (and rejecting) direct relationships like this can also be the first step accelerating Content Enrichment. Direct relationships can be very helpful in building and managing your Asset library but full Content Enrichment with intermediaries like Topics and Concepts can greatly accelerate the process and broaden the network of relationships quickly and efficiently.

### Creating Relationships

You can create (and add) a direct relationship between an Asset and Standards by POSTing to `/assets/{guid}/alignments`. You can "accept" or "reject" a direct relationship. Accepting one is indicating that the relationship has been reviewed and is correct. Rejecting a relationship indicates that the relationship has been reviewed and there is no relationship between the Asset and Standard. This is known as the disposition of the relationship.

In addition to specifying the disposition, for accepted relationships, you can associate tags with the relationship. The meaning of the tag is partner defined and the following values are accepted:

* Excellent
* Good
* Moderate
* Encompassing
* Exact
* Related
* Partial
* Limited
* Best One
* Maybe

Since JSON API does not allow direct properties on relationships, the disposition and tags are stored in the relationship metadata.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/alignments" method="post" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Updating and Deleting All Relationships

To replace all existing relationships between and Asset and some Standards, PATCH the endpoint sending the new relationships in the PATCH body. The body is in the same format as when creating a relationship. In JSON API, relationships either exist or do not, so there isn't a mechanism to directly support altering relationship properties of a subset of the relationships. In order to alter the metadata on one or more relationships (e.g. `disposition` or `tags`), you must PATCH all relationships including the desired metadata for each relationship. Any relationships or relationship metadata properties NOT included in the PATCH body will be removed. Note that you can remove ALL relationships between Assets and Standards by sending an empty set in the PATCH body. E.g. `{ "data": [] }`

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/alignments" method="patch" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Removing Specific Relationships

It is possible to remove specific relationships between an Asset and one or more Standards using the DELETE method and including the Standards you'd like to remove from the Asset.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/alignments" method="delete" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Filtering and Paging Relationships Between Assets and Standards

AB Connect allows you to filter and page through the list of Standards related to an Asset. This can be helpful if you are wanting to limit the alignments you are showing a user to those in their specified state or if you are caching Assets and only want to retrieve alignments that have changed since the last time you cached the data (for example).

You can filter and sort on relationship properties like `meta.disposition` and `meta.date_modified_utc` or on Standards properties. If you are using Standards properties in your filtering and sorting, you are limited to the fields listed in the Standards section of the [Filtering Resources by Properties on Related Resources](/services/ab-connect/introduction/related-objects#filtering-resources-by-properties-on-related-resources) documentation. Note that when using Standards properties for filtering here, you can drop the `alignments.` from the property name.

### Fetching Related Standards

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/alignments" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Filtering and Paging Deleted Alignments

AB Connect allows you to filter and page through the list of Standards that used to be related to an Asset. This can be helpful if you are caching Assets and only want to retrieve alignments that have changed since the last time you cached the data. This is the only way to get the list of deleted alignments.

### Fetching Formerly Related Standards

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/deleted\_alignments" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Managing Relationships Between Assets and Topics

If you have licensed the Academic Benchmarks Topic Taxonomy (here referred to simply as Topics), Topics can assist with Asset searches and be a powerful tool to help establish relationships between Assets and Standards. One of the most powerful features of AB Connect is the ability to build, predict and navigate relationships. These relationships are managed by direct connection (e.g. relating a Topic to an Asset), indirect reference (e.g. automatically relating to Topics based in their relationships to Standards) and through other system derived means. The process of developing these relationships and describing an Asset with metadata is known as Content Enrichment because by associating an asset with the Academic Benchmark metadata, you gain access to a rich network of additional relationships that can serve to power search and discovery, alignment processes, and navigability within content.

Content Enrichment with the Academic Benchmarks Topic Taxonomy enables coarse-grained description and relationship management. The Topic Taxonomy was developed with browsability in mind, ...not only controlling the vocabulary, but also the organization in a rigid 4-level hierarchy that includes Subject > Grade Band > Branch > Topic. Topics represetn what should be learned at a broad level. The coarse-grained nature of the AB Topic Taxonomy enables a simple relationship management mechanism and can be used in your search technologies for advanced and efficient discovery capabilities. At its simplest, establishing a relationship between an Asset and a Topic enables AB Connect to predict relationships between the Asset and Standards. This is a bi-directional relationship, so the process could alternatively start with creating a direct relationship between a Standard and Asset which would predict relationships between the Asset and one or more Topics.

If you are in need of tighter relationship management, see [Concepts](/services/ab-connect/reference/concepts) and [Managing Relationships Between Assets and Concepts](#managing-relationships-between-assets-and-concepts).

Enriching your Asset with Topics:

1. If you don't already have Assets in the system, [create an Asset](/services/ab-connect/reference/assets#creating-an-asset)
2. Use the [filtering capability](/services/ab-connect/introduction/introduction-to-odata-filters) to [locate relevant Topics](/services/ab-connect/reference/topics#searching-for-topics)
3. Create a relationship between the Topic and Asset (see below)
4. Update the predictions made by the system (see [Managing and Predicting Relationships](#getting-and-updating-predictions) ).
5. Now if you [retrieve the Asset](/services/ab-connect/reference/assets#retrieving-assets), you'll see the `accepted` Topic relationship and a number of `predicted` Standards relationships
6. You can review the Standards and confirm the relationship between the strong matches and the Asset by [creating a direct `accepted` relationship](#managing-relationships-between-assets-and-standards)
7. You can also reject bad matches and delete erroneous matches.

Note that use of Academic Benchmarks Assets, Topics, Concepts and Clarifier is enabled through licensing. See the section on [Licensing Considerations](/services/ab-connect/introduction/licensing) for a discussion on how to enable these features.

### Creating Relationships

You can create (and add) a direct relationship between an Asset and Topics by POSTing to `/assets/{guid}/topics`. You can "accept" or "reject" a direct relationship. Accepting one is indicating that the relationship has been reviewed and is correct. Rejecting a relationship indicates that the relationship has been reviewed and there is no relationship between the Asset and Topic. This is known as the disposition of the relationship. Since JSON API does not allow direct properties on relationships, the disposition is stored in the relationship metadata.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/topics" method="post" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Updating and Deleting All Relationships

To replace all existing relationships between and Asset and some Topics, PATCH the endpoint sending the new relationships in the PATCH body. The body is in the same format as when creating a relationship. In JSON API, relationships either exist or do not, so there isn't a mechanism to directly support altering relationship properties of a subset of the relationships. In order to alter the metadata on one or more relationships (e.g. `disposition`), you must PATCH all relationships including the desired metadata for each relationship. Any relationships or relationship metadata properties NOT included in the PATCH body will be removed. Note that you can remove ALL relationships between Assets and Topics by sending an empty set in the PATCH body. E.g.

```
{
    "data": []
}
```

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/topics" method="patch" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Removing Specific Relationships

It is possible to remove specific relationships between an Asset and one or more Topics using the DELETE method and including the Topics relationships to remove from the Asset.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/topics" method="delete" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Filtering and Paging Relationships Between Assets and Topics

AB Connect allows you to filter and page through the list of Topics related to an Asset. This can be helpful if you are wanting to limit the Topics you are showing a user to those that have been accepted (for example).

You can filter and sort on relationship properties like `meta.disposition` or on Topics properties. If you are using Topics properties in your filtering, you are limited to the fields listed in the Topics section of the [Filtering Resources by Properties on Related Resources](/services/ab-connect/introduction/related-objects#filtering-resources-by-properties-on-related-resources) documentation. Note that when using Topics properties for filtering here, you can drop the `topics.` from the property name.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/topics" method="delete" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Fetching Related Topics

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/topics" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Managing Relationships Between Assets and Concepts

If you have licensed the Academic Benchmarks Concept Taxonomy, Concepts enable detailed definition of Asset metadata profiles which power precise search and relationship prediction capabilities. The Asset metadata included describes the Asset with a controlled vocabulary to reflect what should be learned at the most granular level. This level of granular description, combined with machine learning technology, results in an Asset profile that learns from user input, and updates recommendations automatically, facilitating easier change management of Standards. Beyond relationships management, Concepts can be used in your search technologies for advanced and efficient search capabilities.

The process of developing these relationships and describing an Asset with metadata is known as Content Enrichment because by associating an asset with the Academic Benchmark metadata, you gain access to a rich network of additional relationships that can serve to power search and discovery, alignment processes, and navigability within content. When you establish a relationship between a Concept and an Asset, you will notice that the system predictions between the Asset and Standards change and tighten. The Clarifier helps you to tune the system predictions and can be a very powerful addition to your arsenal. See the [Clarifier documentation](#request-a-clarification) for details.

Here is an easy approach for tagging your Asset with Concepts:

1. If you don't already have Assets in the system, [creating an Asset](/services/ab-connect/reference/assets#creating-an-asset)
2. Use the [filtering capability](/services/ab-connect/introduction/introduction-to-odata-filters) to [locate one relevant Standard](/services/ab-connect/reference/standards#searching-for-standards)
3. Create a relationship between the [Standard and Asset](#managing-relationships-between-assets-and-standards)
4. Now if you [retrieve the Asset](/services/ab-connect/reference/assets#retrieving-assets), you'll see the `accepted` Standard relationship
5. Update the predictions made by the system (see [Managing and Predicting Relationships](#getting-and-updating-predictions) ).
6. Use the Clarifier to [request clarification](#request-a-clarification) Standards and Concepts.
7. Confirm relationships with Concepts (see below) and/or additional [Standards](#managing-relationships-between-assets-and-standards) to refine the metadata profile for the Asset
8. Update the predictions made by the system.
9. Repeat the clarification steps until the content is fully tagged and predicted relationships are strong.

Note that the `context` of the Concept is important. Any decisions regarding a relationship between a Concept and an Asset should be made with the `context` taken into consideration.

Note that use of Academic Benchmarks Assets, Topics, Concepts and Clarifier is enabled through licensing. See the section on [Licensing Considerations](/services/ab-connect/introduction/licensing) for a discussion on how to enable these features.

### Creating Relationships

You can create (and add) a relationship between an Asset and Concepts by POSTing to `/assets/{guid}/concepts`. Concepts have different types of relationships with Assets than Topics and Standards. Instead of accepting or rejecting a disposition, Concept relationships have an emphasis of either `central`, `related`, `not_applicable` or `avoid`. `central` indicates that the Concept is one of the key notions covered by the Asset. `related` indicates that the Asset covers the Concept but it is not core to the Asset. `not_applicable` indicates that the Concept is **NOT** relevant to the Asset (used to clarify Concepts to aid in predicting relationships). `avoid` indicates that this Concept is not only irrelevant to the Asset but Standards that relate to this Concept should be avoided when predicting relationships. Since JSON API does not allow direct properties on relationships, the disposition is stored in the relationship metadata.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/concepts" method="post" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Updating and Deleting All Relationships

To replace all existing relationships between and Asset and some Concepts, PATCH the endpoint sending the new relationships in the PATCH body. The body is in the same format as when creating a relationship. In JSON API, relationships either exist or do not, so there isn't a mechanism to directly support altering relationship properties of a subset of the relationships. In order to alter the metadata on one or more relationships (e.g. `emphasis`), you must PATCH all relationships including the desired metadata for each relationship. Any relationships or relationship metadata properties NOT included in the PATCH body will be removed. Note that you can remove ALL relationships between Assets and Concepts by sending an empty set in the PATCH body. E.g.

```
{
    "data": []
}
```

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/concepts" method="patch" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Removing Specific Relationships

It is possible to remove specific relationships between an Asset and one or more Concepts using the DELETE method and including the Concepts remove from the Asset.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/concepts" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Filtering and Paging Relationships Between Assets and Concepts

AB Connect allows you to filter and page through the list of Concepts related to an Asset. This can be helpful if you are wanting to limit the Concepts you are showing a user to those that are central (for example).

You can filter and sort on relationship properties like `emphasis` or on Concepts properties. If you are using Concepts properties in your filtering, you are limited to the fields listed in the Concepts section of the [Filtering Resources by Properties on Related Resources](/services/ab-connect/introduction/related-objects#filtering-resources-by-properties-on-related-resources) documentation. Note that when using Concepts properties for filtering here, you can drop the `concepts.` from the property name.

### Fetching Related Concepts

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/concepts" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Managing Relationships Between Assets

It is possible to configure the properties of an Asset to allow inter-Asset relationships to be managed. These are very rare use cases. If you have a need to express Asset-to-Asset relationships within AB Connect, start the project with a conversation with [AB Support](https://certicasolutions.freshdesk.com/support/tickets/new) to discuss your use case. AB Support can setup your Asset configuration (`asset_type`) to allow you to manage these relationships.

AB Connect can support three inter-Asset relationship types:

1. `parent` - The parent relationship allows you to build a Asset hierarchy. No additional properties, data or services are conveyed through this relationship. It is simply a means for expressing a hierarchy. Note that there is no reciprocal `children` property and an Asset can have only one parent.
2. `alignment_donors` - Alignment Donors are Assets that convey relationships with Standards and Topics to their Recipients. A Recipient is an Asset that has one or more Assets listed in its `alignment_donors` relationship. Notes:
   1. Alignment Donor Assets (Assets appearing in an `alignment_donor` list on some other Asset) can not be deleted. To delete an Alignment Donor, remove it from all `alignment_donor` relationships and then delete the Asset.
   2. Only Standards and Topics relationships with a disposition of `predicted` or `accepted` are conveyed to Recipients.
   3. In the event of disposition conflict in the Donors, `accepted` takes precedence.
   4. The relationship conveyence is dynamic so changes to Donors are reflected in Recipients. However, if an alignment (relationship to a Standard) is changed on the Alignment Donor, the new alignment will not appear on the Recipient until the Recipient Asset's predictions have been updated.
   5. Standards and Topics relationships can be applied directly to Recipients to augment or override relationships conveyed from Donors.
   6. It is not possible to delete conveyed relationships but it is possible to override them by creating the same relationship directly on the Recipient but setting the disposition to `rejected`.
3. `concept_donors` - Concept Donors are Assets that convey relationships with Concepts to their Recipients. A Recipient is an Asset that has one or more Assets listed in its `concept_donors` relationship. Notes:
   1. Concept Donor Assets (Assets appearing in a `concept_donors` list on some other Asset) can not be deleted. To delete a Concept Donor, remove it from all `concept_donors` relationships and then delete the Asset.
   2. In the event of emphasis conflict in the Donors, the order of precedence is `central`, `related`, `not_applicable` and then `avoid`.
   3. Unlike Alignment Donors, with Concept Donors, Concepts relationships can NOT be applied directly to Concept Recipients.
   4. The relationship conveyence is dynamic so changes to Donors are reflected in Recipients.
      1. If a Concept is added, modified or deleted from a Donor, the Concept relationship change does not show up immediately on the Recipients. In order for the change to propagate to the Recipient, the Recipient has to be modified (be POSTed or PATCHed to) or the Recipient Asset's predictions have been updated.
      2. If a Concept is added, modified or deleted from a Donor, the relationship predictions on the Recipient are not updated until the Recipient Asset's predictions have been updated.

### Creating Relationships

You can create (and add) a relationship between Assets by POSTing to `/assets/{guid}/{relationship}`. Parent relationships are single entities. The others must be arrays.

#### Alignment Donors

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/alignment\_donors" method="post" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

#### Concept Donors

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/concept\_donors" method="post" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Updating and Deleting All Relationships

To replace all existing relationships between an Asset and its `alignment_donors` or `concept_donors`, PATCH the endpoint sending the new relationships in the PATCH body. The body is in the same format as when creating a relationship. In order to alter the relationships with PATCH, you must include all relationships you'd like to retain in the request. Any relationships of this type that are NOT included in the PATCH are removed. Note that you can remove ALL relationships between Assets and Concepts by sending an empty set in the PATCH body. E.g.

```
{
    "data": []
}
```

#### Alignment Donors

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/alignment\_donors" method="patch" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

#### Concept Donors

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/concept\_donors" method="patch" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Removing Specific Relationships

It is possible to remove specific relationships between a Assets using the DELETE method and including the Assets to remove.

#### Alignment Donors

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/alignment\_donors" method="delete" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

#### Concept Donors

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/assets/{guid}/concept\_donors" method="delete" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Generating Predictions

The Predictions endpoint allows you to predict relationships between unrelated entities. AB Connect currently supports three prediction scenarios:

* Predict Standards alignments and Topics for an Asset based on the metadata description of the Asset and machine learning algorithms
* Predict Standards alignments for an Asset based on Crosswalk relationships
* Predict Assets that would align to a Standard based on Crosswalk relationships

Note that access to Predictions is licensed. If your credentials are correct and you are still receiving a 401 error (or no results), check with [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20%3APredictions%20Licensing) to ensure you are licensed for Predictions. See the section on [Licensing Considerations](/services/ab-connect/introduction/licensing) for a discussion on the licensing required for access to Predictions.

Working with Predictions for an Asset is implemented as follows:

```
    POST Predictions to start the calculation process
    if queue-status Response has code pending
        loop until queue-status has code complete
            GET queue-status with max_wait=25
        endloop

    if you want to review Predictions, GET Predictions and page/filter through them
    POST to Predictions/Asset to update Predictions on Asset
```

Predicting Assets for Standards is implemented as follows:

```
    POST Predictions to start the calculation process
    if queue-status Response has code pending
        loop until queue-status has code complete
            GET queue-status with max_wait=25
        endloop

    Review Predictions, GET Predictions and page/filter through them
    Determine which Assets should get alignments to the standard in question
    POST new alignments to those Assets
```

### Calculating the Latest Predictions

Using the POST method, you can generate a set of predictions for the specified scenario. Calculating Predictions does not create relationships. It just calculates what relationships appear to be relevant. The relationships can be established as a later step. There are two algorithms for generating Predictions: machine learning and crosswalk relationships.

**Machine Learning** The machine learning algorithm for predicting relationships is called the "confidence" algorithm. At this point, confidence can only be used to predict Standards and Topics alignments for Assets. Attempting to use confidence to predict Assets for a Standard will result in an error. The Topics relationships are predicted based on the established relationships between the Topics and Standards already aligned to the Asset. Standards relationships are predicted based on the metadata definition of the Asset which includes alignments to other Standards, Topics, Concepts, subjects, etc.

**Crosswalks** When Crosswalks are used for prediction purposes, they represent two corners of a triangle, with an asset providing the third corner. Using existing alignments (and traversing the edges of the triangle), the system provides predictions of both new standards to assets as well as unaligned assets to new standards. This algorithm uses the Crosswalk relationships between Standards to identify additional relevant Standards. In the case of predicting related Assets, the system walks the Standards relationships and identifies Assets related to the connected Standards.

Note that the Crosswalk relationships are available directly to the calling application through the Standards endpoint, but the predictor simplifies use by navigating common relationships to generate Crosswalks between documents that aren't directly related. E.g. if you are attempting to predict from an Indiana Standard to a New Jersey Standard and Academic Benchmarks has not directly curated relationships between those documents, the predictor will use an intermediary document (perhaps one in Texas) to synthesize the relationships for the predictions. Note that the steps the system had to take to establish the prediction is available in the `steps` property. Predictions with 1 step are from directly connected Standards. Predictions with 2 are generated by walking from one authority to a common document then to the second authority. In this case, the relationships may lose some precision.

**Usage** Sometimes calculating Predictions can be resource intensive and take several seconds or even a few minutes. For this reason, the Predictions endpoint uses a queue model. The request to calculate Predictions returns a `queue-status` object. The `queue-status` object indicates the state of the queued processing of Predictions. If the calculations complete quickly (less than 30 seconds), the request response will indicate that the calculations are complete and you can GET the Predictions right away. If the calculations go beyond 30 seconds, the response will indicate that the calculations are continuing in which case you will need to check the queue periodically until you receive a response indicating that the calculations are complete. See [Fetching the Prediction Queue Status](#checking-the-prediction-queue-status) for details on polling the queue.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/predictions" method="post" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

Note that both the `queue-status` and `predictions` objects have GUIDs that are different from the related Asset GUID. If you are checking the queue status, use the `links.self` URL or construct the URL manually using the GUID in the `data.id` property. Similarly, once the predictions are complete, use the `relationships.predictions.links.related` property to locate the predicted alignments.

## Checking the Prediction Queue Status

The Queue Status endpoint allows you to check on the Predictions calculations progress for long running Predictions.

### Fetching the Queue Status

Using the GET method, you can retrieve the `queue-status` and check the `data.attributes.code` field. `pending` means the Predictions are still being calculated. `complete` means the Predictions are ready. See the `data.relationships.predictions.links.related` property for a link to the results.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/predictions/queue-status/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Retrieving Predictions

The Predictions endpoint allows you to retrieve the details of the Prediction set (like when it expires, what Asset it is related to) and start paging through predicted relationships.

Note that access to Predictions is licensed. If your credentials are correct and you are still receiving a 401 error (or no results), check with [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) to ensure you are licensed for Predictions. See the section on [Licensing Considerations](/services/ab-connect/introduction/licensing) for a discussion on the licensing required for access to Predictions.

### Fetching the Predictions

Using the GET method, you can see what predictions the engine makes for the Asset metadata profile using the GUID or related URL (`relationships.predictions.links.related`) returned when calculating the predictions.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/predictions/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Filtering and Paging Predictions

AB Connect allows you to filter and page through predicted standards. You can filter and sort on relationship properties like `meta.score` or on the item properties themselves.

### Fetching Related Standards

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/predictions/{guid}/standards" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Fetching Related Topics

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/predictions/{guid}/topics" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Updating Predictions on the Asset

To commit the Predictions to the Asset as alignments, POST to the `predictions/assets` endpoint supplying the Predictions GUID. This updates the predicted alignments on the Asset, replacing any previously predicted alignments and creating new deleted\_alignments as appropriate.

### Updating Predictions on the Asset

Note that the POST has no request nor response body.

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/predictions/{guid}/asset" method="post" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Request a Clarification

One key component to the prediction engine is the Clarifier which can be used on an Asset to request Concepts and Standards for which the system needs clarification regarding the status of the relationship between the Asset and Concepts/Standards. As the user provides input about clarifications, the system refines its calibration for the ranking of Asset-Standards relationship predictions. The Clarifier, combined with setting the disposition of Standards and the emphasis of Concepts, helps the user build an Asset profile that continues to learn and adapt as input is provided, making search capabilities stronger and relationship maintenance far simpler.

To retrieve clarifications for an Asset, call the Clarifier endpoint appending the AB GUID of the Asset in question to the path portion of the URL. If you do not know the AB GUID for the Asset in question, you can search the Asset endpoint filtering on the `client_id` which should be your ID for the Asset. See the section on [Assets](/services/ab-connect/reference/assets#searching-for-assets) for details on searching for Assets.

Note that access to the Clarifier is controlled by licensing. If your credentials are correct and you are still receiving a 401 error (or no results), check with [AB Support](mailto:absupport@instructure.com?subject=AB%20Connect%20Question%20or%20Comment%20%28v4.1%20API%29) to ensure you are licensed for the Clarifier. See the section on [Licensing Considerations](/services/ab-connect/introduction/licensing) for a discussion on the licensing required for access to the Clarifier.

### Fetching a Clarification

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/clarifier/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Filtering and Paging Relationships on Standards

AB Connect allows you to filter and page through related objects. You can filter and sort on relationship properties like `meta.same_text` or, in the case of Concepts, `descr` or `context`.

### Fetching Related Standards

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/standards/{guid}/{relationship}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Fetching Related Topics

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/standards/{guid}/topics" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

### Fetching Related Concepts

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/standards/{guid}/concepts" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Filtering and Paging Relationships on Topics

AB Connect allows you to page through objects related to the Topic. Filtering the list of related objects is not supported at this point in time.

### Fetching Related Objects

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/topics/{guid}/{relationship}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}


# Providers

The Providers resource can be used to retrieve information about your Provider account as well as Providers that have shared all or some of their Assets with your organization and Providers with whom you have shared Assets. You can list all of the Providers related to you, filter the list of related Providers or lookup a specific Provider. The response contains the name of the related Provider as well as the Provider's unique GUID and a list of AB taxonomies they have licensed. In the special circumstance where your own Provider object shows up in the response, you will also see relationships listing Providers that are sharing Assets with you (Owners) as well as Providers with whom you are sharing assets (Consumers).

To locate your own Provider object, user the filter parameter and request Providers with ID `_me`. That is a special constant that matches yourself. While not terribly helpful with the Providers endpoint, you can also use `_all` as a match on Provider fields to indicate that you want to match on all Providers. This can be used with the `owner.id` property on the Assets resource where the default behavior is to only list Assets owned by you.

## Single Provider

In its simplest form, you are able to retrieve the details of a specific Provider by appending the AB GUID to the path portion of the URL.

### Fetching a Provider

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/providers/{guid}" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}

## Searching for Providers

Using filtering and facets, it is possible to retrieve sets of Providers that match specific criteria. These Providers are returned in an array of Provider objects. See the Introduction for an explanation on [filtering](/services/ab-connect/introduction/introduction-to-odata-filters) and the use of [facets](/services/ab-connect/introduction/facets). This section covers the specifics of using these parameters with the Providers resource. Note that by default, the endpoint returns your Provider object and the objects of all Providers related to you.

### Finding Sets of Providers

{% openapi src="/files/lAZiZbNiKeF1nYSkUH1G" path="/providers" method="get" %}
[openapi.yml](https://3935729257-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FB0qnrcLHZo7GMoCVWI3W%2Fuploads%2Fgit-blob-e709cd7901d6e5ff2b8870536c0b9c5caea70a34%2Fopenapi.yml?alt=media)
{% endopenapi %}


# Canvas LMS

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](/services/canvas/oauth2/file.oauth).

## API Changes

For API resources, such as the API Change Log for additions, changes, deprecations, and removals, view the [Canvas API page](https://community.canvaslms.com/t5/Change-Log/tkb-p/changelog) in the Canvas Community.

## API Policy

Please carefully review [the Canvas API Policy](https://www.instructure.com/policies/api-policy) before using the API.

## Schema

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

All API responses are in [JSON format](http://www.json.org/).

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](http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4) (the application/x-www-form-urlencoded content type).

POST and PUT requests may also optionally be sent in [JSON format](http://www.json.org/) 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:

```bash
name=test+name&file_ids[]=1&file_ids[]=2&sub[name]=foo&sub[message]=bar&flag=y
```

would translate into this JSON request:

```json
{ "name": "test name", "file_ids": [1,2], "sub": { "name": "foo", "message": "bar" }, "flag": true }
```

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

```
YYYY-MM-DDTHH:MM:SSZ
```

## 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:

```bash
curl -H "Authorization: Bearer <ACCESS-TOKEN>" "https://canvas.instructure.com/api/v1/courses"
```

OAuth2 Token sent in query string:

```bash
curl "https://canvas.instructure.com/api/v1/courses?access_token=<ACCESS-TOKEN>"
```

Read more about [OAuth2 and how to get access tokens.](/services/canvas/oauth2/file.oauth)

## SSL

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.

## Canvas Experiences

Canvas LMS supports several experiences including Canvas Career and Canvas for Elementary. The vast majority of these API resources are shared, though some are applicable only to certain experiences.

## 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](https://www.github.com/instructure/canvas-lms/wiki). Run the following command from your Canvas directory:

```bash
bundle exec rake doc:api
```

### OpenAPI 3.0 Specification

Canvas also provides an OpenAPI 3.0 specification that can be generated from the same YARD documentation. This modern format is compatible with tools like Swagger UI, Postman, and various code generators.

To generate the OpenAPI 3.0 specification:

```bash
bundle exec rake doc:openapi
```

This will create `public/doc/openapi/canvas.openapi.yaml` containing the OpenAPI 3.0 specification for the Canvas API.

The OpenAPI spec includes:

* All API endpoints with their HTTP methods and paths
* Request parameters (path, query, and body)
* Response schemas
* Authentication requirements
* Server configuration

You can view and interact with the generated OpenAPI spec using:

* [Swagger Editor](https://editor.swagger.io) - Import the YAML file
* [Swagger UI](https://swagger.io/tools/swagger-ui/) - Interactive API documentation
* [Postman](https://www.postman.com) - Import as a collection
* Code generators like [OpenAPI Generator](https://openapi-generator.tech)

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Basics


# GraphQL

## GraphQL Introduction

GraphQL is a query API language that executes queries by using a type system based on defined input data. GraphQL provides more specific inquiries with faster results and populate multiple inputs into one query.

Note: GraphQL endpoint permissions mirror permissions for the REST API. A user is only granted access to view grades based on that user’s permissions. For instance, a student cannot view grades for another student, but an instructor can view grades for any student in a course.

[Learn more about GraphQL](https://graphql.org/learn/).

## Using GraphQL

Canvas has included the tool [GraphiQL](https://github.com/graphql/graphiql), an in-browser graphical interface for interacting with GraphQL endpoints.

The GraphiQL interface can be viewed by adding /graphiql to the end of your Canvas production URL (e.g. your-institution.instructure.com/graphiql).

The /graphiql access can also be added to a test or beta environment URL. Requests from the selected environment will always return that environment’s data.

The Explorer sidebar displays all available queries and mutations. Any selected items display in the GraphiQL window. Once a query or mutation is selected, any values displayed in purple text identify the value as an input argument.

### REST vs GraphQL

The Canvas REST API will continue to be available.

Fields are being added to the GraphQL API on an as-needed basis. The GraphQL API does not include everything that is currently in the REST API. Feel free to submit pull requests on github to add additional features or talk about it in the `#canvas-lms` channel on libera.chat.

## GraphQL Endpoint

### POST /api/graphql

All GraphQL queries are posted to this endpoint.

#### Request Parameters

| Parameter | Type   | Description                                       |
| --------- | ------ | ------------------------------------------------- |
| query     | string | the GraphQL query to execute                      |
| variables | Hash   | variable values as required by the supplied query |

#### Example Request:

```bash
curl https://<canvas>/api/graphql \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -d query='query courseInfo($courseId: ID!) {
       course(id: $courseId) {
        id
        _id
        name
       }
     }' \
  -d variables[courseId]=1
```

#### Example Response

```json
{
  "data": {
    "course": {
      "id": "Q291cnNlLTE=",
      "_id": "1",
      "name": "Mr. Ratburn's Class"
    }
  }
}
```

## GraphQL in Canvas

### `id` vs `_id` and the `node` field

The Canvas LMS GraphQL API follows the [Relay Object Identification spec](https://relay.dev/graphql/objectidentification.htm). Querying for an object's `id` will return a global identifier instead of the numeric ids that are used in the REST API. The traditional ids can be queried by requesting the `_id` field.

Most objects can be fetched by passing their GraphQL `id` to the `node` field:

```graphql
{
  node(id: "Q291cnNlLTE=") {
    ... on Course {
      _id  #  traditional ids (e.g. "1")
      name
      term { name }
    }
  }
}
```

A `legacyNode` field is also available to fetch objects via the REST-style ids:

```graphql
{
  # object type must be specified when using legacyNode
  legacyNode(type: Course, _id: "1") {
    ... on Course {
      _id
      name
    }
  }
}
```

For commonly accessed object types, type-specific fields are provided:

```graphql
{
  # NOTE: id arguments will always take either GraphQL or rest-style ids
  c1: course(id: "1") {
    _id
    name
  }
  c2: course(id: "Q291cnNlLTE=") {
    _id
    name
  }
}
```

### Pagination

Canvas follows the [Relay Connection Spec](https://facebook.github.io/relay/graphql/connections.htm) for paginating collections. Request reasonable page sizes to avoid being limited.

```graphql
{
  course(id: "1") {
    assignmentsConnection(
      first: 10,      # page size
      after: "XYZ"    # `endCursor` from previous page
    ) {
      nodes {
        id
        name
      }
      pageInfo {
        endCursor     # this is your `after` value for the next request
        hasNextPage
      }
    }
  }
}
```

#### Total Count in Connections

Some connection types support a `totalCount` field in `pageInfo` that provides the total number of items in the connection, regardless of pagination limits. This is useful for displaying "Page X of Y" pagination interfaces.

```graphql
{
  assignment(id: "1") {
    submissionsConnection(first: 10) {
      nodes {
        id
        state
      }
      pageInfo {
        hasNextPage
        totalCount    # total number of submissions (ignoring pagination)
      }
    }
  }
}
```

**Note:** `totalCount` is only available on connections that have been explicitly configured for it. Not all connection types support this field.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# API Change Log

For API resources, such as the API Change Log for additions, changes, deprecations, and removals, view the [Canvas API page](https://community.canvaslms.com/t5/Change-Log/tkb-p/changelog) in the Canvas Community.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# SIS IDs

Throughout the API, objects are referenced by internal IDs. You can also reference objects by SIS ID, by prepending the SIS ID with the name of the SIS field, like `sis_course_id:`. For instance, to retrieve the list of assignments for a course with SIS ID of `A1234`:

```
/api/v1/courses/sis_course_id:A1234/assignments
```

The following objects support SIS IDs in the API:

* `sis_account_id`
* `sis_course_id`
* `sis_group_id`
* `sis_group_category_id`
* `sis_integration_id` (for users and courses)
* `sis_login_id`
* `sis_section_id`
* `sis_term_id`
* `sis_user_id`

Some objects support LTI IDs:

* `lti_context_id` (for accounts, assignments, courses, groups, and users)
* `lti_1_1_id` (for users, an alias of `lti_context_id`, which is sent in LTI 1.1 launches as `user_id`)
* `lti_1_3_id` (for users, a separate value from `lti_context_id`, sent in LTI 1.3 launches as `sub`)

Additionally, some objects support special IDs:

* Users support `self` to mean the current user.
* Accounts support `self` to mean the root account for the current domain, `default` to mean the Default account, and `site_admin` to mean the Site Admin account.
* Terms support `default` to mean the default term, and `current` to mean the term that is currently active according to term dates. A term must have a start date or an end date to be considered the current term. If there is more than one term that's active, `current` will not be found.

## Encoding and Escaping

SIS IDs should be encoded as UTF-8, and then escaped normally for inclusion in a URI. For instance the SIS ID `CS/101.11é` is encoded and escaped as `CS%2F101%2E11%C3%A9`.

Note that some web servers have difficulties with escaped characters, particularly forward slashes. They may require special configuration to properly pass encoded slashes to Rails.

For Apache and Passenger, the following settings should be set:

* [`AllowEncodedSlashes`](http://httpd.apache.org/docs/2.2/mod/core.html#allowencodedslashes) `NoDecode`
* [`PassengerAllowEncodedSlashes`](http://www.modrails.com/documentation/Users%20guide%20Apache.html#_passengerallowencodedslashes_lt_on_off_gt) `on`

Also beware that if you use [`ProxyPass`](http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass), you should enable the `nocanon` option. Similarly, [`RewriteRule`](https://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule) should use the [`NE`](https://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_ne), or `noescape` flag. Other modules may also need additional configuration to prevent double-escaping of `%2f` (/) as `%252f`.

Prior versions of this API documentation described using a hex encoding to circumvent these issues, since the proper Apache/Passenger configuration was not known at the time. This format is deprecated, and will no longer be described, but will continue to be handled by the server for backwards compatibility.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Pagination

Requests that return multiple items will be paginated to 10 items by default. You can set a custom per-page amount with the `?per_page` parameter. There is an unspecified limit to how big you can set `per_page` to, so be sure to always check for the `Link` header.

To retrieve additional pages, the returned `Link` headers should be used. These links should be treated as opaque. They will be absolute urls that include all parameters necessary to retrieve the desired current, next, previous, first, or last page. The one exception is that if an access\_token parameter is sent for authentication, it will not be included in the returned links, and must be re-appended.

Pagination information is provided in the [Link header](http://www.w3.org/Protocols/9707-link-header.html):

```
Link: <https://<canvas>/api/v1/courses/:id/discussion_topics.json?opaqueA>; rel="current",
      <https://<canvas>/api/v1/courses/:id/discussion_topics.json?opaqueB>; rel="next",
      <https://<canvas>/api/v1/courses/:id/discussion_topics.json?opaqueC>; rel="first",
      <https://<canvas>/api/v1/courses/:id/discussion_topics.json?opaqueD>; rel="last"
```

The possible `rel` values are:

* current - link to the current page of results.
* next - link to the next page of results.
* prev - link to the previous page of results.
* first - link to the first page of results.
* last - link to the last page of results.

These will only be included if they are relevant. For example, the first page of results will not contain a rel="prev" link. rel="last" may also be excluded if the total count is too expensive to compute on each request.

**NOTE**: Because HTTP header names are [case-insensitive](https://datatracker.ietf.org/doc/html/rfc9110#section-5.1-3), please be sure you are not parsing the `Link` header in a case-sensitive way. The capitalization of the header name is not guaranteed.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Throttling

Canvas includes a built in dynamic throttling mechanism to prevent a single user from abusing the system and causing adverse effects for others. It works by having a rate limit, and a cost for every request. Each request subtracts from your quota, and the quota is automatically replenished over time. In the event that your API request is throttled, you will receive a `429 Forbidden (Rate Limit Exceeded)` response. Your application should be prepared for this error, and retry the request at a later time.

To assist applications with planning, every request will return a `X-Request-Cost` header that is a floating point number of the amount that request deducted from your remaining quota. If throttling is applicable to this request, there will also be a `X-Rate-Limit-Remaining` header of your remaining quota.

Since the cost of a request is roughly based on the amount of time it takes to process, and the quota (by default) replenishes at a rate faster than real-time, any API client that makes no more than one simultaneous request is unlikely to be throttled. Parallel requests are subject to an additional pre-flight penalty to prevent a large number of incoming requests being able to bring the system down before their cost is counted against their quota. As soon as each request finishes, the pre-flight penalty is credited back to the quota, and only the actual cost of the request is counted.

For applications that go through the OAuth flow and obtain an access token for each user, each access token has its own quota, and the developer need not be concerned with requests from one user causing another user to be throttled.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Compound Documents

Compound documents contain multiple collections to allow for side-loading of related objects. Side-loading is desirable when nested representation of related objects would result in potentially expensive repetition. For example, given a list of 50 comments by only 3 authors, a nested representation would include 50 author objects where a side-loaded representation would contain only 3 author objects.

A compound document is a JSON object with two reserved properties ("meta" and "links"). The "meta" property is required and is described below; the "links" property is currently unused but reserved. All other properties of the compound document's root object should be interpreted as collections of model objects. A compound document will always contain at least one collection.

The "meta" property is a JSON object with one recognized property ("primaryCollection"). If present, the "meta.primaryCollection" property will contain the property name of one of the collections in the compound document. The primary collection contains the data most directly associated with the request. Any pagination indicated through a Link header accompanying a compound document applies to the primary collection.

Any remaining collections in a compound document are secondary collections and will contain objects related (perhaps indirectly, through other secondary objects) to those in the primary collection. Secondary collections should never be considered as ordered or complete.

Example:

```json
{
  "meta": {"primaryCollection": "comments"},
  "comments": [...],
  "authors": [...]
}
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# File Uploads

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](#method.file_uploads.post)

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

1. 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.
2. Upload the file using the information returned in the first POST request.
3. 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](/services/canvas/resources/courses), you'd POST to `/api/v1/courses/:course_id/files`. Or to [upload a file as part of a student homework submission](/services/canvas/resources/submissions), 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.

Content migrations and SIS imports can be performed via file uploads also. In these cases, the arguments below are provided under a `pre_attachment` object in the initial POST to `/api/v1/accounts/:account_id/sis_imports` or `/api/v1/courses/:course_id/content_migrations`. The `upload_url` and `upload_params` in the response will also be under a `pre_attachment` object. Once the file is uploaded to the URL provided, the content migration or SIS import will begin.

Arguments:

* name

  The filename of the file. Any UTF-8 name is allowed. Path components such as \`/\` and \`\\\` will be treated as part of the filename, not a path to a sub-folder.
* size

  The size of the file, in bytes. This field is recommended, as it will let you find out if there's a quota issue before uploading the raw file.
* content\_type

  The content type of the file. If not given, it will be guessed based on the file extension.
* parent\_folder\_id

  The id of the folder to store the file in. An error will be returned if this does not correspond to an existing folder. If this and parent\_folder\_path are sent an error will be returned. If neither is given, a default folder will be used.
* parent\_folder\_path

  The path of the folder to store the file in. The path separator is the forward slash \`/\`, never a back slash. The folder will be created if it does not already exist. This parameter only applies to file uploads in a context that has folders, such as a user, a course, or a group. If this and parent\_folder\_id are sent an error will be returned. If neither is given, a default folder will be used.
* folder

  \[deprecated] Use parent\_folder\_path instead.
* on\_duplicate

  How to handle duplicate filenames. If \`overwrite\`, then this file upload will overwrite any other file in the folder with the same name. If \`rename\`, then this file will be renamed if another file in the folder exists with the given name. If no parameter is given, the default is \`overwrite\`. This doesn't apply to file uploads in a context that doesn't have folders.
* success\_include\[]

  An array of additional information to include in the upload success response. See Files API for more information.

Example Request:

```bash
curl 'https://<canvas>/api/v1/users/self/files' \
     -F 'name=profile_pic.jpg' \
     -F 'size=302185' \
     -F 'content_type=image/jpeg' \
     -F 'parent_folder_path=my_files/section1' \
     -H "Authorization: Bearer <token>"
```

Example Response:

```json
{
  "upload_url": "https://some-bucket.s3.amazonaws.com/",
  "upload_params": {
    "key": "/users/1234/files/profile_pic.jpg",
    <unspecified parameters; key above will not necesarily be present either>
  }
}
```

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.

Example Request:

```bash
curl '<upload_url>' \
     -F 'key=/users/1234/files/profile_pic.jpg' \
     <any other parameters specified in the upload_params response>
     -F 'file=@my_local_file.jpg'
```

The access token is not sent with this request.

Example Response:

```
HTTP/1.1 301 Moved Permanently
Location: https://<canvas>/api/v1/files/1234/create_success?uuid=ABCDE
```

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.

Example Request:

```bash
curl -X POST '<Location>' \
     -H 'Content-Length: 0' \
     -H "Authorization: Bearer <token>"
```

Example Response:

```json
{
  "id": 1234,
  "url": "...url to download the file...",
  "content-type": "image/jpeg",
  "display_name": "profile_pic.jpg",
  "size": 302185
}
```

## [Uploading via URL](#method.file_uploads.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:

* url

  The full URL to the file to be uploaded. This URL must be publicly accessible.
* submit\_assignment

  A boolean to indicate whether or not to automatically submit the assignment the file is associated with if it is associated with an assignment. Defaults to true.

Example Request:

```bash
curl 'https://<canvas>/api/v1/users/self/files' \
     -F 'url=http://example.com/my_pic.jpg' \
     -F 'name=profile_pic.jpg' \
     -F 'size=302185' \
     -F 'content_type=image/jpeg' \
     -F 'parent_folder_path=my_files/section1' \
     -H "Authorization: Bearer <token>"
```

Example Response:

```json
{
  "upload_url": "https://file-service.url/opaque",
  "upload_params": {
    /* unspecified parameters; contents should be treated as opaque */
  },
  "progress": {
    /* amongst other tags, see the Progress API... */
    "url": "https://canvas.example.edu/api/v1/progress/1"
    "workflow_state": "running"
  }
}
```

### 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.

Example Request:

```bash
curl '<upload_url>' \
     -F 'target_url=http://example.com/my_pic.jpg' \
     <any other parameters specified in the upload_params response>
```

Example Response:

```
HTTP/1.1 201 Created
```

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 {api:ProgressController#Show Progress endpoint} to query the status. On success, the created attachment's id will be returned in the results of the Progress object as `id`.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# API Endpoint Attributes

Canvas adds attributes to links in returned HTML snippets to make it easier for API consumers to digest the referenced resources. These attributes are as follows:

* `data-api-endpoint` - A URL where the linked object can be accessed via the API
* `data-api-returntype` - The type of data returned

For example, consider an assignment description containing a link to a wiki page in the same course. The description returned by the Get Assignment API might look like this:

```html
<a href="http://canvas.example.com/courses/123/pages/a-wiki-page"
   data-api-endpoint="http://canvas.example.com/api/v1/courses/123/pages/a-wiki-page"
   data-api-returntype="Page">More information here</a>
```

The currently supported `data-api-returntype` values are:

* `Assignment`
* `Discussion`
* `Page`
* `File`
* `Folder`
* `Quiz`
* `Module`
* `SessionlessLaunchUrl`

If the API returns a list of objects instead of a single object, the `data-api-returntype` will be wrapped in square brackets, e.g. `[Assignment]`.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Masquerading

Masquerading is making an API call on behalf of another user. It will behave as if the target user had made the API call with their own access token (even if they don't have one), including permission checks, enrollments, etc. In order to masquerade via the API, the calling user must have the "Become other users" permission. If the target user is also an admin, the calling user must additionally have every permission that the target user has. For auditing purposes, all calls log both the calling user and the target user.

To masquerade, add an as\_user\_id parameter to any request. It can be either a Canvas user ID, or an SIS user ID (as described in [SIS IDs](/services/canvas/basics/file.object_ids)):

```bash
curl 'https://<canvas>/api/v1/users/self/activity_stream?as_user_id=sis_user_id:brian' \
     -H "Authorization: Bearer <token>"
```

Masquerading could be useful in a number of use cases:

* For developing an admin tool
* For accessing APIs that can only be called on self (i.e. the activity stream as shown above)
* For a portal type application that's already tightly integrated with an SIS and is managed by the school, to avoid going through the OAuth flow for every student

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# OAuth2


# OAuth2 Overview

## OAuth2

{% hint style="warning" %}
Developer keys issued after Oct 2015 generate tokens with a 1 hour expiration. Applications must use [refresh tokens](#using-refresh-tokens) to generate new access tokens.
{% endhint %}

[OAuth2](http://oauth.net/2) is a protocol designed to let third-party applications authenticate to perform actions as a user, without getting the user's password. Canvas uses OAuth2 (specifically [RFC-6749](http://tools.ietf.org/html/rfc6749)) for authentication and authorization of the Canvas API. Additionally, Canvas uses OAuth2 for [LTI Advantage](https://www.imsglobal.org/activity/learning-tools-interoperability) service authentication (as described in the [IMS Security Framework](https://www.imsglobal.org/spec/security/v1p0/)).

#### [Accessing the Canvas API](#accessing-canvas-api)

* [Storing Tokens](#storing-access-tokens)
* [Manual Token Generation](#manual-token-generation)
* [Oauth2 Flow](#oauth2-flow)
  * [Getting OAuth2 Client ID/Secret](#oauth2-flow-0)
  * [Step 1: Redirect users to request Canvas access](#oauth2-flow-1)
  * [Step 2: Redirect back to the request\_uri, or out-of-band redirect](#oauth2-flow-2)
    * [Note for native apps](#oauth2-flow-2.1)
  * [Step 3: Exchange the code for the final access token](#oauth2-flow-3)
* [Using an Access Token to authenticate requests](#using-access-tokens)
* [Using a Refresh Token to get a new Access Token](#using-refresh-tokens)
* [Logging Out](/services/canvas/oauth2/file.oauth_endpoints#delete-login-oauth2-token)
* [Endpoints](/services/canvas/oauth2/file.oauth_endpoints)
  * [GET login/oauth2/auth](/services/canvas/oauth2/file.oauth_endpoints#get-login-oauth2-auth)
  * [POST login/oauth2/token](/services/canvas/oauth2/file.oauth_endpoints#post-login-oauth2-token)
  * [DELETE login/oauth2/token](/services/canvas/oauth2/file.oauth_endpoints#delete-login-oauth2-token)
  * [GET login/session\_token](/services/canvas/oauth2/file.oauth_endpoints#get-login-session-token)

#### [Accessing LTI Advantage Services](#accessing-lti-advantage-services-link)

* [Step 1: Developer Key Setup](#developer-key-setup)
* [Step 2: Request an Access Token](#request-access-token)
* [Step 3: Use the access token to access LTI services](#use-access-token)

## [Accessing the Canvas API](#accessing-canvas-api) <a href="#accessing-canvas-api" id="accessing-canvas-api"></a>

[Back to Top](#top)

### [Storing Tokens](#storing-access-tokens) <a href="#storing-access-tokens" id="storing-access-tokens"></a>

[Back to Top](#top)

When appropriate, applications should store the token locally, rather than requesting a new token for the same user each time the user uses the application. If the token is deleted or expires, the application will get a 401 Unauthorized error from the API, in which case the application should perform the OAuth flow again to receive a new token. You can differentiate this 401 Unauthorized from other cases where the user simply does not have permission to access the resource by checking that the WWW-Authenticate header is set.

Note that for applications using a single stored token across multiple Canvas domains, a 401 with a `WWW-Authenticate` header can also indicate that the token was issued on a different Canvas domain than the one being requested. In that case, re-running the OAuth flow on the same domain will not resolve the error - you must run the flow on the correct Canvas domain instead.

Storing a token is in many ways equivalent to storing the user's password, so tokens should be stored and used in a secure manner, including but not limited to:

* Don't embed tokens in web pages.
* Don't pass tokens or session IDs around in URLs.
* Properly secure the database or other data store containing the tokens.
* For web applications, practice proper techniques to avoid session attacks such as cross-site scripting, request forgery, replay attacks, etc.
* For native applications, take advantage of user keychain stores and other operating system functionality for securely storing passwords.

### [Manual Token Generation](#manual-token-generation) <a href="#manual-token-generation" id="manual-token-generation"></a>

[Back to Top](#top)

For testing your application before you've implemented OAuth, the simplest option is to generate an access token on your user's profile page. Note that asking any other user to manually generate a token and enter it into your application is a violation of [Canvas' API Policy](https://www.instructure.com/policies/api-policy). Applications in use by multiple users MUST use OAuth to obtain tokens.

To manually generate a token for testing:

1. Click the "profile" link in the top right menu bar, or navigate to `/profile`
2. Under the "Approved Integrations" section, click the button to generate a new access token.
3. Once the token is generated, you cannot view it again, and you'll have to generate a new token if you forget it. Remember that access tokens are password equivalent, so keep it secret.

### [Oauth2 Flow](#oauth2-flow) <a href="#oauth2-flow" id="oauth2-flow"></a>

[Back to Top](#top)

Your application can rely on canvas for a user's identity. During step 1 of the web application flow below, specify the optional scope parameter as scope=/auth/userinfo. When the user is asked to grant your application access in step 2 of the web application flow, they will also be given an option to remember their authorization. If they grant access and remember the authorization, Canvas will skip step 2 of the request flow for future requests.

Canvas will not give a token back as part of a userinfo request. It will only provide the current user's name and id.

#### [Getting OAuth2 Client ID/Secret](#oauth2-flow-0) <a href="#oauth2-flow-0" id="oauth2-flow-0"></a>

If your application will be used by others, you will need to implement the full OAuth2 token request workflow, so that you can request an access token for each user of your application.

Performing the OAuth2 token request flow requires an application client ID and client secret. To obtain these application credentials, you will need to register your application. The client secret should never be shared.

For Canvas Cloud (hosted by Instructure), developer keys are [issued by the admin of the institution](https://community.canvaslms.com/t5/Admin-Guide/How-do-I-manage-developer-keys-for-an-account/ta-p/249).

NOTE for LTI providers: Since developer keys are scoped to the institution they are issued from, tool providers that serve multiple institutions should store and look up the correct developer key based on the launch parameters (eg. custom\_canvas\_api\_domain) sent during the LTI launch.

For [open source Canvas users](https://github.com/instructure/canvas-lms/wiki), you can [generate a client ID](https://community.canvaslms.com/t5/Admin-Guide/How-do-I-manage-developer-keys-for-an-account/ta-p/249) and secret in the Site Admin account of your Canvas install.

#### [Step 1: Redirect users to request Canvas access](#oauth2-flow-1) <a href="#oauth2-flow-1" id="oauth2-flow-1"></a>

[Back to Top](#top)

A basic request looks like:

#### GET https\://\<canvas-install-url>/login/oauth2/auth?client\_id=XXX\&response\_type=code\&state=YYY\&redirect\_uri=<https://example.com/oauth2response>

See [GET login/oauth2/auth](/services/canvas/oauth2/file.oauth_endpoints#get-login-oauth2-auth) for details.

#### [Step 2: Redirect back to the request\_uri, or out-of-band redirect](#oauth2-flow-2) <a href="#oauth2-flow-2" id="oauth2-flow-2"></a>

[Back to Top](#top)

If the user accepts your request, Canvas redirects back to your request\_uri with a specific query string, containing the OAuth2 response:

#### <http://www.example.com/oauth2response?code=XXX\\&state=YYY>

The app can then extract the code, and use it along with the client\_id and client\_secret to obtain the final access\_key.

If your application passed a state parameter in step 1, it will be returned here in step 2 so that your app can tie the request and response together, whether the response was successful or an error occurred.

If the user doesn't accept the request for access, or if another error occurs, Canvas redirects back to your request\_uri with an `error` parameter, rather than a `code` parameter, in the query string.

#### <http://www.example.com/oauth2response?error=access\\_denied\\&error\\_description=a\\_description\\&state=YYY>

A list of possible error codes is found in the [RFC-7649 spec](https://datatracker.ietf.org/doc/html/rfc6749#section-4.2.2.1).

#### [Note for native apps](#oauth2-flow-2.1) <a href="#oauth2-flow-2.1" id="oauth2-flow-2.1"></a>

[Back to Top](#top)

Canvas redirects to a page on canvas with a specific query string, containing parameters from the OAuth2 response:

```
/login/oauth2/auth?code=<code>
```

#### /login/oauth2/auth?code=\<code>

At this point the app should notice that the URL of the webview has changed to contain `code=<code>` somewhere in the query string. The app can then extract the code, and use it along with the client\_id and client\_secret to obtain the final access\_key.

#### [Step 3: Exchange the code for the final access token](#oauth2-flow-3) <a href="#oauth2-flow-3" id="oauth2-flow-3"></a>

[Back to Top](#top)

To get a new access token and refresh token, send a [POST request to login/oauth2/token](/services/canvas/oauth2/file.oauth_endpoints#post-login-oauth2-token) with the following parameters:

**Parameters**

| Parameter       | Value                                                                                                                                                                                       |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| grant\_type     | authorization\_code                                                                                                                                                                         |
| client\_id      | Your client\_id                                                                                                                                                                             |
| client\_secret  | Your client\_secret                                                                                                                                                                         |
| redirect\_uri   | If a redirect\_uri was passed to the initial request in step 1, the same redirect\_uri must be given here.                                                                                  |
| code            | code from canvas                                                                                                                                                                            |
| replace\_tokens | (optional) If this option is set to \`1\`, existing access tokens issued for this developer key/secret will be destroyed and replaced with the new token that is returned from this request |

Note that the once the code issued in step 2 is used in a POST request to this endpoint, it is invalidated and further requests for tokens with the same code will fail.

### [Using an Access Token to authenticate requests](#using-access-tokens) <a href="#using-access-tokens" id="using-access-tokens"></a>

[Back to Top](#top)

Once you have an OAuth access token, you can use it to make API requests. If possible, using the HTTP Authorization header is recommended.

OAuth2 Token sent in header:

```bash
curl -H "Authorization: Bearer <ACCESS-TOKEN>" "https://canvas.instructure.com/api/v1/courses"
```

Sending the access token in the query string or POST parameters is also supported, but discouraged as it increases the chances of the token being logged or leaked in transit.

OAuth2 Token sent in query string:

```bash
curl "https://canvas.instructure.com/api/v1/courses?access_token=<ACCESS-TOKEN>"
```

### [Using a Refresh Token to get a new Access Token](#using-refresh-tokens) <a href="#using-refresh-tokens" id="using-refresh-tokens"></a>

[Back to Top](#top)

Access tokens have a 1 hour lifespan. When the refresh flow is taken, Canvas will update the access token to a new value, reset the expiration timer, and return the new access token as part of the response. When refreshing tokens the user will not be asked to authorize the application again.

To refresh the access token, send a [POST request to login/oauth2/token](/services/canvas/oauth2/file.oauth_endpoints#post-login-oauth2-token) with the following parameters:

**Parameters**

| Parameter      | Value                                             |
| -------------- | ------------------------------------------------- |
| grant\_type    | refresh\_token                                    |
| client\_id     | Your client\_id                                   |
| client\_secret | Your client\_secret                               |
| refresh\_token | refresh\_token from initial access\_token request |

The response to this request will not contain a new refresh token; the same refresh token is to be reused.

### [Logging Out](/services/canvas/oauth2/file.oauth_endpoints#delete-login-oauth2-token)

[Back to Top](#top)

To logout, simply send a [DELETE request to login/oauth2/token](/services/canvas/oauth2/file.oauth_endpoints#delete-login-oauth2-token)

## [Accessing LTI Advantage Services](#accessing-lti-advantage-services) <a href="#accessing-lti-advantage-services-link" id="accessing-lti-advantage-services-link"></a>

[Back to Top](#top)

LTI Advantage services, such as [Names and Role Provisioning Services](https://www.imsglobal.org/spec/lti-nrps/v2p0) and [Assignment and Grade Services](https://www.imsglobal.org/spec/lti-ags/v2p0/), require use of a client credentials grant flow for request authentication. This workflow is best summarized on the IMS Security Framework (specifically [Section 4](https://www.imsglobal.org/spec/security/v1p0/#using-oauth-2-0-client-credentials-grant)).

Our goal here is to highlight some nuances that might help you access these services in Canvas, rather than describing the specification in detail.

### [Step 1: Developer Key Setup](#developer-key-setup) <a href="#developer-key-setup" id="developer-key-setup"></a>

[Back to Top](#top)

Before the client\_credentials grant flow can be achieved, an [LTI developer key must be created](https://community.canvaslms.com/t5/Admin-Guide/How-do-I-configure-an-LTI-key-for-an-account/ta-p/140). During developer key configuration, a public JWK can either be configured statically or can be dynamically rotated by providing JWKs by a URL that Canvas can reach. Tools may also use a previously issued client\_credentials token to [retroactively rotate the public JWK via an API request](/services/canvas/resources/public_jwk). The JWK must include an alg and use.

**Example JWK**

```
   "public_jwk": {
      "kty":"RSA",
      "alg":"RS256",
      "e":"AQAB",
      "kid":"8f796179-7ac4-48a3-a202-fc4f3d814fcd",
      "n":"nZA7QWcIwj-3N_RZ1qJjX6CdibU87y2l02yMay4KunambalP9g0fU9yILwLX9WYJINcXZDUf6QeZ-SSbblET-h8Q4OvfSQ7iuu0WqcvBGy8M0qoZ7I-NiChw8dyybMJHgpiP_AyxpCQnp3bQ6829kb3fopbb4cAkOilwVRBYPhRLboXma0cwcllJHPLvMp1oGa7Ad8osmmJhXhN9qdFFASg_OCQdPnYVzp8gOFeOGwlXfSFEgt5vgeU25E-ycUOREcnP7BnMUk7wpwYqlE537LWGOV5z_1Dqcqc9LmN-z4HmNV7b23QZW4_mzKIOY4IqjmnUGgLU9ycFj5YGDCts7Q",
      "use":"sig"
   }
  
```

### [Step 2: Request an access token](#request-access-token) <a href="#request-access-token" id="request-access-token"></a>

[Back to Top](#top)

Once the developer key is configured and turned on, your tool can [request an LTI access token using the client\_credentials grant](/services/canvas/oauth2/file.oauth_endpoints#post-login-oauth2-token). This request must be signed by an RSA256 private key with a public key that is configured on the developer key as described in [Step 1: Developer Key Setup](#developer-key-setup).

### [Step 3: Use the access token to access LTI services](#use-access-token) <a href="#use-access-token" id="use-access-token"></a>

[Back to Top](#top)

Once you have an access token, you can use it to make LTI service requests. The access token must be included as a Bearer token in the Authorization header:

```bash
curl -H "Authorization: Bearer <ACCESS-TOKEN>" "https://<canvas_domain>/api/lti/courses/:course_id/names_and_roles"
```

Access tokens only work in the context of where a tool has been deployed. Tools can only access line items that are associated with their tool.

The following endpoints are currently supported:

#### Names and Role Provisioning Services

* [Names and Role API](/services/canvas/resources/names_and_role)

#### Assignment and Grade Services

* [Line Items](/services/canvas/resources/line_items)
* [Score](/services/canvas/resources/score)
* [Result](/services/canvas/resources/result)

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# OAuth2 Endpoints

{% hint style="warning" %}
Developer keys issued after Oct 2015 generate tokens with a 1 hour expiration. Applications must use [refresh tokens](/services/canvas/oauth2/file.oauth#using-refresh-tokens) to generate new access tokens.
{% endhint %}

* [GET login/oauth2/auth](#get-login-oauth2-auth)
* [POST login/oauth2/token](#post-login-oauth2-token)
* [DELETE login/oauth2/token](#delete-login-oauth2-token)
* [GET login/session\_token](#get-login-session-token)

## GET login/oauth2/auth <a href="#get-login-oauth2-auth" id="get-login-oauth2-auth"></a>

### GET https\://\<canvas-install-url>/login/oauth2/auth?client\_id=XXX\&response\_type=code\&redirect\_uri=<https://example.com/oauth\\_complete\\&state=YYY\\&scope=\\>\<value\_1>%20\<value\_2>%20\<value\_n>

#### Parameters

| Parameter      | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| client\_id     | Required | The client id for your registered application.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| response\_type | Required | The type of OAuth2 response requested. The only currently supported value is `code`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| redirect\_uri  | Required | The URL where the user will be redirected after authorization. The domain of this URL must match the domain of the redirect\_uri stored on the developer key, or it must be a subdomain of that domain. For native applications, currently the only supported value is `urn:ietf:wg:oauth:2.0:oob`, signifying that the credentials will be retrieved out-of-band using an embedded browser or other functionality.                                                                                                                                                                                                                                                                                                                              |
| state          | Optional | Your application can pass Canvas an arbitrary piece of state in this parameter, which will be passed back to your application in Step 2. It's strongly encouraged that your application pass a unique identifier in the state parameter, and then verify in Step 2 that the state you receive back from Canvas is the same expected value. Failing to do this opens your application to the possibility of logging the wrong person in, as [described here](http://homakov.blogspot.com/2012/07/saferweb-most-common-oauth2.html).                                                                                                                                                                                                               |
| scope          | Optional | This can be used to specify what information the Canvas API access token will provide access to. Canvas API scopes may be found beneath their corresponding endpoints in the "resources" documentation pages. If the developer key does not require scopes and no scope parameter is specified, the access token will have access to all scopes. If the developer key does require scopes and no scope parameter is specified, Canvas will respond with "invalid\_scope." To successfully pass multiple scope values, the scope parameter is included once, with multiple values separated by spaces. Passing multiple scope parameters, as is common in other areas of Canvas, causes only the last value to be applied to the generated token. |
| purpose        | Optional | This can be used to help the user identify which instance of an application this token is for. For example, a mobile device application could provide the name of the device.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| force\_login   | Optional | Set to '1' if you want to force the user to enter their credentials, even if they're already logged into Canvas. By default, if a user already has an active Canvas web session, they will not be asked to re-enter their credentials.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| unique\_id     | Optional | Set to the user's username to be populated in the login form in the event that the user must authenticate.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| prompt         | Optional | If set to `none`, Canvas will immediately redirect to the `redirect_uri`. If the caller has a valid session with a "remember me" token or a token from a trusted Developer Key, the redirect will contain a `code=XYZ` param. If the caller has no session, the redirect will contain an `error=login_required` param. If the caller has a session, but no "remember me" or trusted token, the redirect will contain an `error=interaction_required` param.                                                                                                                                                                                                                                                                                      |

## POST login/oauth2/token <a href="#post-login-oauth2-token" id="post-login-oauth2-token"></a>

See [Section 4.1.3](http://tools.ietf.org/html/rfc6749#section-4.1.3) of the OAuth2 RFC for more information about this process.

### POST /login/oauth2/token

#### Parameters

| Parameter               | Required                                                       | Description                                                                                                                                                                                                |
| ----------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| grant\_type             | Required                                                       | Values currently supported: "authorization\_code", "refresh\_token", and "client\_credentials".                                                                                                            |
| client\_id              | Required for grant\_types: authorization\_code, refresh\_token | The client id for your registered application.                                                                                                                                                             |
| client\_secret          | Required for grant\_types: authorization\_code, refresh\_token | The client secret for your registered application.                                                                                                                                                         |
| redirect\_uri           | Required for grant\_types: authorization\_code, refresh\_token | If a redirect\_uri was passed to the initial request in step 1, the same redirect\_uri must be given here.                                                                                                 |
| code                    | Required for grant\_type: authorization\_code                  | Required if grant\_type is authorization\_code. The code you received in a redirect response.                                                                                                              |
| refresh\_token          | Required for grant\_type: refresh\_token                       | Required if grant\_type is refresh\_token. The refresh\_token you received in a redirect response.                                                                                                         |
| client\_assertion\_type | Required for grant\_type: client\_credentials                  | Currently the only supported value for this field is \`urn:ietf:params:oauth:client-assertion-type:jwt-bearer\`.                                                                                           |
| client\_assertion       | Required for grant\_type: client\_credentials                  | The signed jwt used to request an access token. Includes the value of Developer Key id as the sub claim of the jwt body. Should be signed by the private key of the stored public key on the DeveloperKey. |
| scope                   | Required for grant\_type: client\_credentials                  | A list of scopes to be granted to the token. Currently only IMS defined scopes may be used.                                                                                                                |

#### Canvas API example responses

For grant\_type of code or refresh\_token:

| Parameter      | Description                                                                                                                                                                                                       |
| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| access\_token  | The OAuth2 Canvas API access token.                                                                                                                                                                               |
| token\_type    | The type of token that is returned.                                                                                                                                                                               |
| user           | A JSON object of canvas user id and user name.                                                                                                                                                                    |
| refresh\_token | The OAuth2 refresh token.                                                                                                                                                                                         |
| expires\_in    | Seconds until the access token expires.                                                                                                                                                                           |
| canvas\_region | For hosted Canvas, the AWS region (e.g. us-east-1) in which the institution that provided this token resides. For local or open source Canvas, this will have a value of "unknown". This field is safe to ignore. |

When using grant\_type=code (ex: for Canvas API access):

```
  {
    "access_token": "1/fFAGRNJru1FTz70BzhT3Zg",
    "token_type": "Bearer",
    "user": {"id":42, "name": "Jimi Hendrix"},
    "refresh_token": "tIh2YBWGiC0GgGRglT9Ylwv2MnTvy8csfGyfK2PqZmkFYYqYZ0wui4tzI7uBwnN2",
    "expires_in": 3600,
    "canvas_region": "us-east-1"
  }
  
```

When using grant\_type=refresh\_token, the response will not contain a new refresh token since the same refresh token can be used multiple times:

```
  {
    "access_token": "1/fFAGRNJru1FTz70BzhT3Zg",
    "token_type": "Bearer",
    "user": {"id":42, "name": "Jimi Hendrix"},
    "expires_in": 3600
  }
  
```

If scope=/auth/userinfo was specified in the [GET login/oauth2/auth](#get-login-oauth2-auth) request (ex: when using Canvas as an authentication service) then the response that results from [POST login/oauth2/token](#post-login-oauth2-token) would be:

```
  {
    "access_token": null,
    "token_type": "Bearer",
    "user":{"id": 42, "name": "Jimi Hendrix"}
  }
  
```

#### Examples using client\_credentials

When using grant\_type=client\_credentials (ex: [to access LTI Advantage Services](/services/canvas/oauth2/file.oauth#accessing-lti-advantage-services)):

**Example request**

This request must be signed by an RSA256 private key with a public key that is configured on the developer key as described in [Step 1: Developer Key Setup](/services/canvas/oauth2/file.oauth#developer-key-setup).

```
  {
    "grant_type": "client_credentials",
    "client_assertion_type": "urn:ietf:params:oauth:client-assertion-type:jwt-bearer",
    "client_assertion": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjIwMTktMDYtMjFUMTQ6NTk6MzBaIn0.eyJpc3MiOiJodHRwczovL3d3dy5teS10b29sLmNvbSIsInN1YiI6Ilx1MDAzY2NsaWVudF9pZFx1MDAzZSIsImF1ZCI6Imh0dHA6Ly9cdTAwM2NjYW52YXNfZG9tYWluXHUwMDNlL2xvZ2luL29hdXRoMi90b2tlbiIsImlhdCI6MTU2MTc1MDAzMSwiZXhwIjoxNTYxNzUwNjMxLCJqdGkiOiJkZmZkYmRjZS1hOWYxLTQyN2ItOGZjYS02MDQxODIxOTg3ODMifQ.lUHCwDqx2ukKQ2vwoz_824IVcyq-rNdJKVpGUiJea5-Ybk_VfyKW5v0ky-4XTJrGHkDcj0T9J8qKfYbikqyetK44yXx1YGo-2Pn2GEZ26bZxCnuDUDhbqN8OZf4T8DnZsYP4OyhOseHERsHCzKF-SD2_Pk6ES5-Z8J55_aMyS3w3tl4nJtwsMm6FbMDp_FhSGE4xTwkBZ2KNM4JqkCwHGX_9KcpsPsHRFQjn9ysTeg-Qf7H2QFgFMFjsfQX-iSL_bQoC2npSz7rQ8awKMhCEYdMYZk2vVhQ7XQ8ysAyf3m1vlLbHjASpztcAB0lz_DJysT0Ep-Rh311Qf_vXHexjVA",
    "scope": "https://purl.imsglobal.org/spec/lti-ags/lineitem https://purl.imsglobal.org/spec/lti-ags/result/read"
  }
  
```

Below is an example of the decoded client\_assertion JWT in the above request:

```
  //Header
  {
    "typ": "JWT",
    "alg": "RS256",
    "kid": "2019-06-21T14:59:30Z"
  }
  //Payload
  {
    "iss": "https://www.my-tool.com",
    "sub": "<client_id>",
    "aud": "https://<canvas_domain>/login/oauth2/token",
    "iat": 1561750031,
    "exp": 1561750631,
    "jti": "dffdbdce-a9f1-427b-8fca-604182198783"
  }
  
```

NOTE:

* the value of the sub claim should match the client\_id of the developer key in Canvas.
* the value of the aud claim should contain either the domain of the Canvas account where the desired data resides, or the domain of the LTI 1.3 OIDC Auth endpoint, as described [here](/services/canvas/external-tools/lti/file.lti_launch_overview#step-2).
* if the public key defined on the developer key is a JWK set (specified by an URL) the kid (key ID) value in the signed JWT header must match one of the public keys returned by the public key URL.

**Example Response**

| Parameter     | Description                                                               |
| ------------- | ------------------------------------------------------------------------- |
| access\_token | The OAuth2 client\_credentials access token.                              |
| token\_type   | The type of token that is returned.                                       |
| expires\_in   | Seconds until the access token expires.                                   |
| scope         | The scope or space delimited list of scopes granted for the access token. |

```
  {
    "access_token" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ3d3cuZXhhbXBsZS5jb20iLCJpYXQiOiIxNDg1OTA3MjAwIiwiZXhwIjoiMTQ4NTkwNzUwMCIsImltc2dsb2JhbC5vcmcuc2VjdXJpdHkuc2NvcGUiOiJMdGlMaW5rU2V0dGluZ3MgU2NvcmUuaXRlbS5QVVQifQ.UWCuoD05KDYVQHEcciTV88YYtWWMwgb3sTbrjwxGBZA",
    "token_type" : "Bearer",
    "expires_in" : 3600,
    "scope" : "https://purl.imsglobal.org/spec/lti-ags/lineitem https://purl.imsglobal.org/spec/lti-ags/result/read"
  }
  
```

## DELETE login/oauth2/token <a href="#delete-login-oauth2-token" id="delete-login-oauth2-token"></a>

If your application supports logout functionality, you can revoke your own access token. This is useful for security reasons, as well as removing your application from the list of tokens on the user's profile page. Simply make an authenticated request to the following endpoint by including an Authorization header or providing the access\_token as a request parameter.

### DELETE /login/oauth2/token

#### Parameters

| Parameter        | Required | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| expire\_sessions | Optional | <p>Set this to '1' if you want to end all of the user's Canvas web sessions. Without this argument, the endpoint will leave web sessions intact.</p><p>Additionally, if the user logged in to Canvas via a delegated authentication provider, and the provider supports Single Log Out functionality, the response will contain a forward\_url key. If you are still in control of the user's browsing session, it is recommended to then redirect them to this URL, in order to also log them out from where their session originated. Beware that it is unlikely that control will be returned to your application after this redirect.</p> |

#### Example responses

```
  {
    "forward_url": "https://idp.school.edu/opaque_url"
  }
  
```

## GET login/session\_token <a href="#get-login-session-token" id="get-login-session-token"></a>

If your application needs to begin a normal web session in order to access features not supported via API (such as quiz taking), you can use your API access token in order to get a time-limited URL that can be fed to a browser or web view to begin a new web session.

### GET /login/session\_token

#### Parameters

| Parameter  | Required | Description                                                                                    |
| ---------- | -------- | ---------------------------------------------------------------------------------------------- |
| return\_to | Optional | An optional URL to begin the web session at. Otherwise the user will be sent to the dashboard. |

#### Example responses

```
  {
    "session_url": "https://canvas.instructure.com/opaque_url"
  }
  
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Developer Keys

Developer keys are OAuth2 client ID and secret pairs stored in Canvas that allow third-party applications to request access to Canvas API endpoints via the [OAuth2 flow](/services/canvas/oauth2/file.oauth). Access is granted after a user authorizes an app and Canvas creates an API access token that’s returned in the final request of the OAuth2 flow.

Developer keys created in a root account, by root account administrators or Instructure employees, are only functional for the account they are created in and its sub-accounts. Developer keys created globally, by an Instructure employee, are functional in any Canvas account where they are enabled.

By scoping the tokens, Canvas allows root account administrators to manage the specific API endpoints that tokens issued from a developer key have access to.

## Developer Key Scopes

Developer key scopes allow root account administrators to restrict the tokens issued from developer keys to a subset of Canvas API endpoints in their account.

Developer keys may be scoped or unscoped. Unscoped keys will have access to all Canvas resources available to the authorizing user. The following applies to scoped developer keys only:

### What are developer key scopes in Canvas?

Each Canvas API endpoint has an associated scope. Canvas developer key scopes can only be enabled/disabled by a root account administrator or an Instructure employee.

Scopes take the following form:

```
url:<HTTP Verb>|<Canvas API Endpoint Path>
```

For example, the corresponding scope for the `GET /api/v1/courses/:course_id/rubrics` API endpoint would be

```
url:GET|/api/v1/courses/:course_id/rubrics
```

### How do developer key scopes function?

When requesting an access token, third-party applications should specify a `scope` parameter (see the [oauth endpoints documentation](/services/canvas/oauth2/file.oauth_endpoints#get-login-oauth2-auth)). The requested scopes must be a subset of the scopes set for the developer key.

When a client makes any API request, Canvas will verify the requested endpoint's scope has been granted by the account administrator to the developer key of the request's access token.

If the requested endpoint's scope has not been granted Canvas will respond with `401 Unauthorized`.

### Who can grant or revoke scopes for a developer key?

For developer keys created in a specific root account, administrators for that account may grant or revoke scopes. When requesting a developer key, application owners should communicate with administrators which scopes their integrations require.

For global developer keys, an Instructure employee may grant or revoke scopes.

*Note:* If a scope is removed from a developer key, all access tokens derived from that key will be invalidated. In this case, clients should request a new access token.

### Where can I see what scopes are available?

View the complete list of [token scopes](/services/canvas/resources/api_token_scopes). Scopes may also be found beneath their corresponding endpoints in the "resources" documentation pages.

### Configuring scopes on a developer key

When creating or editing an API developer key, administrators can configure scopes in two ways:

**Manual** - Browse and select scopes from a grouped list of all available Canvas API endpoints.

**Paste Scopes** - Paste a list of scope strings directly into a text field. Scopes should be entered one per line or separated by spaces, using the format described above:

```
url:GET|/api/v1/courses/:course_id/rubrics
url:POST|/api/v1/courses/:course_id/assignments
```

Any scope strings that are not recognized as valid Canvas API scopes will be flagged as invalid. The UI will display a warning listing the invalid scopes, and saving will be blocked until they are corrected or removed.

## Developer Key Management

Developer key management features allow root account administrators to turn global developer keys "on" and "off" for only their account.

### What management features are available?

Root account administrators may enable or disable global developer keys for their specific account. This means that vendors who wish to have integrations that work in any Canvas account may request a global developer key from Instructure allowing account administrators enable the key for their account.

### How do management features function?

When a client uses the [OAuth2 Auth endpoint](/services/canvas/oauth2/file.oauth_endpoints#get-login-oauth2-auth) as part of the flow to retrieve an access token canvas will check the developer key associated with the `client_id`. If the developer key is not enabled in the requested account, Canvas will respond with `unauthorized_client`.

When a client makes any API request, Canvas will check the developer key associated with the access token used in the request. If the developer key is not enabled for the requested account, Canvas will respond with `401 Unauthorized`.

## Other Considerations

### Maximum number of scopes

When clients request an access token they may specify what scopes the token needs (see the [oauth endpoints documentation](/services/canvas/oauth2/file.oauth_endpoints#get-login-oauth2-auth)). Because the client sends the scopes they require in a GET request, the maximum number of scopes one access token can specify is limited by the maximum HTTP header size Canvas allows (8000 chars).

On average, an access token may use up to 110 scopes. This number will vary depending on the actual length of the scopes used and any other headers sent in the [login oauth2 request](/services/canvas/oauth2/file.oauth_endpoints#get-login-oauth2-auth) along with the scopes.

If the number of scopes required by the client exceeds this limitation, a second access token with the remaining scopes should be requested.

### Canvas API Includes

Several Canvas APIs allow specifying an `include` parameter. This parameter allows nesting resources in JSON responses. For example, a request to the [assignment index endpoint](https://developerdocs.instructure.com/services/canvas/oauth2/pages/fmw03fjQMjjL5AFja2sQ#method.assignments_api.index) could be made to include the submission objects for each assignment.

Responses to requests made with a scoped access token only support this functionality when the 'Allow Include Parameters' option is also enabled. When this option is disabled, a request is made with a scoped token Canvas will ignore `include` and `includes` parameters.

### Developer Key Scope Changes

During the lifetime of a developer key, scopes may be added or removed by account administrators. Below is a description of possible changes and how each will affect access tokens:

#### New scopes are added to a developer key

Access tokens issued prior to the addition of the new scope will continue to function. These access tokens will not, however, be usable with the new scope. To access the newly added resources clients should request a new access token with scopes. The requested scopes must be a subset of the scopes on the developer key.

#### Scopes are removed from a developer key

Access tokens issued prior to the removal of the scope(s) will *not* continue to function. Clients should request a new access token with scopes. The requested scopes must be a subset of the scopes on the developer key.

#### An unscoped developer key becomes scoped

Access tokens issued prior to the change will *not* continue to function. Clients should request a new access token with scopes. The requested scopes must be a subset of the scopes on the developer key.

If the client attempts to request a new access token without specifying scopes Canvas will respond with an error.

For details on unscoped vs scoped developer key see `Developer Key Scopes` above.

#### A scoped developer key becomes unscoped

Access tokens issued prior to the change will continue to function *and* have access to all resources of the authorizing user. Clients may continue to request scoped access tokens, but these tokens will be functional for all resources available to the authorizing user.

For details on unscoped vs scoped developer key see `Developer Key Scopes` above.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Resources


# Access Tokens

#### A Token object looks like: <a href="#token" id="token"></a>

```js
{
  // The internal database ID of the token.
  "id": null,
  // The time the token was created.
  "created_at": null,
  // The time the token will permanently expire, or null if it does not
  // permanently expire.
  "expires_at": null,
  // The current state of the token. One of 'active', 'pending', 'disabled', or
  // 'deleted'.
  "workflow_state": null,
  // Whether the token should be remembered across sessions. Only applicable for
  // OAuth tokens.
  "remember_access": null,
  // The scopes associated with the token. If empty, there are no scope
  // limitations.
  "scopes": null,
  // If the token was created while masquerading, this is the ID of the real user.
  // Otherwise, null.
  "real_user_id": null,
  // The actual access token. Only included when the token is first created.
  "token": null,
  // A short, unique string that can be used to look up the token.
  "token_hint": null,
  // The ID of the user the token belongs to.
  "user_id": null,
  // The purpose of the token.
  "purpose": null,
  // If the token was created by an OAuth application, this is the name of that
  // application. Otherwise, null.
  "app_name": null,
  // Whether the current user can manually regenerate this token.
  "can_manually_regenerate": null
}
```

## [List access tokens for a user](#method.tokens.user_generated_tokens) <a href="#method.tokens.user_generated_tokens" id="method.tokens.user_generated_tokens"></a>

[TokensController#user\_generated\_tokens](https://github.com/instructure/canvas-lms/blob/master/app/controllers/tokens_controller.rb)

#### `GET /api/v1/users/:user_id/user_generated_tokens`

**Scope:** `url:GET|/api/v1/users/:user_id/user_generated_tokens`

Returns a list of manually generated access tokens for the specified user. Note that the actual token values are only returned when the token is first created.

#### Request Parameters:

| Parameter  | Type      | Description                                                               |
| ---------- | --------- | ------------------------------------------------------------------------- |
| `per_page` | `integer` | The number of results to return per page. Defaults to 10. Maximum of 100. |

Returns a list of [Token](#token) objects.

## [Show an access token](#method.tokens.show) <a href="#method.tokens.show" id="method.tokens.show"></a>

[TokensController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/tokens_controller.rb)

#### `GET /api/v1/users/:user_id/tokens/:id`

**Scope:** `url:GET|/api/v1/users/:user_id/tokens/:id`

The ID can be the actual database ID of the token, or the 'token\_hint' value.

## [Create an access token](#method.tokens.create) <a href="#method.tokens.create" id="method.tokens.create"></a>

[TokensController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/tokens_controller.rb)

#### `POST /api/v1/users/:user_id/tokens`

**Scope:** `url:POST|/api/v1/users/:user_id/tokens`

Create a new access token for the specified user. If the user is not the current user, the token will be created as "pending", and must be activated by the user before it can be used.

#### Request Parameters:

| Parameter           | Type              | Description                                                                                                                                                                                                       |
| ------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `token[purpose]`    | Required `string` | The purpose of the token.                                                                                                                                                                                         |
| `token[expires_at]` | `DateTime`        | The time at which the token will expire.                                                                                                                                                                          |
| `token[scopes][]`   | `Array`           | <p>The scopes to associate with the token.<br>Ignored if the default developer key does not have the "enable scopes" option enabled.<br>In such cases, the token will inherit the user's permissions instead.</p> |

## [Update an access token](#method.tokens.update) <a href="#method.tokens.update" id="method.tokens.update"></a>

[TokensController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/tokens_controller.rb)

#### `PUT /api/v1/users/:user_id/tokens/:id`

**Scope:** `url:PUT|/api/v1/users/:user_id/tokens/:id`

Update an existing access token.

The ID can be the actual database ID of the token, or the 'token\_hint' value.

Regenerating an expired token requires a new expiration date.

#### Request Parameters:

| Parameter           | Type       | Description                              |
| ------------------- | ---------- | ---------------------------------------- |
| `token[purpose]`    | `string`   | The purpose of the token.                |
| `token[expires_at]` | `DateTime` | The time at which the token will expire. |
| `token[scopes][]`   | `Array`    | The scopes to associate with the token.  |
| `token[regenerate]` | `boolean`  | Regenerate the actual token.             |

## [Delete an access token](#method.tokens.destroy) <a href="#method.tokens.destroy" id="method.tokens.destroy"></a>

[TokensController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/tokens_controller.rb)

#### `DELETE /api/v1/users/:user_id/tokens/:id`

**Scope:** `url:DELETE|/api/v1/users/:user_id/tokens/:id`

The ID can be the actual database ID of the token, or the 'token\_hint' value.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Accessibility Course Scans

## [Trigger accessibility course scan](#method.accessibility_course_scans.create) <a href="#method.accessibility_course_scans.create" id="method.accessibility_course_scans.create"></a>

[AccessibilityCourseScansController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accessibility_course_scans_controller.rb)

#### `POST /api/v1/users/:user_id/educator_accessibility_course_scan`

**Scope:** `url:POST|/api/v1/users/:user_id/educator_accessibility_course_scan`

Queues a background job that scans all a11y-enabled courses where the user has an active teacher or designer enrollment. Idempotent — if a scan is already queued or running, the existing Progress is returned.

Requires the educator\_dashboard feature flag on the root account and a11y\_checker\_account\_statistics on site admin.

#### Request Parameters:

| Parameter | Type              | Description                                                                                                               |
| --------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------- |
| `user_id` | Required `string` | <p>The ID of the user, or "self" for the current user.<br>The requesting user may only trigger a scan for themselves.</p> |

Returns a [Progress](/services/canvas/resources/progress#progress) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Accessibility Course Statistics

#### An AccessibilityCourseStatistic object looks like: <a href="#accessibilitycoursestatistic" id="accessibilitycoursestatistic"></a>

```js
// Per-course accessibility issue counts for a user's active teacher/designer
// courses.
{
  // The ID of the accessibility course statistic record
  "id": 1,
  // The ID of the course
  "course_id": 42,
  // The name of the course
  "course_name": "Introduction to Biology",
  // The course code (short name) of the course
  "course_code": "BIO101",
  // Whether the course is published
  "published": true,
  // The number of active accessibility issues in the course
  "active_issue_count": 5,
  // The number of resolved accessibility issues in the course
  "resolved_issue_count": 3,
  // The number of closed accessibility issues in the course
  "closed_issue_count": 2,
  // The workflow state of the statistic record
  "workflow_state": "active",
  // The date and time the record was created
  "created_at": "2026-01-01T00:00:00Z",
  // The date and time the record was last updated
  "updated_at": "2026-01-02T00:00:00Z"
}
```

## [List accessibility course statistics](#method.accessibility_course_statistics.index) <a href="#method.accessibility_course_statistics.index" id="method.accessibility_course_statistics.index"></a>

[AccessibilityCourseStatisticsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accessibility_course_statistics_controller.rb)

#### `GET /api/v1/users/:user_id/educator_accessibility_course_statistics`

**Scope:** `url:GET|/api/v1/users/:user_id/educator_accessibility_course_statistics`

Returns per-course accessibility issue statistics for the current user's active teacher and designer courses. Only courses where the accessibility checker is enabled and whose workflow state is neither completed nor deleted are included. Only statistic records with workflow\_state "active" are returned.

Requires the educator\_dashboard feature flag to be enabled on the root account, and a11y\_checker\_account\_statistics on site admin plus a11y\_checker on the account (i.e. a11y\_checker\_account\_statistics? must be true).

#### Request Parameters:

| Parameter            | Type              | Description                                                                                                                                                                                                                                                                                                   |
| -------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `user_id`            | Required `string` | <p>The ID of the user, or "self" for the current user.<br>The requesting user may only retrieve their own statistics.</p>                                                                                                                                                                                     |
| `enrollment_term_id` | `string`          | <p>When present, only include courses that belong to the given enrollment<br>term(s). Accepts a single term id or an array<br>(enrollment\_term\_id\[]=1\&enrollment\_term\_id\[]=2), and each value may be a<br>term id or SIS term id. Returns 404 if any given term does not exist in<br>this account.</p> |

Returns a list of [AccessibilityCourseStatistic](#accessibilitycoursestatistic) objects.

## [List accessibility course statistic terms](#method.accessibility_course_statistics.terms) <a href="#method.accessibility_course_statistics.terms" id="method.accessibility_course_statistics.terms"></a>

[AccessibilityCourseStatisticsController#terms](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accessibility_course_statistics_controller.rb)

#### `GET /api/v1/users/:user_id/educator_accessibility_course_terms`

**Scope:** `url:GET|/api/v1/users/:user_id/educator_accessibility_course_terms`

Returns the distinct enrollment terms that the current user's active teacher and designer courses belong to -- the same courses reported by the List accessibility course statistics endpoint. Use this to populate a term filter for that endpoint. There is no "all terms" entry; "all terms" is represented by omitting the enrollment\_term\_id filter.

Requires the same account settings and feature flags as the statistics endpoint.

#### Request Parameters:

| Parameter | Type              | Description                                                                                                          |
| --------- | ----------------- | -------------------------------------------------------------------------------------------------------------------- |
| `user_id` | Required `string` | <p>The ID of the user, or "self" for the current user.<br>The requesting user may only retrieve their own terms.</p> |

Returns a list of [EnrollmentTerm](/services/canvas/resources/enrollment_terms#enrollmentterm) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Account Calendars

API for viewing and toggling settings of account calendars.

An account calendar is available for each account in Canvas. All account calendars are hidden by default, but administrators with the `manage_account_calendar_visibility` permission may set calendars as visible. Administrators with the `manage_account_calendar_events` permission can create events in visible account calendars, and users associated with an account can add the calendar and see its events (if the calendar is visible). Events on calendars set as `auto_subscribe` calendars will appear on users' calendars even if they do not manually add it.

#### An AccountCalendar object looks like: <a href="#accountcalendar" id="accountcalendar"></a>

```js
{
  // the ID of the account associated with this calendar
  "id": 204,
  // the name of the account associated with this calendar
  "name": "Department of Chemistry",
  // the account's parent ID, or null if this is the root account
  "parent_account_id": 1,
  // the ID of the root account, or null if this is the root account
  "root_account_id": 1,
  // whether this calendar is visible to users
  "visible": true,
  // whether users see this calendar's events without needing to manually add it
  "auto_subscribe": false,
  // number of this account's direct sub-accounts
  "sub_account_count": 0,
  // Asset string of the account
  "asset_string": "account_4",
  // Object type
  "type": "account",
  // url to get full detailed events
  "calendar_event_url": "/accounts/2/calendar_events/%7B%7B%20id%20%7D%7D",
  // whether the user can create calendar events
  "can_create_calendar_events": true,
  // API path to create events for the account
  "create_calendar_event_url": "/accounts/2/calendar_events",
  // url to open the more options event editor
  "new_calendar_event_url": "/accounts/6/calendar_events/new"
}
```

## [List available account calendars](#method.account_calendars_api.index) <a href="#method.account_calendars_api.index" id="method.account_calendars_api.index"></a>

[AccountCalendarsApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_calendars_api_controller.rb)

#### `GET /api/v1/account_calendars`

**Scope:** `url:GET|/api/v1/account_calendars`

Returns a paginated list of account calendars available to the current user. Includes visible account calendars where the user has an account association.

#### Request Parameters:

| Parameter     | Type     | Description                                                                                                                               |
| ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `search_term` | `string` | <p>When included, searches available account calendars for the term. Returns matching<br>results. Term must be at least 2 characters.</p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/account_calendars \
  -H 'Authorization: Bearer <token>'
```

Returns a list of [AccountCalendar](#accountcalendar) objects.

## [Get a single account calendar](#method.account_calendars_api.show) <a href="#method.account_calendars_api.show" id="method.account_calendars_api.show"></a>

[AccountCalendarsApiController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_calendars_api_controller.rb)

#### `GET /api/v1/account_calendars/:account_id`

**Scope:** `url:GET|/api/v1/account_calendars/:account_id`

Get details about a specific account calendar.

#### Example Request:

```bash
curl https://<canvas>/api/v1/account_calendars/204 \
  -H 'Authorization: Bearer <token>'
```

Returns an [AccountCalendar](#accountcalendar) object.

## [Update a calendar](#method.account_calendars_api.update) <a href="#method.account_calendars_api.update" id="method.account_calendars_api.update"></a>

[AccountCalendarsApiController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_calendars_api_controller.rb)

#### `PUT /api/v1/account_calendars/:account_id`

**Scope:** `url:PUT|/api/v1/account_calendars/:account_id`

Set an account calendar's visibility and auto\_subscribe values. Requires the `manage_account_calendar_visibility` permission on the account.

#### Request Parameters:

| Parameter        | Type      | Description                                                                                                                                                                               |
| ---------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `visible`        | `boolean` | <p>Allow administrators with <code>manage\_account\_calendar\_events</code> permission<br>to create events on this calendar, and allow users to view this<br>calendar and its events.</p> |
| `auto_subscribe` | `boolean` | <p>When true, users will automatically see events from this account in their<br>calendar, even if they haven't manually added that calendar.</p>                                          |

#### Example Request:

```bash
curl https://<canvas>/api/v1/account_calendars/204 \
  -X PUT \
  -H 'Authorization: Bearer <token>' \
  -d 'visible=false' \
  -d 'auto_subscribe=false'
```

Returns an [AccountCalendar](#accountcalendar) object.

## [Update several calendars](#method.account_calendars_api.bulk_update) <a href="#method.account_calendars_api.bulk_update" id="method.account_calendars_api.bulk_update"></a>

[AccountCalendarsApiController#bulk\_update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_calendars_api_controller.rb)

#### `PUT /api/v1/accounts/:account_id/account_calendars`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/account_calendars`

Set visibility and/or auto\_subscribe on many calendars simultaneously. Requires the `manage_account_calendar_visibility` permission on the account.

Accepts a JSON array of objects containing 2-3 keys each: `id` (the account's id, required), `visible` (a boolean indicating whether the account calendar is visible), and `auto_subscribe` (a boolean indicating whether users should see these events in their calendar without manually subscribing).

Returns the count of updated accounts.

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/1/account_calendars \
  -X PUT \
  -H 'Authorization: Bearer <token>' \
  --data '[{"id": 1, "visible": true, "auto_subscribe": false}, {"id": 13, "visible": false, "auto_subscribe": true}]'
```

## [List all account calendars](#method.account_calendars_api.all_calendars) <a href="#method.account_calendars_api.all_calendars" id="method.account_calendars_api.all_calendars"></a>

[AccountCalendarsApiController#all\_calendars](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_calendars_api_controller.rb)

#### `GET /api/v1/accounts/:account_id/account_calendars`

**Scope:** `url:GET|/api/v1/accounts/:account_id/account_calendars`

Returns a paginated list of account calendars for the provided account and its first level of sub-accounts. Includes hidden calendars in the response. Requires the `manage_account_calendar_visibility` permission.

#### Request Parameters:

| Parameter     | Type     | Description                                                                                                                                                                                       |
| ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `search_term` | `string` | <p>When included, searches all descendent accounts of provided account for the<br>term. Returns matching results. Term must be at least 2 characters. Can be<br>combined with a filter value.</p> |
| `filter`      | `string` | <p>When included, only returns calendars that are either visible or hidden. Can<br>be combined with a search term. Allowed values: <code>visible</code>, <code>hidden</code></p>                  |

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/1/account_calendars \
  -H 'Authorization: Bearer <token>'
```

Returns a list of [AccountCalendar](#accountcalendar) objects.

## [Count of all visible account calendars](#method.account_calendars_api.visible_calendars_count) <a href="#method.account_calendars_api.visible_calendars_count" id="method.account_calendars_api.visible_calendars_count"></a>

[AccountCalendarsApiController#visible\_calendars\_count](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_calendars_api_controller.rb)

#### `GET /api/v1/accounts/:account_id/visible_calendars_count`

**Scope:** `url:GET|/api/v1/accounts/:account_id/visible_calendars_count`

Returns the number of visible account calendars.

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/1/visible_calendars_count \
  -H 'Authorization: Bearer <token>'
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Account Domain Lookups

## [Search account domains](#method.account_domain_lookups.search) <a href="#method.account_domain_lookups.search" id="method.account_domain_lookups.search"></a>

#### `GET /api/v1/accounts/search`

**Scope:** `url:GET|/api/v1/accounts/search`

Returns a list of up to 5 matching account domains

Partial match on name / domain are supported

#### Request Parameters:

| Parameter   | Type     | Description    |
| ----------- | -------- | -------------- |
| `name`      | `string` | campus name    |
| `domain`    | `string` | no description |
| `latitude`  | `number` | no description |
| `longitude` | `number` | no description |

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/search \
  -G -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -d 'name=utah'
```

#### Example Response:

```js
[
  {
    "name": "University of Utah",
    "domain": "utah.edu",
    "distance": null, // distance is always nil, but preserved in the api response for backwards compatibility
    "authentication_provider": "canvas", // which authentication_provider param to pass to the oauth flow; may be NULL
  },
  ...
]
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Account Notifications

API for account notifications.

#### An AccountNotification object looks like: <a href="#accountnotification" id="accountnotification"></a>

```js
{
  // The subject of the notifications
  "subject": "Attention Students",
  // The message to be sent in the notification.
  "message": "This is a test of the notification system.",
  // When to send out the notification.
  "start_at": "2013-08-28T23:59:00-06:00",
  // When to expire the notification.
  "end_at": "2013-08-29T23:59:00-06:00",
  // The icon to display with the message.  Defaults to warning.
  "icon": "information",
  // (Deprecated) The roles to send the notification to.  If roles is not passed
  // it defaults to all roles
  "roles": ["StudentEnrollment"],
  // The roles to send the notification to.  If roles is not passed it defaults to
  // all roles
  "role_ids": [1],
  // The author of the notification. Available only to admins using include_all.
  "author": {"id":1,"name":"John Doe"}
}
```

## [Index of active global notification for the user](#method.account_notifications.user_index) <a href="#method.account_notifications.user_index" id="method.account_notifications.user_index"></a>

[AccountNotificationsController#user\_index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_notifications_controller.rb)

#### `GET /api/v1/accounts/:account_id/account_notifications`

**Scope:** `url:GET|/api/v1/accounts/:account_id/account_notifications`

Returns a list of all global notifications in the account for the current user Any notifications that have been closed by the user will not be returned, unless a include\_past parameter is passed in as true. Admins can request all global notifications for the account by passing in an include\_all parameter.

#### Request Parameters:

| Parameter        | Type      | Description                                                                                                         |
| ---------------- | --------- | ------------------------------------------------------------------------------------------------------------------- |
| `include_past`   | `boolean` | Include past and dismissed global announcements.                                                                    |
| `include_all`    | `boolean` | Include all global announcements, regardless of user's role or availability date. Only available to account admins. |
| `show_is_closed` | `boolean` | Include a flag for each notification indicating whether it has been read by the user.                               |

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/accounts/2/users/self/account_notifications
```

Returns a list of [AccountNotification](#accountnotification) objects.

## [Show a global notification](#method.account_notifications.show) <a href="#method.account_notifications.show" id="method.account_notifications.show"></a>

[AccountNotificationsController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_notifications_controller.rb)

#### `GET /api/v1/accounts/:account_id/account_notifications/:id`

**Scope:** `url:GET|/api/v1/accounts/:account_id/account_notifications/:id`

Returns a global notification for the current user A notification that has been closed by the user will not be returned

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/accounts/2/users/self/account_notifications/4
```

Returns an [AccountNotification](#accountnotification) object.

## [Create a global notification](#method.account_notifications.create) <a href="#method.account_notifications.create" id="method.account_notifications.create"></a>

[AccountNotificationsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_notifications_controller.rb)

#### `POST /api/v1/accounts/:account_id/account_notifications`

**Scope:** `url:POST|/api/v1/accounts/:account_id/account_notifications`

Create and return a new global notification for an account.

#### Request Parameters:

| Parameter                        | Type                | Description                                                                                                                                                                                                      |
| -------------------------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account_notification[subject]`  | Required `string`   | The subject of the notification.                                                                                                                                                                                 |
| `account_notification[message]`  | Required `string`   | The message body of the notification.                                                                                                                                                                            |
| `account_notification[start_at]` | Required `DateTime` | <p>The start date and time of the notification in ISO8601 format.<br>e.g. 2014-01-01T01:00Z</p>                                                                                                                  |
| `account_notification[end_at]`   | Required `DateTime` | <p>The end date and time of the notification in ISO8601 format.<br>e.g. 2014-01-01T01:00Z</p>                                                                                                                    |
| `account_notification[icon]`     | `string`            | <p>The icon to display with the notification.<br>Note: Defaults to warning. Allowed values: <code>warning</code>, <code>information</code>, <code>question</code>, <code>error</code>, <code>calendar</code></p> |
| `account_notification_roles[]`   | `string`            | <p>The role(s) to send global notification to. Note: ommitting this field will send to everyone<br>Example:<br>account\_notification\_roles: \["StudentEnrollment", "TeacherEnrollment"]</p>                     |

#### Example Request:

```bash
curl -X POST -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/accounts/2/account_notifications \
-d 'account_notification[subject]=New notification' \
-d 'account_notification[start_at]=2014-01-01T00:00:00Z' \
-d 'account_notification[end_at]=2014-02-01T00:00:00Z' \
-d 'account_notification[message]=This is a global notification'
```

#### Example Response:

```js
{
  "subject": "New notification",
  "start_at": "2014-01-01T00:00:00Z",
  "end_at": "2014-02-01T00:00:00Z",
  "message": "This is a global notification"
}
```

## [Update a global notification](#method.account_notifications.update) <a href="#method.account_notifications.update" id="method.account_notifications.update"></a>

[AccountNotificationsController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_notifications_controller.rb)

#### `PUT /api/v1/accounts/:account_id/account_notifications/:id`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/account_notifications/:id`

Update global notification for an account.

#### Request Parameters:

| Parameter                        | Type       | Description                                                                                                                                                                                  |
| -------------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account_notification[subject]`  | `string`   | The subject of the notification.                                                                                                                                                             |
| `account_notification[message]`  | `string`   | The message body of the notification.                                                                                                                                                        |
| `account_notification[start_at]` | `DateTime` | <p>The start date and time of the notification in ISO8601 format.<br>e.g. 2014-01-01T01:00Z</p>                                                                                              |
| `account_notification[end_at]`   | `DateTime` | <p>The end date and time of the notification in ISO8601 format.<br>e.g. 2014-01-01T01:00Z</p>                                                                                                |
| `account_notification[icon]`     | `string`   | The icon to display with the notification. Allowed values: `warning`, `information`, `question`, `error`, `calendar`                                                                         |
| `account_notification_roles[]`   | `string`   | <p>The role(s) to send global notification to. Note: ommitting this field will send to everyone<br>Example:<br>account\_notification\_roles: \["StudentEnrollment", "TeacherEnrollment"]</p> |

#### Example Request:

```bash
curl -X PUT -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/accounts/2/account_notifications/1 \
-d 'account_notification[subject]=New notification' \
-d 'account_notification[start_at]=2014-01-01T00:00:00Z' \
-d 'account_notification[end_at]=2014-02-01T00:00:00Z' \
-d 'account_notification[message]=This is a global notification'
```

#### Example Response:

```js
{
  "subject": "New notification",
  "start_at": "2014-01-01T00:00:00Z",
  "end_at": "2014-02-01T00:00:00Z",
  "message": "This is a global notification"
}
```

## [Close notification for user. Destroy notification for admin](#method.account_notifications.user_close_notification) <a href="#method.account_notifications.user_close_notification" id="method.account_notifications.user_close_notification"></a>

[AccountNotificationsController#user\_close\_notification](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_notifications_controller.rb)

#### `DELETE /api/v1/accounts/:account_id/account_notifications/:id`

**Scope:** `url:DELETE|/api/v1/accounts/:account_id/account_notifications/:id`

If the current user no longer wants to see this account notification, it can be closed with this call. This affects the current user only.

If the current user is an admin and they pass a remove parameter with a value of "true", the account notification will be destroyed. This affects all users.

#### Request Parameters:

| Parameter | Type      | Description                       |
| --------- | --------- | --------------------------------- |
| `remove`  | `boolean` | Destroy the account notification. |

#### Example Request:

```bash
curl -X DELETE -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/accounts/2/account_notifications/4
```

Returns an [AccountNotification](#accountnotification) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Account Reports

API for accessing account reports.

#### A Report object looks like: <a href="#report" id="report"></a>

```js
{
  // The unique identifier for the report.
  "id": 1,
  // The type of report.
  "report": "sis_export_csv",
  // The url to the report download.
  "file_url": "https://example.com/some/path",
  // The attachment api object of the report. Only available after the report has
  // completed.
  "attachment": null,
  // The status of the report
  "status": "complete",
  // The date and time the report was created.
  "created_at": "2013-12-01T23:59:00-06:00",
  // The date and time the report started processing.
  "started_at": "2013-12-02T00:03:21-06:00",
  // The date and time the report finished processing.
  "ended_at": "2013-12-02T00:03:21-06:00",
  // The time (in seconds) the report has been waiting to run, has been running so
  // far, or took to run to completion, depending on its current state.
  "run_time": 33.3,
  // The report parameters
  "parameters": {"course_id":2,"start_at":"2012-07-13T10:55:20-06:00","end_at":"2012-07-13T10:55:20-06:00"},
  // The progress of the report
  "progress": 100,
  // This is the current line count being written to the report. It updates every
  // 1000 records.
  "current_line": 12000,
  // The user that initiated the account report. See the Users API for details.
  "user": null
}
```

#### A ReportParameters object looks like: <a href="#reportparameters" id="reportparameters"></a>

```js
// The parameters returned will vary for each report.
{
  // The canvas id of the term to get grades from
  "enrollment_term_id": 2,
  // If true, deleted objects will be included. If false, deleted objects will be
  // omitted.
  "include_deleted": false,
  // The id of the course to report on
  "course_id": 2,
  // The sort order for the csv, Options: 'users', 'courses', 'outcomes'.
  "order": "users",
  // If true, user data will be included. If false, user data will be omitted.
  "users": false,
  // If true, account data will be included. If false, account data will be
  // omitted.
  "accounts": false,
  // If true, term data will be included. If false, term data will be omitted.
  "terms": false,
  // If true, course data will be included. If false, course data will be omitted.
  "courses": false,
  // If true, section data will be included. If false, section data will be
  // omitted.
  "sections": false,
  // If true, enrollment data will be included. If false, enrollment data will be
  // omitted.
  "enrollments": false,
  // If true, group data will be included. If false, group data will be omitted.
  "groups": false,
  // If true, data for crosslisted courses will be included. If false, data for
  // crosslisted courses will be omitted.
  "xlist": false,
  "sis_terms_csv": 1,
  "sis_accounts_csv": 1,
  // If true, enrollment state will be included. If false, enrollment state will
  // be omitted. Defaults to false.
  "include_enrollment_state": false,
  // Include enrollment state. Defaults to 'all' Options: ['active'| 'invited'|
  // 'creation_pending'| 'deleted'| 'rejected'| 'completed'| 'inactive'| 'all']
  "enrollment_state": ["all"],
  // The beginning date for submissions. Max time range is 2 weeks.
  "start_at": "2012-07-13T10:55:20-06:00",
  // The end date for submissions. Max time range is 2 weeks.
  "end_at": "2012-07-13T10:55:20-06:00"
}
```

## [List Available Reports](#method.account_reports.available_reports) <a href="#method.account_reports.available_reports" id="method.account_reports.available_reports"></a>

[AccountReportsController#available\_reports](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_reports_controller.rb)

#### `GET /api/v1/accounts/:account_id/reports`

**Scope:** `url:GET|/api/v1/accounts/:account_id/reports`

Returns a paginated list of reports for the current context.

#### Request Parameters:

| Parameter   | Type     | Description                                                                                                                                                                                                                                                                 |
| ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]` | `string` | <p>Array of additional information to include.<br>"description\_html":: an HTML description of the report, with example output<br>"parameters\_html":: an HTML form for the report parameters Allowed values: <code>description\_html</code>, <code>params\_html</code></p> |

#### API response field:

* name

The name of the report.

* parameters

The parameters will vary for each report

* last\_run

\[Report] The last run of the report. This will be null if the report has never been run.

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
     https://<canvas>/api/v1/accounts/<account_id>/reports/
```

#### Example Response:

```js
[
  {
    "report":"student_assignment_outcome_map_csv",
    "title":"Student Competency",
    "parameters":null,
    "last_run": {
      "id": 1,
      "report": "student_assignment_outcome_map_csv",
      "file_url": "https://example.com/some/path",
      "status": "complete",
      "created_at": "2013-12-01T23:59:00-06:00",
      "started_at": "2013-12-02T00:03:21-06:00",
      "ended_at": "2013-12-02T00:03:21-06:00"
  },
  {
    "report":"grade_export_csv",
    "title":"Grade Export",
    "parameters":{
      "term":{
        "description":"The canvas id of the term to get grades from",
        "required":true
      }
    },
    "last_run": null
  }
]
```

## [Start a Report](#method.account_reports.create) <a href="#method.account_reports.create" id="method.account_reports.create"></a>

[AccountReportsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_reports_controller.rb)

#### `POST /api/v1/accounts/:account_id/reports/:report`

**Scope:** `url:POST|/api/v1/accounts/:account_id/reports/:report`

Generates a report instance for the account. Note that "report" in the request must match one of the available report names. To fetch a list of available report names and parameters for each report (including whether or not those parameters are required), see [List Available Reports](#method.account_reports.available_reports).

#### Request Parameters:

| Parameter                  | Type      | Description                                                                                                                                                                                                                                                                                                                                  |
| -------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `parameters[]`             | `Hash`    | <p>The parameters will vary for each report. To fetch a list<br>of available parameters for each report, see <a href="#method.account_reports.available_reports">List Available Reports</a>.<br>A few example parameters have been provided below. Note that the example<br>parameters provided below may not be valid for every report.</p> |
| `parameters[skip_message]` | `boolean` | <p>If true, no message will be sent<br>to the user upon completion of the report.</p>                                                                                                                                                                                                                                                        |
| `parameters[course_id]`    | `integer` | <p>The id of the course to report on.<br>Note: this parameter has been listed to serve as an example and may not be<br>valid for every report.</p>                                                                                                                                                                                           |
| `parameters[users]`        | `boolean` | <p>If true, user data will be included. If<br>false, user data will be omitted. Note: this parameter has been listed to<br>serve as an example and may not be valid for every report.</p>                                                                                                                                                    |

#### Example Request:

```bash
curl -X POST \
     https://<canvas>/api/v1/accounts/1/reports/provisioning_csv \
     -H 'Authorization: Bearer <token>' \
     -H 'Content-Type: multipart/form-data' \
     -F 'parameters[users]=true' \
     -F 'parameters[courses]=true' \
     -F 'parameters[enrollments]=true'
```

Returns a [Report](/services/canvas/resources/course_reports#report) object.

## [Index of Reports](#method.account_reports.index) <a href="#method.account_reports.index" id="method.account_reports.index"></a>

[AccountReportsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_reports_controller.rb)

#### `GET /api/v1/accounts/:account_id/reports/:report`

**Scope:** `url:GET|/api/v1/accounts/:account_id/reports/:report`

Shows all reports that have been run for the account of a specific type.

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
     https://<canvas>/api/v1/accounts/<account_id>/reports/<report_type>
```

Returns a list of [Report](/services/canvas/resources/course_reports#report) objects.

## [Status of a Report](#method.account_reports.show) <a href="#method.account_reports.show" id="method.account_reports.show"></a>

[AccountReportsController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_reports_controller.rb)

#### `GET /api/v1/accounts/:account_id/reports/:report/:id`

**Scope:** `url:GET|/api/v1/accounts/:account_id/reports/:report/:id`

Returns the status of a report.

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
     https://<canvas>/api/v1/accounts/<account_id>/reports/<report_type>/<report_id>
```

Returns a [Report](/services/canvas/resources/course_reports#report) object.

## [Delete a Report](#method.account_reports.destroy) <a href="#method.account_reports.destroy" id="method.account_reports.destroy"></a>

[AccountReportsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_reports_controller.rb)

#### `DELETE /api/v1/accounts/:account_id/reports/:report/:id`

**Scope:** `url:DELETE|/api/v1/accounts/:account_id/reports/:report/:id`

Deletes a generated report instance.

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
     -X DELETE \
     https://<canvas>/api/v1/accounts/<account_id>/reports/<report_type>/<id>
```

Returns a [Report](/services/canvas/resources/course_reports#report) object.

## [Abort a Report](#method.account_reports.abort) <a href="#method.account_reports.abort" id="method.account_reports.abort"></a>

[AccountReportsController#abort](https://github.com/instructure/canvas-lms/blob/master/app/controllers/account_reports_controller.rb)

#### `PUT /api/v1/accounts/:account_id/reports/:report/:id/abort`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/reports/:report/:id/abort`

Abort a report in progress

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
     -X PUT \
     https://<canvas>/api/v1/accounts/<account_id>/reports/<report_type>/<id>/abort
```

Returns a [Report](/services/canvas/resources/course_reports#report) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Accounts

API for accessing account data.

#### An Account object looks like: <a href="#account" id="account"></a>

```js
{
  // the ID of the Account object
  "id": 2,
  // The display name of the account
  "name": "Canvas Account",
  // The UUID of the account
  "uuid": "WvAHhY5FINzq5IyRIJybGeiXyFkG3SqHUPb7jZY5",
  // The account's parent ID, or null if this is the root account
  "parent_account_id": 1,
  // The ID of the root account, or null if this is the root account
  "root_account_id": 1,
  // The storage quota for the account in megabytes, if not otherwise specified
  "default_storage_quota_mb": 500,
  // The storage quota for a user in the account in megabytes, if not otherwise
  // specified
  "default_user_storage_quota_mb": 50,
  // The storage quota for a group in the account in megabytes, if not otherwise
  // specified
  "default_group_storage_quota_mb": 50,
  // The default time zone of the account. Allowed time zones are
  // {http://www.iana.org/time-zones IANA time zones} or friendlier
  // {http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html Ruby on Rails
  // time zones}.
  "default_time_zone": "America/Denver",
  // The friendly Ruby on Rails name of the account's default time zone. Since
  // several Rails time zones can share a single IANA identifier (the value
  // returned in default_time_zone), this field disambiguates which one is
  // configured.
  "default_time_zone_friendly_name": "Mountain Time (US & Canada)",
  // The account's identifier in the Student Information System. Only included if
  // the user has permission to view SIS information.
  "sis_account_id": "123xyz",
  // The account's identifier in the Student Information System. Only included if
  // the user has permission to view SIS information.
  "integration_id": "123xyz",
  // The id of the SIS import if created through SIS. Only included if the user
  // has permission to manage SIS information.
  "sis_import_id": 12,
  // The number of courses directly under the account (available via include)
  "course_count": 10,
  // The number of sub-accounts directly under the account (available via include)
  "sub_account_count": 10,
  // The account's identifier that is sent as context_id in LTI launches.
  "lti_guid": "123xyz",
  // The state of the account. Can be 'active' or 'deleted'.
  "workflow_state": "active"
}
```

#### A TermsOfService object looks like: <a href="#termsofservice" id="termsofservice"></a>

```js
{
  // Terms Of Service id
  "id": 1,
  // The given type for the Terms of Service
  "terms_type": "default",
  // Boolean dictating if the user must accept Terms of Service
  "passive": false,
  // The id of the root account that owns the Terms of Service
  "account_id": 1,
  // Content of the Terms of Service
  "content": "To be or not to be that is the question",
  // The type of self registration allowed
  "self_registration_type": "["none", "observer", "all"]"
}
```

#### A HelpLink object looks like: <a href="#helplink" id="helplink"></a>

```js
{
  // The ID of the help link
  "id": "instructor_question",
  // The name of the help link
  "text": "Ask Your Instructor a Question",
  // The description of the help link
  "subtext": "Questions are submitted to your instructor",
  // The URL of the help link
  "url": "#teacher_feedback",
  // The type of the help link
  "type": "default",
  // The roles that have access to this help link
  "available_to": ["user", "student", "teacher", "admin", "observer", "unenrolled"]
}
```

#### A HelpLinks object looks like: <a href="#helplinks" id="helplinks"></a>

```js
{
  // Help link button title
  "help_link_name": "Help And Policies",
  // Help link button icon
  "help_link_icon": "help",
  // Help links defined by the account. Could include default help links.
  "custom_help_links": [{"id":"link1","text":"Custom Link!","subtext":"Something something.","url":"https:\/\/google.com","type":"custom","available_to":["user","student","teacher","admin","observer","unenrolled"],"is_featured":true,"is_new":false,"feature_headline":"Check this out!"}],
  // Default help links provided when account has not set help links of their own.
  "default_help_links": [{"available_to":["student"],"text":"Ask Your Instructor a Question","subtext":"Questions are submitted to your instructor","url":"#teacher_feedback","type":"default","id":"instructor_question","is_featured":false,"is_new":true,"feature_headline":""}, {"available_to":["user","student","teacher","admin","observer","unenrolled"],"text":"Search the Canvas Guides","subtext":"Find answers to common questions","url":"https:\/\/community.canvaslms.com\/t5\/Guides\/ct-p\/guides","type":"default","id":"search_the_canvas_guides","is_featured":false,"is_new":false,"feature_headline":""}, {"available_to":["user","student","teacher","admin","observer","unenrolled"],"text":"Report a Problem","subtext":"If Canvas misbehaves, tell us about it","url":"#create_ticket","type":"default","id":"report_a_problem","is_featured":false,"is_new":false,"feature_headline":""}]
}
```

## [List accounts](#method.accounts.index) <a href="#method.accounts.index" id="method.accounts.index"></a>

[AccountsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/accounts`

**Scope:** `url:GET|/api/v1/accounts`

A paginated list of accounts that the current user can view or manage. Typically, students and even teachers will get an empty list in response, only account admins can view the accounts that they are in.

#### Request Parameters:

| Parameter   | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ----------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]` | `string` | <p>Array of additional information to include.<br>"lti\_guid":: the 'tool\_consumer\_instance\_guid' that will be sent for this account on LTI launches<br>"registration\_settings":: returns info about the privacy policy and terms of use<br>"services":: returns services and whether they are enabled (requires account management permissions)<br>"course\_count":: returns the number of courses directly under each account<br>"sub\_account\_count":: returns the number of sub-accounts directly under each account Allowed values: <code>lti\_guid</code>, <code>registration\_settings</code>, <code>services</code>, <code>course\_count</code>, <code>sub\_account\_count</code></p> |

Returns a list of [Account](/services/canvas/resources/accounts_-lti#account) objects.

## [List horizon accounts](#method.accounts.horizon_accounts) <a href="#method.accounts.horizon_accounts" id="method.accounts.horizon_accounts"></a>

[AccountsController#horizon\_accounts](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/horizon_accounts`

**Scope:** `url:GET|/api/v1/horizon_accounts`

A paginated list of horizon accounts that the current user can view or manage. Returns all accounts with the horizon\_account setting enabled. If there are any horizon accounts and the user has access to Site Admin, Site Admin will also be included in the results.

Typically, students and even teachers will get an empty list in response, only account admins can view the accounts that they are in.

#### Request Parameters:

| Parameter   | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ----------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]` | `string` | <p>Array of additional information to include.<br>"lti\_guid":: the 'tool\_consumer\_instance\_guid' that will be sent for this account on LTI launches<br>"registration\_settings":: returns info about the privacy policy and terms of use<br>"services":: returns services and whether they are enabled (requires account management permissions)<br>"course\_count":: returns the number of courses directly under each account<br>"sub\_account\_count":: returns the number of sub-accounts directly under each account<br>"site\_admin":: returns true if the account is the Site Admin account (only included if true) Allowed values: <code>lti\_guid</code>, <code>registration\_settings</code>, <code>services</code>, <code>course\_count</code>, <code>sub\_account\_count</code>, <code>site\_admin</code></p> |

Returns a list of [Account](/services/canvas/resources/accounts_-lti#account) objects.

## [Get accounts that admins can manage](#method.accounts.manageable_accounts) <a href="#method.accounts.manageable_accounts" id="method.accounts.manageable_accounts"></a>

[AccountsController#manageable\_accounts](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/manageable_accounts`

**Scope:** `url:GET|/api/v1/manageable_accounts`

A paginated list of accounts where the current user has permission to create or manage courses. List will be empty for students and teachers as only admins can view which accounts they are in.

Returns a list of [Account](/services/canvas/resources/accounts_-lti#account) objects.

## [Get accounts that users can create courses in](#method.accounts.course_creation_accounts) <a href="#method.accounts.course_creation_accounts" id="method.accounts.course_creation_accounts"></a>

[AccountsController#course\_creation\_accounts](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/course_creation_accounts`

**Scope:** `url:GET|/api/v1/course_creation_accounts`

A paginated list of accounts where the current user has permission to create courses.

Returns a list of [Account](/services/canvas/resources/accounts_-lti#account) objects.

## [List accounts for course admins](#method.accounts.course_accounts) <a href="#method.accounts.course_accounts" id="method.accounts.course_accounts"></a>

[AccountsController#course\_accounts](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/course_accounts`

**Scope:** `url:GET|/api/v1/course_accounts`

A paginated list of accounts that the current user can view through their admin course enrollments. (Teacher, TA, or designer enrollments). Only returns "id", "name", "workflow\_state", "root\_account\_id" and "parent\_account\_id"

Returns a list of [Account](/services/canvas/resources/accounts_-lti#account) objects.

## [Get a single account](#method.accounts.show) <a href="#method.accounts.show" id="method.accounts.show"></a>

[AccountsController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/accounts/:id`

**Scope:** `url:GET|/api/v1/accounts/:id`

Retrieve information on an individual account, given by id or sis sis\_account\_id.

Returns an [Account](/services/canvas/resources/accounts_-lti#account) object.

## [Settings](#method.accounts.show_settings) <a href="#method.accounts.show_settings" id="method.accounts.show_settings"></a>

[AccountsController#show\_settings](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/accounts/:account_id/settings`

**Scope:** `url:GET|/api/v1/accounts/:account_id/settings`

Returns a JSON object containing a subset of settings for the specified account. It's possible an empty set will be returned if no settings are applicable. The caller must be an Account admin with the manage\_account\_settings permission.

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/<account_id>/settings \
  -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{"microsoft_sync_enabled": true, "microsoft_sync_login_attribute_suffix": false}
```

## [List environment settings](#method.accounts.environment) <a href="#method.accounts.environment" id="method.accounts.environment"></a>

[AccountsController#environment](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/settings/environment`

**Scope:** `url:GET|/api/v1/settings/environment`

Return a hash of global settings for the root account This is the same information supplied to the web interface as +ENV.SETTINGS+.

#### Example Request:

```bash
curl 'http://<canvas>/api/v1/settings/environment' \
  -H "Authorization: Bearer <token>"
```

#### Example Response:

```js
{ "calendar_contexts_limit": 10, "open_registration": false, ...}
```

## [Permissions](#method.accounts.permissions) <a href="#method.accounts.permissions" id="method.accounts.permissions"></a>

[AccountsController#permissions](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/accounts/:account_id/permissions`

**Scope:** `url:GET|/api/v1/accounts/:account_id/permissions`

Returns permission information for the calling user and the given account. You may use `self` as the account id to check permissions against the domain root account. The caller must have an account role or admin (teacher/TA/designer) enrollment in a course in the account.

See also the [Course](https://developerdocs.instructure.com/services/canvas/resources/pages/Dq3HF46TIgKustPuq4C9#method.courses.permissions) and [Group](https://developerdocs.instructure.com/services/canvas/resources/pages/2YyNPW0XHYoLadMGQAZY#method.groups.permissions) counterparts.

#### Request Parameters:

| Parameter       | Type     | Description                                                                                                                                                                                                                                |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `permissions[]` | `string` | <p>List of permissions to check against the authenticated user.<br>Permission names are documented in the <a href="/pages/f7Drit9p3HR5ij8XDF4s#method.role_overrides.manageable_permissions">List assignable permissions</a> endpoint.</p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/self/permissions \
  -H 'Authorization: Bearer <token>' \
  -d 'permissions[]=manage_account_memberships' \
  -d 'permissions[]=become_user'
```

#### Example Response:

```js
{'manage_account_memberships': 'false', 'become_user': 'true'}
```

## [Get the sub-accounts of an account](#method.accounts.sub_accounts) <a href="#method.accounts.sub_accounts" id="method.accounts.sub_accounts"></a>

[AccountsController#sub\_accounts](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/accounts/:account_id/sub_accounts`

**Scope:** `url:GET|/api/v1/accounts/:account_id/sub_accounts`

List accounts that are sub-accounts of the given account.

#### Request Parameters:

| Parameter   | Type      | Description                                                                                                                                                                                                                                                                                              |
| ----------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `recursive` | `boolean` | <p>If true, the entire account tree underneath<br>this account will be returned (though still paginated). If false, only<br>direct sub-accounts of this account will be returned. Defaults to false.</p>                                                                                                 |
| `order`     | `string`  | <p>Sorts the accounts by id or name.<br>Only applies when recursive is false. Defaults to id. Allowed values: <code>id</code>, <code>name</code></p>                                                                                                                                                     |
| `include[]` | `string`  | <p>Array of additional information to include.<br>"course\_count":: returns the number of courses directly under each account<br>"sub\_account\_count":: returns the number of sub-accounts directly under each account Allowed values: <code>course\_count</code>, <code>sub\_account\_count</code></p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/<account_id>/sub_accounts \
     -H 'Authorization: Bearer <token>'
```

Returns a list of [Account](/services/canvas/resources/accounts_-lti#account) objects.

## [Get the Terms of Service](#method.accounts.terms_of_service) <a href="#method.accounts.terms_of_service" id="method.accounts.terms_of_service"></a>

[AccountsController#terms\_of\_service](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/accounts/:account_id/terms_of_service`

**Scope:** `url:GET|/api/v1/accounts/:account_id/terms_of_service`

Returns the terms of service for that account

Returns a [TermsOfService](#termsofservice) object.

## [Get help links](#method.accounts.help_links) <a href="#method.accounts.help_links" id="method.accounts.help_links"></a>

[AccountsController#help\_links](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/accounts/:account_id/help_links`

**Scope:** `url:GET|/api/v1/accounts/:account_id/help_links`

Returns the help links for that account

Returns a [HelpLinks](#helplinks) object.

## [Get the manually-created courses sub-account for the domain root account](#method.accounts.manually_created_courses_account) <a href="#method.accounts.manually_created_courses_account" id="method.accounts.manually_created_courses_account"></a>

[AccountsController#manually\_created\_courses\_account](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/manually_created_courses_account`

**Scope:** `url:GET|/api/v1/manually_created_courses_account`

Returns the sub-account that contains manually created courses for the domain root account.

Returns an [Account](/services/canvas/resources/accounts_-lti#account) object.

## [List active courses in an account](#method.accounts.courses_api) <a href="#method.accounts.courses_api" id="method.accounts.courses_api"></a>

[AccountsController#courses\_api](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `GET /api/v1/accounts/:account_id/courses`

**Scope:** `url:GET|/api/v1/accounts/:account_id/courses`

Retrieve a paginated list of courses in this account.

#### Request Parameters:

| Parameter                     | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ----------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `with_enrollments`            | `boolean` | <p>If true, include only courses with at least one enrollment. If false,<br>include only courses with no enrollments. If not present, do not filter<br>on course enrollment status.</p>                                                                                                                                                                                                                                                                                                                                       |
| `enrollment_type[]`           | `string`  | <p>If set, only return courses that have at least one user enrolled in<br>in the course with one of the specified enrollment types. Allowed values: <code>teacher</code>, <code>student</code>, <code>ta</code>, <code>observer</code>, <code>designer</code></p>                                                                                                                                                                                                                                                             |
| `enrollment_workflow_state[]` | `string`  | <p>If set, only return courses that have at least one user enrolled in<br>in the course with one of the specified enrollment workflow states. Allowed values: <code>active</code>, <code>completed</code>, <code>deleted</code>, <code>invited</code>, <code>pending</code>, <code>creation\_pending</code>, <code>rejected</code>, <code>inactive</code></p>                                                                                                                                                                 |
| `published`                   | `boolean` | <p>If true, include only published courses. If false, exclude published<br>courses. If not present, do not filter on published status.</p>                                                                                                                                                                                                                                                                                                                                                                                    |
| `completed`                   | `boolean` | <p>If true, include only completed courses (these may be in state<br>'completed', or their enrollment term may have ended). If false, exclude<br>completed courses. If not present, do not filter on completed status.</p>                                                                                                                                                                                                                                                                                                    |
| `blueprint`                   | `boolean` | <p>If true, include only blueprint courses. If false, exclude them.<br>If not present, do not filter on this basis.</p>                                                                                                                                                                                                                                                                                                                                                                                                       |
| `blueprint_associated`        | `boolean` | <p>If true, include only courses that inherit content from a blueprint course.<br>If false, exclude them. If not present, do not filter on this basis.</p>                                                                                                                                                                                                                                                                                                                                                                    |
| `public`                      | `boolean` | <p>If true, include only public courses. If false, exclude them.<br>If not present, do not filter on this basis.</p>                                                                                                                                                                                                                                                                                                                                                                                                          |
| `by_teachers[]`               | `integer` | <p>List of User IDs of teachers; if supplied, include only courses taught by<br>one of the referenced users.</p>                                                                                                                                                                                                                                                                                                                                                                                                              |
| `by_subaccounts[]`            | `integer` | <p>List of Account IDs; if supplied, include only courses associated with one<br>of the referenced subaccounts.</p>                                                                                                                                                                                                                                                                                                                                                                                                           |
| `hide_enrollmentless_courses` | `boolean` | <p>If present, only return courses that have at least one enrollment.<br>Equivalent to 'with\_enrollments=true'; retained for compatibility.</p>                                                                                                                                                                                                                                                                                                                                                                              |
| `state[]`                     | `string`  | <p>If set, only return courses that are in the given state(s). By default,<br>all states but "deleted" are returned. Allowed values: <code>created</code>, <code>claimed</code>, <code>available</code>, <code>completed</code>, <code>deleted</code>, <code>all</code></p>                                                                                                                                                                                                                                                   |
| `enrollment_term_id[]`        | `integer` | <p>If set, only includes courses from the specified terms. Can be either a single ID or<br>an array of enrollment term IDs.</p>                                                                                                                                                                                                                                                                                                                                                                                               |
| `search_term`                 | `string`  | The partial course name, code, or full ID to match and return in the results list. Must be at least 3 characters.                                                                                                                                                                                                                                                                                                                                                                                                             |
| `include[]`                   | `string`  | <p>- All explanations can be seen in the <a href="/pages/Dq3HF46TIgKustPuq4C9#method.courses.index">Course API index documentation</a><br>- "sections", "needs\_grading\_count" and "total\_scores" are not valid options at the account level Allowed values: <code>syllabus\_body</code>, <code>term</code>, <code>course\_progress</code>, <code>storage\_quota\_used\_mb</code>, <code>total\_students</code>, <code>teachers</code>, <code>account\_name</code>, <code>concluded</code>, <code>post\_manually</code></p> |
| `sort`                        | `string`  | The column to sort results by. Allowed values: `course_status`, `course_name`, `sis_course_id`, `teacher`, `account_name`                                                                                                                                                                                                                                                                                                                                                                                                     |
| `order`                       | `string`  | The order to sort the given column by. Allowed values: `asc`, `desc`                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `search_by`                   | `string`  | <p>The filter to search by. "course" searches for course names, course codes,<br>and SIS IDs. "teacher" searches for teacher names Allowed values: <code>course</code>, <code>teacher</code></p>                                                                                                                                                                                                                                                                                                                              |
| `starts_before`               | `Date`    | <p>If set, only return courses that start before the value (inclusive)<br>or their enrollment term starts before the value (inclusive)<br>or both the course's start\_at and the enrollment term's start\_at are set to null.<br>The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.</p>                                                                                                                                                                                                           |
| `ends_after`                  | `Date`    | <p>If set, only return courses that end after the value (inclusive)<br>or their enrollment term ends after the value (inclusive)<br>or both the course's end\_at and the enrollment term's end\_at are set to null.<br>The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.</p>                                                                                                                                                                                                                     |
| `homeroom`                    | `boolean` | If set, only return homeroom courses.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

Returns a list of [Course](/services/canvas/resources/courses#course) objects.

## [Update an account](#method.accounts.update) <a href="#method.accounts.update" id="method.accounts.update"></a>

[AccountsController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `PUT /api/v1/accounts/:id`

**Scope:** `url:PUT|/api/v1/accounts/:id`

Update an existing account.

#### Request Parameters:

| Parameter                                                    | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account[name]`                                              | `string`  | Updates the account name                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `account[sis_account_id]`                                    | `string`  | <p>Updates the account sis\_account\_id<br>Must have manage\_sis permission and must not be a root\_account.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `account[default_time_zone]`                                 | `string`  | <p>The default time zone of the account. Allowed time zones are<br><a href="http://www.iana.org/time-zones">IANA time zones</a> or friendlier<br><a href="http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html">Ruby on Rails time zones</a>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `account[default_storage_quota_mb]`                          | `integer` | The default course storage quota to be used, if not otherwise specified.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `account[default_user_storage_quota_mb]`                     | `integer` | The default user storage quota to be used, if not otherwise specified.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `account[default_group_storage_quota_mb]`                    | `integer` | The default group storage quota to be used, if not otherwise specified.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `account[course_template_id]`                                | `integer` | <p>The ID of a course to be used as a template for all newly created courses.<br>Empty means to inherit the setting from parent account, 0 means to not<br>use a template even if a parent account has one set. The course must be<br>marked as a template.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `account[parent_account_id]`                                 | `integer` | <p>The ID of a parent account to move the account to. The new parent account<br>must be in the same root account as the original. The hierarchy of<br>sub-accounts will be preserved in the new parent account. The caller must<br>be an administrator in both the original parent account and the new parent<br>account.</p>                                                                                                                                                                                                                                                                                                                                                                             |
| `account[settings][restrict_student_past_view][value]`       | `boolean` | Restrict students from viewing courses after end date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `account[settings][restrict_student_past_view][locked]`      | `boolean` | Lock this setting for sub-accounts and courses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `account[settings][restrict_student_future_view][value]`     | `boolean` | Restrict students from viewing courses before start date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `account[settings][microsoft_sync_enabled]`                  | `boolean` | <p>Determines whether this account has Microsoft Teams Sync enabled or not.<br>Note that if you are altering Microsoft Teams sync settings you must enable<br>the Microsoft Group enrollment syncing feature flag. In addition, if you are enabling<br>Microsoft Teams sync, you must also specify a tenant, login attribute, and a remote attribute.<br>Specifying a suffix to use is optional.</p>                                                                                                                                                                                                                                                                                                      |
| `account[settings][microsoft_sync_tenant]`                   | `string`  | <p>The tenant this account should use when using Microsoft Teams Sync.<br>This should be an Azure Active Directory domain name.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `account[settings][microsoft_sync_login_attribute]`          | `string`  | <p>The attribute this account should use to lookup users when using Microsoft Teams Sync.<br>Must be one of "sub", "email", "oid", "preferred\_username", or "integration\_id".</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `account[settings][microsoft_sync_login_attribute_suffix]`   | `string`  | <p>A suffix that will be appended to the result of the login attribute when associating<br>Canvas users with Microsoft users. Must be under 255 characters and contain no whitespace.<br>This field is optional.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `account[settings][microsoft_sync_remote_attribute]`         | `string`  | <p>The Active Directory attribute to use when associating Canvas users with Microsoft users.<br>Must be one of "mail", "mailNickname", or "userPrincipalName".</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `account[settings][restrict_student_future_view][locked]`    | `boolean` | Lock this setting for sub-accounts and courses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `account[settings][lock_all_announcements][value]`           | `boolean` | Disable comments on announcements                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `account[settings][lock_all_announcements][locked]`          | `boolean` | Lock this setting for sub-accounts and courses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `account[settings][usage_rights_required][value]`            | `boolean` | Copyright and license information must be provided for files before they are published.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `account[settings][usage_rights_required][locked]`           | `boolean` | Lock this setting for sub-accounts and courses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `account[settings][restrict_student_future_listing][value]`  | `boolean` | Restrict students from viewing future enrollments in course list                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `account[settings][restrict_student_future_listing][locked]` | `boolean` | Lock this setting for sub-accounts and courses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `account[settings][conditional_release][value]`              | `boolean` | Enable or disable individual learning paths for students based on assessment                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `account[settings][conditional_release][locked]`             | `boolean` | Lock this setting for sub-accounts and courses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `account[settings][enable_course_paces][value]`              | `boolean` | Enable or disable course pacing                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `account[settings][enable_course_paces][locked]`             | `boolean` | Lock this setting for sub-accounts and courses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `account[settings][suppress_notifications]`                  | `boolean` | <p>Suppress notification messages from being created and sent. When set to<br>+true+, all notifications are suppressed. When set to an array of<br>notification category slugs (e.g. +\["grading", "announcement"]+), only<br>notifications in those categories are suppressed. Set to +false+ to<br>allow all notifications. Root account setting only.</p>                                                                                                                                                                                                                                                                                                                                              |
| `account[settings][password_policy]`                         | `Hash`    | <p>Hash of optional password policy configuration parameters for a root account<br>+allow\_login\_suspension+ boolean:: Allow suspension of user logins upon reaching maximum\_login\_attempts<br>+require\_number\_characters+ boolean:: Require the use of number characters when setting up a new password<br>+require\_symbol\_characters+ boolean:: Require the use of symbol characters when setting up a new password<br>+minimum\_character\_length+ integer:: Minimum number of characters required for a new password<br>+maximum\_login\_attempts+ integer:: Maximum number of login attempts before a user is locked out<br><em>Required</em> feature option:<br>Enhance password options</p> |
| `account[settings][enable_as_k5_account][value]`             | `boolean` | Enable or disable Canvas for Elementary for this account                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `account[settings][use_classic_font_in_k5][value]`           | `boolean` | Whether or not the classic font is used on the dashboard. Only applies if enable\_as\_k5\_account is true.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `account[settings][horizon_account][value]`                  | `boolean` | Enable or disable Canvas Career for this account                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `override_sis_stickiness`                                    | `boolean` | <p>Default is true. If false, any fields containing “sticky” changes will not be updated.<br>See SIS CSV Format documentation for information on which fields can have SIS stickiness</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `account[settings][lock_outcome_proficiency][value]`         | `boolean` | \[DEPRECATED] Restrict instructors from changing mastery scale                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `account[lock_outcome_proficiency][locked]`                  | `boolean` | \[DEPRECATED] Lock this setting for sub-accounts and courses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `account[settings][lock_proficiency_calculation][value]`     | `boolean` | \[DEPRECATED] Restrict instructors from changing proficiency calculation method                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `account[lock_proficiency_calculation][locked]`              | `boolean` | \[DEPRECATED] Lock this setting for sub-accounts and courses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `account[services]`                                          | `Hash`    | Give this a set of keys and boolean values to enable or disable services matching the keys                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/<account_id> \
  -X PUT \
  -H 'Authorization: Bearer <token>' \
  -d 'account[name]=New account name' \
  -d 'account[default_time_zone]=Mountain Time (US & Canada)' \
  -d 'account[default_storage_quota_mb]=450'
```

Returns an [Account](/services/canvas/resources/accounts_-lti#account) object.

## [Delete a user from the root account](#method.accounts.remove_user) <a href="#method.accounts.remove_user" id="method.accounts.remove_user"></a>

[AccountsController#remove\_user](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `DELETE /api/v1/accounts/:account_id/users/:user_id`

**Scope:** `url:DELETE|/api/v1/accounts/:account_id/users/:user_id`

Delete a user record from a Canvas root account. If a user is associated with multiple root accounts (in a multi-tenant instance of Canvas), this action will NOT remove them from the other accounts.

WARNING: This API will allow a user to remove themselves from the account. If they do this, they won't be able to make API calls or log into Canvas at that account.

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/3/users/5 \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -X DELETE
```

Returns an [User](/services/canvas/resources/users#user) object.

## [Delete multiple users from the root account](#method.accounts.remove_users) <a href="#method.accounts.remove_users" id="method.accounts.remove_users"></a>

[AccountsController#remove\_users](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `DELETE /api/v1/accounts/:account_id/users`

**Scope:** `url:DELETE|/api/v1/accounts/:account_id/users`

Delete multiple users from a Canvas root account. If a user is associated with multiple root accounts (in a multi-tenant instance of Canvas), this action will NOT remove them from the other accounts.

WARNING: This API will allow a user to remove themselves from the account. If they do this, they won't be able to make API calls or log into Canvas at that account.

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/3/users \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -X DELETE
  -d 'user_ids[]=1' \
  -d 'user_ids[]=2'
```

Returns a [Progress](/services/canvas/resources/progress#progress) object.

## [Update multiple users](#method.accounts.update_users) <a href="#method.accounts.update_users" id="method.accounts.update_users"></a>

[AccountsController#update\_users](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `PUT /api/v1/accounts/:account_id/users/bulk_update`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/users/bulk_update`

Updates multiple users in bulk.

#### Request Parameters:

| Parameter  | Type     | Description                                                  |
| ---------- | -------- | ------------------------------------------------------------ |
| `user_ids` | `string` | <p>\[Array\<Integer>]<br>The IDs of the users to update.</p> |
| `user`     | `Hash`   | The attributes to update for each user.                      |

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/3/users/bulk_update \
  -X PUT \
  -H 'Authorization: Bearer <token>' \
  -d 'user_ids[]=1' \
  -d 'user_ids[]=2' \
  -d 'user[event]=suspend'
```

Returns a [Progress](/services/canvas/resources/progress#progress) object.

## [Restore a deleted user from a root account](#method.accounts.restore_user) <a href="#method.accounts.restore_user" id="method.accounts.restore_user"></a>

[AccountsController#restore\_user](https://github.com/instructure/canvas-lms/blob/master/app/controllers/accounts_controller.rb)

#### `PUT /api/v1/accounts/:account_id/users/:user_id/restore`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/users/:user_id/restore`

Restore a user record along with the most recently deleted pseudonym from a Canvas root account.

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/3/users/5/restore \
  -H 'Authorization: Bearer <ACCESS_TOKEN>' \
  -X PUT
```

Returns an [User](/services/canvas/resources/users#user) object.

## [Create a new sub-account](#method.sub_accounts.create) <a href="#method.sub_accounts.create" id="method.sub_accounts.create"></a>

[SubAccountsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/sub_accounts_controller.rb)

#### `POST /api/v1/accounts/:account_id/sub_accounts`

**Scope:** `url:POST|/api/v1/accounts/:account_id/sub_accounts`

Add a new sub-account to a given account.

#### Request Parameters:

| Parameter                                 | Type              | Description                                                              |
| ----------------------------------------- | ----------------- | ------------------------------------------------------------------------ |
| `account[name]`                           | Required `string` | The name of the new sub-account.                                         |
| `account[sis_account_id]`                 | `string`          | The account's identifier in the Student Information System.              |
| `account[default_storage_quota_mb]`       | `integer`         | The default course storage quota to be used, if not otherwise specified. |
| `account[default_user_storage_quota_mb]`  | `integer`         | The default user storage quota to be used, if not otherwise specified.   |
| `account[default_group_storage_quota_mb]` | `integer`         | The default group storage quota to be used, if not otherwise specified.  |

Returns an [Account](/services/canvas/resources/accounts_-lti#account) object.

## [Delete a sub-account](#method.sub_accounts.destroy) <a href="#method.sub_accounts.destroy" id="method.sub_accounts.destroy"></a>

[SubAccountsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/sub_accounts_controller.rb)

#### `DELETE /api/v1/accounts/:account_id/sub_accounts/:id`

**Scope:** `url:DELETE|/api/v1/accounts/:account_id/sub_accounts/:id`

Cannot delete an account with active courses or active sub\_accounts. Cannot delete a root\_account

Returns an [Account](/services/canvas/resources/accounts_-lti#account) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Accounts (LTI)

API for accessing account data using an LTI dev key. Allows a tool to get account information via LTI Advantage authorization scheme, which does not require a user session like normal developer keys do. Requires the account lookup scope on the LTI key.

#### An Account object looks like: <a href="#account" id="account"></a>

```js
{
  // the ID of the Account object
  "id": 2,
  // The display name of the account
  "name": "Canvas Account",
  // The UUID of the account
  "uuid": "WvAHhY5FINzq5IyRIJybGeiXyFkG3SqHUPb7jZY5",
  // The account's parent ID, or null if this is the root account
  "parent_account_id": 1,
  // The ID of the root account, or null if this is the root account
  "root_account_id": 1,
  // The state of the account. Can be 'active' or 'deleted'.
  "workflow_state": "active"
}
```

## [Get account](#method.lti/account_lookup.show) <a href="#method.lti-account_lookup.show" id="method.lti-account_lookup.show"></a>

[Lti::AccountLookupController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/lti/account_lookup_controller.rb)

#### `GET /api/lti/accounts/:account_id`

**Scope:** `url:GET|/api/lti/accounts/:account_id`

Retrieve information on an individual account, given by local or global ID.

Returns an [Account](#account) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Admins

Manage account role assignments

#### An Admin object looks like: <a href="#admin" id="admin"></a>

```js
{
  // The unique identifier for the account role/user assignment.
  "id": 1023,
  // The account role assigned. This can be 'AccountAdmin' or a user-defined role
  // created by the Roles API.
  "role": "AccountAdmin",
  // The user the role is assigned to. See the Users API for details.
  "user": null,
  // The status of the account role/user assignment.
  "workflow_state": "deleted"
}
```

## [List account admins](#method.admins.index) <a href="#method.admins.index" id="method.admins.index"></a>

[AdminsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/admins_controller.rb)

#### `GET /api/v1/accounts/:account_id/admins`

**Scope:** `url:GET|/api/v1/accounts/:account_id/admins`

A paginated list of the admins in the account

#### Request Parameters:

| Parameter         | Type        | Description                                                                                                                 |
| ----------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------- |
| `user_id[]`       | `[Integer]` | Scope the results to those with user IDs equal to any of the IDs specified here.                                            |
| `search_term`     | `string`    | <p>The partial name or full ID of the admins to match and return in the<br>results list. Must be at least 2 characters.</p> |
| `include_deleted` | `boolean`   | When set to true, returns admins who have been deleted                                                                      |

Returns a list of [Admin](#admin) objects.

## [Make an account admin](#method.admins.create) <a href="#method.admins.create" id="method.admins.create"></a>

[AdminsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/admins_controller.rb)

#### `POST /api/v1/accounts/:account_id/admins`

**Scope:** `url:POST|/api/v1/accounts/:account_id/admins`

Flag an existing user as an admin within the account.

#### Request Parameters:

| Parameter           | Type               | Description                                                                                                                             |
| ------------------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| `user_id`           | Required `integer` | The id of the user to promote.                                                                                                          |
| `role`              | `string`           | <p>\[DEPRECATED] The user's admin relationship with the account will be<br>created with the given role. Defaults to 'AccountAdmin'.</p> |
| `role_id`           | `integer`          | The user's admin relationship with the account will be created with the given role. Defaults to the built-in role for 'AccountAdmin'.   |
| `send_confirmation` | `boolean`          | <p>Send a notification email to<br>the new admin if true. Default is true.</p>                                                          |

Returns an [Admin](#admin) object.

## [Remove account admin](#method.admins.destroy) <a href="#method.admins.destroy" id="method.admins.destroy"></a>

[AdminsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/admins_controller.rb)

#### `DELETE /api/v1/accounts/:account_id/admins/:user_id`

**Scope:** `url:DELETE|/api/v1/accounts/:account_id/admins/:user_id`

Remove the rights associated with an account admin role from a user.

#### Request Parameters:

| Parameter | Type               | Description                                                                     |
| --------- | ------------------ | ------------------------------------------------------------------------------- |
| `role`    | `string`           | \[DEPRECATED] Account role to remove from the user.                             |
| `role_id` | Required `integer` | The id of the role representing the user's admin relationship with the account. |

Returns an [Admin](#admin) object.

## [List my admin roles](#method.admins.self_roles) <a href="#method.admins.self_roles" id="method.admins.self_roles"></a>

[AdminsController#self\_roles](https://github.com/instructure/canvas-lms/blob/master/app/controllers/admins_controller.rb)

#### `GET /api/v1/accounts/:account_id/admins/self`

**Scope:** `url:GET|/api/v1/accounts/:account_id/admins/self`

A paginated list of the current user's roles in the account. The results are the same as those returned by the [List account admins](#method.admins.index) endpoint with +user\_id+ set to +self+, except the "Admins - Add / Remove" permission is not required.

Returns a list of [Admin](#admin) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# AI Conversations

API for managing conversations with AI Experiences.

## [Show conversation](#method.ai_conversations.show) <a href="#method.ai_conversations.show" id="method.ai_conversations.show"></a>

[AiConversationsController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_conversations_controller.rb)

#### `GET /api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id`

Get a specific conversation by ID (for teachers viewing student conversations)

## [Get active conversation](#method.ai_conversations.active_conversation) <a href="#method.ai_conversations.active_conversation" id="method.ai_conversations.active_conversation"></a>

[AiConversationsController#active\_conversation](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_conversations_controller.rb)

#### `GET /api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations`

**Scope:** `url:GET|/api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations`

Get the active conversation for the current user and AI experience

## [Create AI conversation](#method.ai_conversations.create) <a href="#method.ai_conversations.create" id="method.ai_conversations.create"></a>

[AiConversationsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_conversations_controller.rb)

#### `POST /api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations`

**Scope:** `url:POST|/api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations`

Initialize a new conversation with the AI experience

## [Post message to conversation](#method.ai_conversations.post_message) <a href="#method.ai_conversations.post_message" id="method.ai_conversations.post_message"></a>

[AiConversationsController#post\_message](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_conversations_controller.rb)

#### `POST /api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id/messages`

**Scope:** `url:POST|/api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id/messages`

Send a message to an existing conversation and get the AI response

#### Request Parameters:

| Parameter | Type              | Description                          |
| --------- | ----------------- | ------------------------------------ |
| `message` | Required `string` | The user's message to send to the AI |

## [Delete AI conversation](#method.ai_conversations.destroy) <a href="#method.ai_conversations.destroy" id="method.ai_conversations.destroy"></a>

[AiConversationsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_conversations_controller.rb)

#### `DELETE /api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id`

End the current conversation session

## [Get conversation evaluation](#method.ai_conversations.evaluation) <a href="#method.ai_conversations.evaluation" id="method.ai_conversations.evaluation"></a>

[AiConversationsController#evaluation](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_conversations_controller.rb)

#### `GET /api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id/evaluation`

**Scope:** `url:GET|/api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id/evaluation`

Fetch the latest stored evaluation for a conversation from the llm-conversation service. Reads only — does not run the LLM and is not rate-limited. `evaluation` is null when none has been generated yet (llma returns 200 + null, never 404, so this is distinguishable from an outage). `stale` is true when the AI experience was edited after the stored evaluation was generated.

## [Generate conversation evaluation](#method.ai_conversations.create_evaluation) <a href="#method.ai_conversations.create_evaluation" id="method.ai_conversations.create_evaluation"></a>

[AiConversationsController#create\_evaluation](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_conversations_controller.rb)

#### `POST /api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id/evaluation`

**Scope:** `url:POST|/api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id/evaluation`

Run the LLM to (re)generate an evaluation for a conversation and persist it in the llm-conversation service. Rate-limited. Also the Reset path — a fresh run replaces any prior stored evaluation.

## [Create feedback on a conversation message](#method.ai_conversations.create_feedback) <a href="#method.ai_conversations.create_feedback" id="method.ai_conversations.create_feedback"></a>

[AiConversationsController#create\_feedback](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_conversations_controller.rb)

#### `POST /api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id/messages/:message_id/feedback`

**Scope:** `url:POST|/api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id/messages/:message_id/feedback`

Submit a like or dislike vote on an AI-generated message.

Ownership: load\_conversation gates this action — only the conversation owner or a course manager reaches here. Sub-resource (message\_id within the conversation) scoping is delegated to llma.

#### Request Parameters:

| Parameter          | Type              | Description                   |
| ------------------ | ----------------- | ----------------------------- |
| `vote`             | Required `string` | "liked" or "disliked"         |
| `message_id`       | Required `string` | llm-conversation message UUID |
| `feedback_message` | `string`          | optional text for dislike     |

## [Delete feedback on a conversation message](#method.ai_conversations.delete_feedback) <a href="#method.ai_conversations.delete_feedback" id="method.ai_conversations.delete_feedback"></a>

[AiConversationsController#delete\_feedback](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_conversations_controller.rb)

#### `DELETE /api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id/messages/:message_id/feedback/:feedback_id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/ai_experiences/:ai_experience_id/conversations/:id/messages/:message_id/feedback/:feedback_id`

Remove a previously submitted vote (toggling off like/dislike).

Ownership: load\_conversation gates this action — only the conversation owner or a course manager reaches here. Sub-resource (message\_id, feedback\_id within the conversation) scoping is delegated to llma.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# AI Experiences

API for creating, accessing and updating AI Experiences. AI Experiences are used to create interactive AI-powered learning scenarios within courses.

#### An AiExperience object looks like: <a href="#aiexperience" id="aiexperience"></a>

```js
// An AI Experience for interactive learning
{
  // The ID of the AI experience
  "id": 234,
  // The title for the AI experience
  "title": "Customer Service Simulation",
  // The description of the AI experience
  "description": "Practice customer service skills in a simulated environment",
  // The AI facts for the experience (optional)
  "facts": "You are a customer service representative...",
  // The learning objectives for this experience
  "learning_objective": "Students will practice active listening and problem-solving",
  // The pedagogical guidance for the experience
  "pedagogical_guidance": "A customer is calling about a billing issue",
  // The current published state of the AI experience
  "workflow_state": "published",
  // The course this experience belongs to
  "course_id": 1578941
}
```

## [List AI experiences](#method.ai_experiences.index) <a href="#method.ai_experiences.index" id="method.ai_experiences.index"></a>

[AiExperiencesController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_experiences_controller.rb)

#### `GET /api/v1/courses/:course_id/ai_experiences`

**Scope:** `url:GET|/api/v1/courses/:course_id/ai_experiences`

Retrieve the paginated list of AI experiences for a course

#### Request Parameters:

| Parameter        | Type     | Description                                                                                                          |
| ---------------- | -------- | -------------------------------------------------------------------------------------------------------------------- |
| `workflow_state` | `string` | <p>Only return experiences with the specified workflow state.<br>Allowed values: published, unpublished, deleted</p> |

Returns a list of [AiExperience](#aiexperience) objects.

## [Show an AI experience](#method.ai_experiences.show) <a href="#method.ai_experiences.show" id="method.ai_experiences.show"></a>

[AiExperiencesController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_experiences_controller.rb)

#### `GET /api/v1/courses/:course_id/ai_experiences/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/ai_experiences/:id`

Retrieve an AI experience by ID

Returns an [AiExperience](#aiexperience) object.

## [Show new AI experience form](#method.ai_experiences.new) <a href="#method.ai_experiences.new" id="method.ai_experiences.new"></a>

[AiExperiencesController#new](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_experiences_controller.rb)

#### `GET /api/v1/courses/:course_id/ai_experiences/new`

**Scope:** `url:GET|/api/v1/courses/:course_id/ai_experiences/new`

Display the form for creating a new AI experience

## [Show edit AI experience form](#method.ai_experiences.edit) <a href="#method.ai_experiences.edit" id="method.ai_experiences.edit"></a>

[AiExperiencesController#edit](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_experiences_controller.rb)

#### `GET /api/v1/courses/:course_id/ai_experiences/:id/edit`

**Scope:** `url:GET|/api/v1/courses/:course_id/ai_experiences/:id/edit`

Display the form for editing an existing AI experience

## [Create an AI experience](#method.ai_experiences.create) <a href="#method.ai_experiences.create" id="method.ai_experiences.create"></a>

[AiExperiencesController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_experiences_controller.rb)

#### `POST /api/v1/courses/:course_id/ai_experiences`

**Scope:** `url:POST|/api/v1/courses/:course_id/ai_experiences`

Create a new AI experience for the specified course

#### Request Parameters:

| Parameter              | Type              | Description                                                                                                      |
| ---------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------- |
| `title`                | Required `string` | The title of the AI experience.                                                                                  |
| `description`          | `string`          | The description of the AI experience.                                                                            |
| `facts`                | `string`          | The AI facts for the experience.                                                                                 |
| `learning_objective`   | Required `string` | The learning objectives for this experience.                                                                     |
| `pedagogical_guidance` | Required `string` | The pedagogical guidance for the experience.                                                                     |
| `workflow_state`       | `string`          | <p>The initial state of the experience. Defaults to 'unpublished'.<br>Allowed values: published, unpublished</p> |

Returns an [AiExperience](#aiexperience) object.

## [Update an AI experience](#method.ai_experiences.update) <a href="#method.ai_experiences.update" id="method.ai_experiences.update"></a>

[AiExperiencesController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_experiences_controller.rb)

#### `PUT /api/v1/courses/:course_id/ai_experiences/:id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/ai_experiences/:id`

Update an existing AI experience

#### Request Parameters:

| Parameter              | Type              | Description                                                                   |
| ---------------------- | ----------------- | ----------------------------------------------------------------------------- |
| `title`                | `string`          | The title of the AI experience.                                               |
| `description`          | `string`          | The description of the AI experience.                                         |
| `facts`                | `string`          | The AI facts for the experience.                                              |
| `learning_objective`   | Required `string` | The learning objectives for this experience.                                  |
| `pedagogical_guidance` | Required `string` | The pedagogical guidance for the experience.                                  |
| `workflow_state`       | `string`          | <p>The state of the experience.<br>Allowed values: published, unpublished</p> |

Returns an [AiExperience](#aiexperience) object.

## [Delete an AI experience](#method.ai_experiences.destroy) <a href="#method.ai_experiences.destroy" id="method.ai_experiences.destroy"></a>

[AiExperiencesController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_experiences_controller.rb)

#### `DELETE /api/v1/courses/:course_id/ai_experiences/:id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/ai_experiences/:id`

Delete an AI experience (soft delete - marks as deleted)

Returns an [AiExperience](#aiexperience) object.

## [List student AI conversations](#method.ai_experiences.ai_conversations_index) <a href="#method.ai_experiences.ai_conversations_index" id="method.ai_experiences.ai_conversations_index"></a>

[AiExperiencesController#ai\_conversations\_index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_experiences_controller.rb)

#### `GET /api/v1/courses/:course_id/ai_experiences/:id/ai_conversations`

**Scope:** `url:GET|/api/v1/courses/:course_id/ai_experiences/:id/ai_conversations`

Retrieve the latest AI conversation for each student in the course for this AI experience. Only available to teachers and course managers.

## [Show student AI conversation](#method.ai_experiences.ai_conversation_show) <a href="#method.ai_experiences.ai_conversation_show" id="method.ai_experiences.ai_conversation_show"></a>

[AiExperiencesController#ai\_conversation\_show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/ai_experiences_controller.rb)

#### `GET /api/v1/courses/:course_id/ai_experiences/:id/ai_conversations/:conversation_id`

**Scope:** `url:GET|/api/v1/courses/:course_id/ai_experiences/:id/ai_conversations/:conversation_id`

Retrieve a specific student's AI conversation with full message history. Only available to teachers and course managers.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Analytics

API for retrieving the data exposed in Canvas Analytics

## [Get department-level participation data](#method.analytics_api.department_participation) <a href="#method.analytics_api.department_participation" id="method.analytics_api.department_participation"></a>

#### `GET /api/v1/accounts/:account_id/analytics/terms/:term_id/activity`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/terms/:term_id/activity`

#### `GET /api/v1/accounts/:account_id/analytics/current/activity`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/current/activity`

#### `GET /api/v1/accounts/:account_id/analytics/completed/activity`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/completed/activity`

Returns page view hits summed across all courses in the department. Two groupings of these counts are returned; one by day (+by\_date+), the other by category (+by\_category+). The possible categories are announcements, assignments, collaborations, conferences, discussions, files, general, grades, groups, modules, other, pages, and quizzes.

This and the other department-level endpoints have three variations which all return the same style of data but for different subsets of courses. All share the prefix /api/v1/accounts/\<account\_id>/analytics. The possible suffixes are:

* /current: includes all available courses in the default term
* /completed: includes all concluded courses in the default term
* /terms/\<term\_id>: includes all available or concluded courses in the given term.

Courses not yet offered or which have been deleted are never included.

/current and /completed are intended for use when the account has only one term. /terms/\<term\_id> is intended for use when the account has multiple terms.

The action follows the suffix.

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/<account_id>/analytics/current/activity \
    -H 'Authorization: Bearer <token>'

curl https://<canvas>/api/v1/accounts/<account_id>/analytics/completed/activity \
    -H 'Authorization: Bearer <token>'

curl https://<canvas>/api/v1/accounts/<account_id>/analytics/terms/<term_id>/activity \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "by_date": {
    "2012-01-24": 1240,
    "2012-01-27": 912,
  },
  "by_category": {
    "announcements": 54,
    "assignments": 256,
    "collaborations": 18,
    "conferences": 26,
    "discussions": 354,
    "files": 132,
    "general": 59,
    "grades": 177,
    "groups": 132,
    "modules": 71,
    "other": 412,
    "pages": 105,
    "quizzes": 356
  },
}
```

## [Get department-level grade data](#method.analytics_api.department_grades) <a href="#method.analytics_api.department_grades" id="method.analytics_api.department_grades"></a>

#### `GET /api/v1/accounts/:account_id/analytics/terms/:term_id/grades`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/terms/:term_id/grades`

#### `GET /api/v1/accounts/:account_id/analytics/current/grades`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/current/grades`

#### `GET /api/v1/accounts/:account_id/analytics/completed/grades`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/completed/grades`

Returns the distribution of grades for students in courses in the department. Each data point is one student's current grade in one course; if a student is in multiple courses, he contributes one value per course, but if he's enrolled multiple times in the same course (e.g. a lecture section and a lab section), he only constributes on value for that course.

Grades are binned to the nearest integer score; anomalous grades outside the 0 to 100 range are ignored. The raw counts are returned, not yet normalized by the total count.

Shares the same variations on endpoint as the participation data.

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/<account_id>/analytics/current/grades \
    -H 'Authorization: Bearer <token>'

curl https://<canvas>/api/v1/accounts/<account_id>/analytics/completed/grades \
    -H 'Authorization: Bearer <token>'

curl https://<canvas>/api/v1/accounts/<account_id>/analytics/terms/<term_id>/grades \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "0": 95,
  "1": 1,
  "2": 0,
  "3": 0,
  ...
  "93": 125,
  "94": 110,
  "95": 142,
  "96": 157,
  "97": 116,
  "98": 85,
  "99": 63,
  "100": 190
}
```

## [Get department-level statistics](#method.analytics_api.department_statistics) <a href="#method.analytics_api.department_statistics" id="method.analytics_api.department_statistics"></a>

#### `GET /api/v1/accounts/:account_id/analytics/terms/:term_id/statistics`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/terms/:term_id/statistics`

#### `GET /api/v1/accounts/:account_id/analytics/current/statistics`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/current/statistics`

#### `GET /api/v1/accounts/:account_id/analytics/completed/statistics`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/completed/statistics`

Returns numeric statistics about the department and term (or filter).

Shares the same variations on endpoint as the participation data.

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/<account_id>/analytics/current/statistics \
    -H 'Authorization: Bearer <token>'

curl https://<canvas>/api/v1/accounts/<account_id>/analytics/completed/statistics \
    -H 'Authorization: Bearer <token>'

curl https://<canvas>/api/v1/accounts/<account_id>/analytics/terms/<term_id>/statistics \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "courses": 27,
  "subaccounts": 3,
  "teachers": 36,
  "students": 418,
  "discussion_topics": 77,
  "media_objects": 219,
  "attachments": 1268,
  "assignments": 290,
}
```

## [Get department-level statistics, broken down by subaccount](#method.analytics_api.department_statistics_by_subaccount) <a href="#method.analytics_api.department_statistics_by_subaccount" id="method.analytics_api.department_statistics_by_subaccount"></a>

#### `GET /api/v1/accounts/:account_id/analytics/terms/:term_id/statistics_by_subaccount`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/terms/:term_id/statistics_by_subaccount`

#### `GET /api/v1/accounts/:account_id/analytics/current/statistics_by_subaccount`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/current/statistics_by_subaccount`

#### `GET /api/v1/accounts/:account_id/analytics/completed/statistics_by_subaccount`

**Scope:** `url:GET|/api/v1/accounts/:account_id/analytics/completed/statistics_by_subaccount`

Returns numeric statistics about the department subaccounts and term (or filter).

Shares the same variations on endpoint as the participation data.

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/<account_id>/analytics/current/statistics_by_subaccount \
    -H 'Authorization: Bearer <token>'

curl https://<canvas>/api/v1/accounts/<account_id>/analytics/completed/statistics_by_subaccount \
    -H 'Authorization: Bearer <token>'

curl https://<canvas>/api/v1/accounts/<account_id>/analytics/terms/<term_id>/statistics_by_subaccount \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{"accounts": [
  {
    "name": "some string",
    "id": 188,
    "courses": 27,
    "teachers": 36,
    "students": 418,
    "discussion_topics": 77,
    "media_objects": 219,
    "attachments": 1268,
    "assignments": 290,
  }
]}
```

## [Get course-level participation data](#method.analytics_api.course_participation) <a href="#method.analytics_api.course_participation" id="method.analytics_api.course_participation"></a>

#### `GET /api/v1/courses/:course_id/analytics/activity`

**Scope:** `url:GET|/api/v1/courses/:course_id/analytics/activity`

Returns page view hits and participation numbers grouped by day through the entire history of the course. Page views is returned as a hash, where the hash keys are dates in the format "YYYY-MM-DD". The page\_views result set includes page views broken out by access category. Participations is returned as an array of dates in the format "YYYY-MM-DD".

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/analytics/activity \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
[
  {
    "date": "2012-01-24",
    "participations": 3,
    "views": 10
  }
]
```

## [Get course-level assignment data](#method.analytics_api.course_assignments) <a href="#method.analytics_api.course_assignments" id="method.analytics_api.course_assignments"></a>

#### `GET /api/v1/courses/:course_id/analytics/assignments`

**Scope:** `url:GET|/api/v1/courses/:course_id/analytics/assignments`

Returns a list of assignments for the course sorted by due date. For each assignment returns basic assignment information, the grade breakdown, and a breakdown of on-time/late status of homework submissions.

#### Request Parameters:

| Parameter | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| --------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `async`   | `boolean` | <p>If async is true, then the course\_assignments call can happen asynch-<br>ronously and MAY return a response containing a progress\_url key instead<br>of an assignments array. If it does, then it is the caller's<br>responsibility to poll the API again to see if the progress is complete.<br>If the data is ready (possibly even on the first async call) then it<br>will be passed back normally, as documented in the example response.</p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/analytics/assignments \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
[
  {
    "assignment_id": 1234,
    "title": "Assignment 1",
    "points_possible": 10,
    "due_at": "2012-01-25T22:00:00-07:00",
    "unlock_at": "2012-01-20T22:00:00-07:00",
    "muted": false,
    "min_score": 2,
    "max_score": 10,
    "median": 7,
    "first_quartile": 4,
    "third_quartile": 8,
    "tardiness_breakdown": {
      "on_time": 0.75,
      "missing": 0.1,
      "late": 0.15
    }
  },
  {
    "assignment_id": 1235,
    "title": "Assignment 2",
    "points_possible": 15,
    "due_at": "2012-01-26T22:00:00-07:00",
    "unlock_at": null,
    "muted": true,
    "min_score": 8,
    "max_score": 8,
    "median": 8,
    "first_quartile": 8,
    "third_quartile": 8,
    "tardiness_breakdown": {
      "on_time": 0.65,
      "missing": 0.12,
      "late": 0.23
      "total": 275
    }
  }
]
```

## [Get course-level student summary data](#method.analytics_api.course_student_summaries) <a href="#method.analytics_api.course_student_summaries" id="method.analytics_api.course_student_summaries"></a>

#### `GET /api/v1/courses/:course_id/analytics/student_summaries`

**Scope:** `url:GET|/api/v1/courses/:course_id/analytics/student_summaries`

Returns a summary of per-user access information for all students in a course. This includes total page views, total participations, and a breakdown of on-time/late status for all homework submissions in the course.

Each student's summary also includes the maximum number of page views and participations by any student in the course, which may be useful for some visualizations (since determining maximums client side can be tricky with pagination).

#### Request Parameters:

| Parameter     | Type     | Description                                                                                                                                                                                                                       |
| ------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sort_column` | `string` | The order results in which results are returned. Defaults to "name". Allowed values: `name`, `name_descending`, `score`, `score_descending`, `participations`, `participations_descending`, `page_views`, `page_views_descending` |
| `student_id`  | `string` | If set, returns only the specified student.                                                                                                                                                                                       |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/analytics/student_summaries \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
[
  {
    "id": 2346,
    "page_views": 351,
    "page_views_level": "1"
    "max_page_view": 415,
    "participations": 1,
    "participations_level": "3",
    "max_participations": 10,
    "tardiness_breakdown": {
      "total": 5,
      "on_time": 3,
      "late": 0,
      "missing": 2,
      "floating": 0
    }
  },
  {
    "id": 2345,
    "page_views": 124,
    "participations": 15,
    "tardiness_breakdown": {
      "total": 5,
      "on_time": 1,
      "late": 2,
      "missing": 3,
      "floating": 0
    }
  }
]
```

## [Get user-in-a-course-level participation data](#method.analytics_api.student_in_course_participation) <a href="#method.analytics_api.student_in_course_participation" id="method.analytics_api.student_in_course_participation"></a>

#### `GET /api/v1/courses/:course_id/analytics/users/:student_id/activity`

**Scope:** `url:GET|/api/v1/courses/:course_id/analytics/users/:student_id/activity`

Returns page view hits grouped by hour, and participation details through the entire history of the course.

`page_views` are returned as a hash, where the keys are iso8601 dates, bucketed by the hour. `participations` are returned as an array of hashes, sorted oldest to newest.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/analytics/users/<user_id>/activity \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "page_views": {
    "2012-01-24T13:00:00-00:00": 19,
    "2012-01-24T14:00:00-00:00": 13,
    "2012-01-27T09:00:00-00:00": 23
  },
  "participations": [
    {
      "created_at": "2012-01-21T22:00:00-06:00",
      "url": "https://canvas.example.com/path/to/canvas",
    },
    {
      "created_at": "2012-01-27T22:00:00-06:00",
      "url": "https://canvas.example.com/path/to/canvas",
    }
  ]
}
```

## [Get user-in-a-course-level assignment data](#method.analytics_api.student_in_course_assignments) <a href="#method.analytics_api.student_in_course_assignments" id="method.analytics_api.student_in_course_assignments"></a>

#### `GET /api/v1/courses/:course_id/analytics/users/:student_id/assignments`

**Scope:** `url:GET|/api/v1/courses/:course_id/analytics/users/:student_id/assignments`

Returns a list of assignments for the course sorted by due date. For each assignment returns basic assignment information, the grade breakdown (including the student's actual grade), and the basic submission information for the student's submission if it exists.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/analytics/users/<user_id>/assignments \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
[
  {
    "assignment_id": 1234,
    "title": "Assignment 1",
    "points_possible": 10,
    "due_at": "2012-01-25T22:00:00-07:00",
    "unlock_at": "2012-01-20T22:00:00-07:00",
    "muted": false,
    "min_score": 2,
    "max_score": 10,
    "median": 7,
    "first_quartile": 4,
    "third_quartile": 8,
    "module_ids": [
        1,
        2
    ],
    "submission": {
      "posted_at": "2012-01-23T20:00:00-07:00",
      "submitted_at": "2012-01-22T22:00:00-07:00",
      "score": 10
    }
  },
  {
    "assignment_id": 1235,
    "title": "Assignment 2",
    "points_possible": 15,
    "due_at": "2012-01-26T22:00:00-07:00",
    "unlock_at": null,
    "muted": true,
    "min_score": 8,
    "max_score": 8,
    "median": 8,
    "first_quartile": 8,
    "third_quartile": 8,
    "module_ids": [
        1
    ],
    "submission": {
      "posted_at": null,
      "submitted_at": "2012-01-22T22:00:00-07:00"
    }
  }
]
```

## [Get user-in-a-course-level messaging data](#method.analytics_api.student_in_course_messaging) <a href="#method.analytics_api.student_in_course_messaging" id="method.analytics_api.student_in_course_messaging"></a>

#### `GET /api/v1/courses/:course_id/analytics/users/:student_id/communication`

**Scope:** `url:GET|/api/v1/courses/:course_id/analytics/users/:student_id/communication`

Returns messaging "hits" grouped by day through the entire history of the course. Returns a hash containing the number of instructor-to-student messages, and student-to-instructor messages, where the hash keys are dates in the format "YYYY-MM-DD". Message hits include Conversation messages and comments on homework submissions.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/analytics/users/<user_id>/communication \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "2012-01-24":{
    "instructorMessages":1,
    "studentMessages":2
  },
  "2012-01-27":{
    "studentMessages":1
  }
}
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Announcement External Feeds

External feeds represent RSS feeds that can be attached to a Course or Group, in order to automatically create announcements for each new item in the feed.

#### An ExternalFeed object looks like: <a href="#externalfeed" id="externalfeed"></a>

```js
{
  // The ID of the feed
  "id": 5,
  // The title of the feed, pulled from the feed itself. If the feed hasn't yet
  // been pulled, a temporary name will be synthesized based on the URL
  "display_name": "My Blog",
  // The HTTP/HTTPS URL to the feed
  "url": "http://example.com/myblog.rss",
  // If not null, only feed entries whose title contains this string will trigger
  // new posts in Canvas
  "header_match": "pattern",
  // When this external feed was added to Canvas
  "created_at": "2012-06-01T00:00:00-06:00",
  // The verbosity setting determines how much of the feed's content is imported
  // into Canvas as part of the posting. 'link_only' means that only the title and
  // a link to the item. 'truncate' means that a summary of the first portion of
  // the item body will be used. 'full' means that the full item body will be
  // used.
  "verbosity": "truncate"
}
```

## [List external feeds](#method.external_feeds.index) <a href="#method.external_feeds.index" id="method.external_feeds.index"></a>

[ExternalFeedsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/external_feeds_controller.rb)

#### `GET /api/v1/courses/:course_id/external_feeds`

**Scope:** `url:GET|/api/v1/courses/:course_id/external_feeds`

#### `GET /api/v1/groups/:group_id/external_feeds`

**Scope:** `url:GET|/api/v1/groups/:group_id/external_feeds`

Returns the paginated list of External Feeds this course or group.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/external_feeds \
     -H 'Authorization: Bearer <token>'
```

Returns a list of [ExternalFeed](#externalfeed) objects.

## [Create an external feed](#method.external_feeds.create) <a href="#method.external_feeds.create" id="method.external_feeds.create"></a>

[ExternalFeedsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/external_feeds_controller.rb)

#### `POST /api/v1/courses/:course_id/external_feeds`

**Scope:** `url:POST|/api/v1/courses/:course_id/external_feeds`

#### `POST /api/v1/groups/:group_id/external_feeds`

**Scope:** `url:POST|/api/v1/groups/:group_id/external_feeds`

Create a new external feed for the course or group.

#### Request Parameters:

| Parameter      | Type              | Description                                                                          |
| -------------- | ----------------- | ------------------------------------------------------------------------------------ |
| `url`          | Required `string` | The url to the external rss or atom feed                                             |
| `header_match` | `boolean`         | If given, only feed entries that contain this string in their title will be imported |
| `verbosity`    | `string`          | Defaults to "full" Allowed values: `full`, `truncate`, `link_only`                   |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/external_feeds \
    -F url='http://example.com/rss.xml' \
    -F header_match='news flash!' \
    -F verbosity='full' \
    -H 'Authorization: Bearer <token>'
```

Returns an [ExternalFeed](#externalfeed) object.

## [Delete an external feed](#method.external_feeds.destroy) <a href="#method.external_feeds.destroy" id="method.external_feeds.destroy"></a>

[ExternalFeedsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/external_feeds_controller.rb)

#### `DELETE /api/v1/courses/:course_id/external_feeds/:external_feed_id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/external_feeds/:external_feed_id`

#### `DELETE /api/v1/groups/:group_id/external_feeds/:external_feed_id`

**Scope:** `url:DELETE|/api/v1/groups/:group_id/external_feeds/:external_feed_id`

Deletes the external feed.

#### Example Request:

```bash
curl -X DELETE https://<canvas>/api/v1/courses/<course_id>/external_feeds/<feed_id> \
     -H 'Authorization: Bearer <token>'
```

Returns an [ExternalFeed](#externalfeed) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Announcements

API for retrieving announcements. This API is Announcement-specific. See also the Discussion Topics API, which operates on Announcements also.

## [List announcements](#method.announcements_api.index) <a href="#method.announcements_api.index" id="method.announcements_api.index"></a>

[AnnouncementsApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/announcements_api_controller.rb)

#### `GET /api/v1/announcements`

**Scope:** `url:GET|/api/v1/announcements`

Returns the paginated list of announcements for the given courses and date range. Note that a +context\_code+ field is added to the responses so you can tell which course each announcement belongs to.

#### Request Parameters:

| Parameter         | Type              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ----------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `context_codes[]` | Required `string` | <p>List of context\_codes to retrieve announcements for (for example, +course\_123+). Only courses<br>are presently supported. The call will fail unless the caller has View Announcements permission<br>in all listed courses.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `start_date`      | `Date`            | <p>Only return announcements posted since the start\_date (inclusive).<br>Defaults to 14 days ago. The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `end_date`        | `Date`            | <p>Only return announcements posted before the end\_date (inclusive).<br>Defaults to 28 days from start\_date. The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.<br>Announcements scheduled for future posting will only be returned to course administrators.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `available_after` | `Date`            | <p>Only return announcements having locked\_at nil or after available\_after (exclusive).<br>The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.<br>Effective only for students (who don't have moderate forum right).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `active_only`     | `boolean`         | <p>Only return active announcements that have been published.<br>Applies only to requesting users that have permission to view<br>unpublished items.<br>Defaults to false for users with access to view unpublished items,<br>otherwise true and unmodifiable.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `latest_only`     | `boolean`         | <p>Only return the latest announcement for each associated context.<br>The response will include at most one announcement for each<br>specified context in the context\_codes\[] parameter.<br>Defaults to false.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `include`         | `array`           | <p>Optional list of resources to include with the response. May include<br>a string of the name of the resource. Possible values are:<br>"sections", "sections\_user\_count"<br>if "sections" is passed, includes the course sections that are associated<br>with the topic, if the topic is specific to certain sections of the course.<br>If "sections\_user\_count" is passed, then:<br>(a) If sections were asked for <em>and</em> the topic is specific to certain<br>course sections sections, includes the number of users in each<br>section. (as part of the section json asked for above)<br>(b) Else, includes at the root level the total number of users in the<br>topic's context (group or course) that the topic applies to.</p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/announcements?context_codes[]=course_1&context_codes[]=course_2 \
     -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
[{
  "id": 1,
  "title": "Hear ye",
  "message": "Henceforth, all assignments must be...",
  "posted_at": "2017-01-31T22:00:00Z",
  "delayed_post_at": null,
  "context_code": "course_2",
  ...
}]
```

Returns a list of [DiscussionTopic](/services/canvas/resources/discussion_topics#discussiontopic) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# API Token Scopes

{% hint style="warning" %}
BETA: This API resource is not finalized, and there could be breaking changes before its final release.
{% endhint %}

API for retrieving API scopes

#### A Scope object looks like: <a href="#scope" id="scope"></a>

```js
{
  // The resource the scope is associated with
  "resource": "courses",
  // The localized resource name
  "resource_name": "Courses",
  // The controller the scope is associated to
  "controller": "courses",
  // The controller action the scope is associated to
  "action": "index",
  // The HTTP verb for the scope
  "verb": "GET",
  // The identifier for the scope
  "scope": "url:GET|/api/v1/courses"
}
```

## [List scopes](#method.scopes_api.index) <a href="#method.scopes_api.index" id="method.scopes_api.index"></a>

[ScopesApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/scopes_api_controller.rb)

{% hint style="warning" %}
BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.
{% endhint %}

#### `GET /api/v1/accounts/:account_id/scopes`

**Scope:** `url:GET|/api/v1/accounts/:account_id/scopes`

A list of scopes that can be applied to developer keys and access tokens.

#### Request Parameters:

| Parameter  | Type     | Description                                                                                           |
| ---------- | -------- | ----------------------------------------------------------------------------------------------------- |
| `group_by` | `string` | The attribute to group the scopes by. By default no grouping is done. Allowed values: `resource_name` |

Returns a list of [Scope](#scope) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Appointment Groups

API for creating, accessing and updating appointment groups. Appointment groups provide a way of creating a bundle of time slots that users can sign up for (e.g. "Office Hours" or "Meet with professor about Final Project"). Both time slots and reservations of time slots are stored as Calendar Events.

#### An Appointment object looks like: <a href="#appointment" id="appointment"></a>

```js
// Date and time for an appointment
{
  // The appointment identifier.
  "id": 987,
  // Start time for the appointment
  "start_at": "2012-07-20T15:00:00-06:00",
  // End time for the appointment
  "end_at": "2012-07-20T15:00:00-06:00"
}
```

#### An AppointmentGroup object looks like: <a href="#appointmentgroup" id="appointmentgroup"></a>

```js
{
  // The ID of the appointment group
  "id": 543,
  // The title of the appointment group
  "title": "Final Presentation",
  // The start of the first time slot in the appointment group
  "start_at": "2012-07-20T15:00:00-06:00",
  // The end of the last time slot in the appointment group
  "end_at": "2012-07-20T17:00:00-06:00",
  // The text description of the appointment group
  "description": "Es muy importante",
  // The location name of the appointment group
  "location_name": "El Tigre Chino's office",
  // The address of the appointment group's location
  "location_address": "Room 234",
  // The number of participant who have reserved slots (see include[] argument)
  "participant_count": 2,
  // The start and end times of slots reserved by the current user as well as the
  // id of the calendar event for the reservation (see include[] argument)
  "reserved_times": [{"id":987,"start_at":"2012-07-20T15:00:00-06:00","end_at":"2012-07-20T15:00:00-06:00"}],
  // Boolean indicating whether observer users should be able to sign-up for an
  // appointment
  "allow_observer_signup": false,
  // The context codes (i.e. courses) this appointment group belongs to. Only
  // people in these courses will be eligible to sign up.
  "context_codes": ["course_123"],
  // The sub-context codes (i.e. course sections and group categories) this
  // appointment group is restricted to
  "sub_context_codes": [course_section_234],
  // Current state of the appointment group ('pending', 'active' or 'deleted').
  // 'pending' indicates that it has not been published yet and is invisible to
  // participants.
  "workflow_state": "active",
  // Boolean indicating whether the current user needs to sign up for this
  // appointment group (i.e. it's reservable and the
  // min_appointments_per_participant limit has not been met by this user).
  "requiring_action": true,
  // Number of time slots in this appointment group
  "appointments_count": 2,
  // Calendar Events representing the time slots (see include[] argument) Refer to
  // the Calendar Events API for more information
  "appointments": [],
  // Newly created time slots (same format as appointments above). Only returned
  // in Create/Update responses where new time slots have been added
  "new_appointments": [],
  // Maximum number of time slots a user may register for, or null if no limit
  "max_appointments_per_participant": 1,
  // Minimum number of time slots a user must register for. If not set, users do
  // not need to sign up for any time slots
  "min_appointments_per_participant": 1,
  // Maximum number of participants that may register for each time slot, or null
  // if no limit
  "participants_per_appointment": 1,
  // 'private' means participants cannot see who has signed up for a particular
  // time slot, 'protected' means that they can
  "participant_visibility": "private",
  // Indicates how participants sign up for the appointment group, either as
  // individuals ('User') or in student groups ('Group'). Related to
  // sub_context_codes (i.e. 'Group' signups always have a single group category)
  "participant_type": "User",
  // URL for this appointment group (to update, delete, etc.)
  "url": "https://example.com/api/v1/appointment_groups/543",
  // URL for a user to view this appointment group
  "html_url": "http://example.com/appointment_groups/1",
  // When the appointment group was created
  "created_at": "2012-07-13T10:55:20-06:00",
  // When the appointment group was last updated
  "updated_at": "2012-07-13T10:55:20-06:00"
}
```

## [List appointment groups](#method.appointment_groups.index) <a href="#method.appointment_groups.index" id="method.appointment_groups.index"></a>

[AppointmentGroupsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/appointment_groups_controller.rb)

#### `GET /api/v1/appointment_groups`

**Scope:** `url:GET|/api/v1/appointment_groups`

Retrieve the paginated list of appointment groups that can be reserved or managed by the current user.

#### Request Parameters:

| Parameter                   | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| --------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `scope`                     | `string`  | Defaults to "reservable" Allowed values: `reservable`, `manageable`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `context_codes[]`           | `string`  | Array of context codes used to limit returned results.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `include_past_appointments` | `boolean` | Defaults to false. If true, includes past appointment groups                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `include[]`                 | `string`  | <p>Array of additional information to include.<br>"appointments":: calendar event time slots for this appointment group<br>"child\_events":: reservations of those time slots<br>"participant\_count":: number of reservations<br>"reserved\_times":: the event id, start time and end time of reservations<br>the current user has made)<br>"all\_context\_codes":: all context codes associated with this appointment group Allowed values: <code>appointments</code>, <code>child\_events</code>, <code>participant\_count</code>, <code>reserved\_times</code>, <code>all\_context\_codes</code></p> |

## [Create an appointment group](#method.appointment_groups.create) <a href="#method.appointment_groups.create" id="method.appointment_groups.create"></a>

[AppointmentGroupsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/appointment_groups_controller.rb)

#### `POST /api/v1/appointment_groups`

**Scope:** `url:POST|/api/v1/appointment_groups`

Create and return a new appointment group. If new\_appointments are specified, the response will return a new\_appointments array (same format as appointments array, see "List appointment groups" action)

#### Request Parameters:

| Parameter                                             | Type              | Description                                                                                                                                                                                                                                                                                                        |
| ----------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `appointment_group[context_codes][]`                  | Required `string` | <p>Array of context codes (courses, e.g. course\_1) this group should be<br>linked to (1 or more). Users in the course(s) with appropriate permissions<br>will be able to sign up for this appointment group.</p>                                                                                                  |
| `appointment_group[sub_context_codes][]`              | `string`          | <p>Array of sub context codes (course sections or a single group category)<br>this group should be linked to. Used to limit the appointment group to<br>particular sections. If a group category is specified, students will sign<br>up in groups and the participant\_type will be "Group" instead of "User".</p> |
| `appointment_group[title]`                            | Required `string` | Short title for the appointment group.                                                                                                                                                                                                                                                                             |
| `appointment_group[description]`                      | `string`          | Longer text description of the appointment group.                                                                                                                                                                                                                                                                  |
| `appointment_group[location_name]`                    | `string`          | Location name of the appointment group.                                                                                                                                                                                                                                                                            |
| `appointment_group[location_address]`                 | `string`          | Location address.                                                                                                                                                                                                                                                                                                  |
| `appointment_group[publish]`                          | `boolean`         | <p>Indicates whether this appointment group should be published (i.e. made<br>available for signup). Once published, an appointment group cannot be<br>unpublished. Defaults to false.</p>                                                                                                                         |
| `appointment_group[participants_per_appointment]`     | `integer`         | <p>Maximum number of participants that may register for each time slot.<br>Defaults to null (no limit).</p>                                                                                                                                                                                                        |
| `appointment_group[min_appointments_per_participant]` | `integer`         | <p>Minimum number of time slots a user must register for. If not set, users<br>do not need to sign up for any time slots.</p>                                                                                                                                                                                      |
| `appointment_group[max_appointments_per_participant]` | `integer`         | Maximum number of time slots a user may register for.                                                                                                                                                                                                                                                              |
| `appointment_group[new_appointments][X][]`            | `string`          | <p>Nested array of start time/end time pairs indicating time slots for this<br>appointment group. Refer to the example request.</p>                                                                                                                                                                                |
| `appointment_group[participant_visibility]`           | `string`          | <p>"private":: participants cannot see who has signed up for a particular<br>time slot<br>"protected":: participants can see who has signed up. Defaults to<br>"private". Allowed values: <code>private</code>, <code>protected</code></p>                                                                         |
| `appointment_group[allow_observer_signup]`            | `boolean`         | Whether observer users can sign-up for an appointment. Defaults to false.                                                                                                                                                                                                                                          |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/appointment_groups.json' \
     -X POST \
     -F 'appointment_group[context_codes][]=course_123' \
     -F 'appointment_group[sub_context_codes][]=course_section_234' \
     -F 'appointment_group[title]=Final Presentation' \
     -F 'appointment_group[participants_per_appointment]=1' \
     -F 'appointment_group[min_appointments_per_participant]=1' \
     -F 'appointment_group[max_appointments_per_participant]=1' \
     -F 'appointment_group[new_appointments][0][]=2012-07-19T21:00:00Z' \
     -F 'appointment_group[new_appointments][0][]=2012-07-19T22:00:00Z' \
     -F 'appointment_group[new_appointments][1][]=2012-07-19T22:00:00Z' \
     -F 'appointment_group[new_appointments][1][]=2012-07-19T23:00:00Z' \
     -H "Authorization: Bearer <token>"
```

## [Get a single appointment group](#method.appointment_groups.show) <a href="#method.appointment_groups.show" id="method.appointment_groups.show"></a>

[AppointmentGroupsController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/appointment_groups_controller.rb)

#### `GET /api/v1/appointment_groups/:id`

**Scope:** `url:GET|/api/v1/appointment_groups/:id`

Returns information for a single appointment group

#### Request Parameters:

| Parameter   | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]` | `string` | <p>Array of additional information to include. See include\[] argument of<br>"List appointment groups" action.<br>"child\_events":: reservations of time slots time slots<br>"appointments":: will always be returned<br>"all\_context\_codes":: all context codes associated with this appointment group Allowed values: <code>child\_events</code>, <code>appointments</code>, <code>all\_context\_codes</code></p> |

## [Update an appointment group](#method.appointment_groups.update) <a href="#method.appointment_groups.update" id="method.appointment_groups.update"></a>

[AppointmentGroupsController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/appointment_groups_controller.rb)

#### `PUT /api/v1/appointment_groups/:id`

**Scope:** `url:PUT|/api/v1/appointment_groups/:id`

Update and return an appointment group. If new\_appointments are specified, the response will return a new\_appointments array (same format as appointments array, see "List appointment groups" action).

#### Request Parameters:

| Parameter                                             | Type              | Description                                                                                                                                                                                                                                                                                                        |
| ----------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `appointment_group[context_codes][]`                  | Required `string` | <p>Array of context codes (courses, e.g. course\_1) this group should be<br>linked to (1 or more). Users in the course(s) with appropriate permissions<br>will be able to sign up for this appointment group.</p>                                                                                                  |
| `appointment_group[sub_context_codes][]`              | `string`          | <p>Array of sub context codes (course sections or a single group category)<br>this group should be linked to. Used to limit the appointment group to<br>particular sections. If a group category is specified, students will sign<br>up in groups and the participant\_type will be "Group" instead of "User".</p> |
| `appointment_group[title]`                            | `string`          | Short title for the appointment group.                                                                                                                                                                                                                                                                             |
| `appointment_group[description]`                      | `string`          | Longer text description of the appointment group.                                                                                                                                                                                                                                                                  |
| `appointment_group[location_name]`                    | `string`          | Location name of the appointment group.                                                                                                                                                                                                                                                                            |
| `appointment_group[location_address]`                 | `string`          | Location address.                                                                                                                                                                                                                                                                                                  |
| `appointment_group[publish]`                          | `boolean`         | <p>Indicates whether this appointment group should be published (i.e. made<br>available for signup). Once published, an appointment group cannot be<br>unpublished. Defaults to false.</p>                                                                                                                         |
| `appointment_group[participants_per_appointment]`     | `integer`         | <p>Maximum number of participants that may register for each time slot.<br>Defaults to null (no limit).</p>                                                                                                                                                                                                        |
| `appointment_group[min_appointments_per_participant]` | `integer`         | <p>Minimum number of time slots a user must register for. If not set, users<br>do not need to sign up for any time slots.</p>                                                                                                                                                                                      |
| `appointment_group[max_appointments_per_participant]` | `integer`         | Maximum number of time slots a user may register for.                                                                                                                                                                                                                                                              |
| `appointment_group[new_appointments][X][]`            | `string`          | <p>Nested array of start time/end time pairs indicating time slots for this<br>appointment group. Refer to the example request.</p>                                                                                                                                                                                |
| `appointment_group[participant_visibility]`           | `string`          | <p>"private":: participants cannot see who has signed up for a particular<br>time slot<br>"protected":: participants can see who has signed up. Defaults to "private". Allowed values: <code>private</code>, <code>protected</code></p>                                                                            |
| `appointment_group[allow_observer_signup]`            | `boolean`         | Whether observer users can sign-up for an appointment.                                                                                                                                                                                                                                                             |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/appointment_groups/543.json' \
     -X PUT \
     -F 'appointment_group[publish]=1' \
     -H "Authorization: Bearer <token>"
```

## [Delete an appointment group](#method.appointment_groups.destroy) <a href="#method.appointment_groups.destroy" id="method.appointment_groups.destroy"></a>

[AppointmentGroupsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/appointment_groups_controller.rb)

#### `DELETE /api/v1/appointment_groups/:id`

**Scope:** `url:DELETE|/api/v1/appointment_groups/:id`

Delete an appointment group (and associated time slots and reservations) and return the deleted group

#### Request Parameters:

| Parameter       | Type     | Description                                          |
| --------------- | -------- | ---------------------------------------------------- |
| `cancel_reason` | `string` | Reason for deleting/canceling the appointment group. |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/appointment_groups/543.json' \
     -X DELETE \
     -F 'cancel_reason=El Tigre Chino got fired' \
     -H "Authorization: Bearer <token>"
```

## [List user participants](#method.appointment_groups.users) <a href="#method.appointment_groups.users" id="method.appointment_groups.users"></a>

[AppointmentGroupsController#users](https://github.com/instructure/canvas-lms/blob/master/app/controllers/appointment_groups_controller.rb)

#### `GET /api/v1/appointment_groups/:id/users`

**Scope:** `url:GET|/api/v1/appointment_groups/:id/users`

A paginated list of users that are (or may be) participating in this appointment group. Refer to the Users API for the response fields. Returns no results for appointment groups with the "Group" participant\_type.

#### Request Parameters:

| Parameter             | Type     | Description                                                                                                             |
| --------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| `registration_status` | `string` | Limits results to the a given participation status, defaults to "all" Allowed values: `all`, `registered`, `registered` |

## [List student group participants](#method.appointment_groups.groups) <a href="#method.appointment_groups.groups" id="method.appointment_groups.groups"></a>

[AppointmentGroupsController#groups](https://github.com/instructure/canvas-lms/blob/master/app/controllers/appointment_groups_controller.rb)

#### `GET /api/v1/appointment_groups/:id/groups`

**Scope:** `url:GET|/api/v1/appointment_groups/:id/groups`

A paginated list of student groups that are (or may be) participating in this appointment group. Refer to the Groups API for the response fields. Returns no results for appointment groups with the "User" participant\_type.

#### Request Parameters:

| Parameter             | Type     | Description                                                                                                             |
| --------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- |
| `registration_status` | `string` | Limits results to the a given participation status, defaults to "all" Allowed values: `all`, `registered`, `registered` |

## [Get next appointment](#method.appointment_groups.next_appointment) <a href="#method.appointment_groups.next_appointment" id="method.appointment_groups.next_appointment"></a>

[AppointmentGroupsController#next\_appointment](https://github.com/instructure/canvas-lms/blob/master/app/controllers/appointment_groups_controller.rb)

#### `GET /api/v1/appointment_groups/next_appointment`

**Scope:** `url:GET|/api/v1/appointment_groups/next_appointment`

Return the next appointment available to sign up for. The appointment is returned in a one-element array. If no future appointments are available, an empty array is returned.

#### Request Parameters:

| Parameter                 | Type     | Description                                  |
| ------------------------- | -------- | -------------------------------------------- |
| `appointment_group_ids[]` | `string` | List of ids of appointment groups to search. |

Returns a list of [CalendarEvent](/services/canvas/resources/calendar_events#calendarevent) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Assessment Question Banks

#### An AssessmentQuestionBank object looks like: <a href="#assessmentquestionbank" id="assessmentquestionbank"></a>

```js
{
  // The ID of the assessment question bank.
  "id": 1,
  // The ID of the context (course or account) the question bank belongs to.
  "context_id": 2,
  // The type of context (Course or Account).
  "context_type": "Course",
  // The title of the question bank.
  "title": "Chapter 1 Questions",
  // The workflow state of the question bank.
  "workflow_state": "active",
  // The number of questions in the bank.
  "assessment_question_count": 10,
  // The combined context type and ID.
  "context_code": "course_2",
  // The date and time the question bank was created.
  "created_at": "2013-01-01T00:00:00Z",
  // The date and time the question bank was last updated.
  "updated_at": "2013-01-01T00:00:00Z"
}
```

#### An AssessmentQuestion object looks like: <a href="#assessmentquestion" id="assessmentquestion"></a>

```js
{
  // The ID of the assessment question.
  "id": 1,
  // The order of the question.
  "position": 1,
  // The ID of the question bank this question belongs to.
  "assessment_question_bank_id": 3,
  // The date and time when the assessment question was created.
  "created_at": "2013-01-23T23:59:00-07:00",
  // The name of the question.
  "question_name": "Prime Number Identification",
  // The type of the question.
  "question_type": "multiple_choice_question",
  // The text of the question.
  "question_text": "Which of the following is NOT a prime number?",
  // The maximum amount of points possible received for getting this question
  // correct.
  "points_possible": 5,
  // The comments to display if the student answers the question correctly.
  "correct_comments": "That's correct!",
  // The comments to display if the student answers incorrectly.
  "incorrect_comments": "Unfortunately, that IS a prime number.",
  // The comments to display regardless of how the student answered.
  "neutral_comments": "Goldbach's conjecture proposes that every even integer greater than 2 can be expressed as the sum of two prime numbers.",
  // The HTML version of the comments to display if the student answers the
  // question correctly.
  "correct_comments_html": "<p>That's correct!</p>",
  // The HTML version of the comments to display if the student answers
  // incorrectly.
  "incorrect_comments_html": "<p>Unfortunately, that IS a prime number.</p>",
  // The HTML version of the comments to display regardless of how the student
  // answered.
  "neutral_comments_html": "<p>Goldbach's conjecture proposes that every even integer greater than 2 can be expressed as the sum of two prime numbers.</p>",
  // An array of available answers. Each answer contains id, text, html, comments,
  // comments_html, and weight properties.
  "answers": null,
  // Variables for calculated questions. Null for other question types.
  "variables": null,
  // Formulas for calculated questions. Null for other question types.
  "formulas": null,
  // The tolerance for numerical answers. Null for non-numerical question types.
  "answer_tolerance": null,
  // The number of decimal places for formula results. Null for non-calculated
  // question types.
  "formula_decimal_places": null,
  // Matching pairs for matching questions. Null for other question types.
  "matches": null,
  // Incorrect match options for matching questions. Null for other question
  // types.
  "matching_answer_incorrect_matches": null
}
```

## [List question banks](#method.assessment_question_banks.index) <a href="#method.assessment_question_banks.index" id="method.assessment_question_banks.index"></a>

[AssessmentQuestionBanksController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assessment_question_banks_controller.rb)

#### `GET /api/v1/question_banks`

**Scope:** `url:GET|/api/v1/question_banks`

Returns the paginated list of question banks for a given context.

#### Request Parameters:

| Parameter                | Type               | Description                                                                                    |
| ------------------------ | ------------------ | ---------------------------------------------------------------------------------------------- |
| `context_type`           | Required `string`  | The type of context. Must be either "Course" or "Account". Allowed values: `Course`, `Account` |
| `context_id`             | Required `integer` | The id of the context.                                                                         |
| `include_question_count` | `boolean`          | Whether to include the number of questions in each bank.                                       |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/question_banks?context_type=Course&context_id=1' \
     -H 'Authorization: Bearer <token>'
```

Returns a list of [AssessmentQuestionBank](#assessmentquestionbank) objects.

## [Get a single question bank](#method.assessment_question_banks.show) <a href="#method.assessment_question_banks.show" id="method.assessment_question_banks.show"></a>

[AssessmentQuestionBanksController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assessment_question_banks_controller.rb)

#### `GET /api/v1/question_banks/:id`

**Scope:** `url:GET|/api/v1/question_banks/:id`

Returns the question bank with the given id

#### Request Parameters:

| Parameter                | Type               | Description                                             |
| ------------------------ | ------------------ | ------------------------------------------------------- |
| `id`                     | Required `integer` | The question bank unique identifier.                    |
| `include_question_count` | `boolean`          | Whether to include the number of questions in the bank. |

Returns an [AssessmentQuestionBank](#assessmentquestionbank) object.

## [List assessment questions for a question bank](#method.assessment_question_banks.questions) <a href="#method.assessment_question_banks.questions" id="method.assessment_question_banks.questions"></a>

[AssessmentQuestionBanksController#questions](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assessment_question_banks_controller.rb)

#### `GET /api/v1/question_banks/:id/questions`

**Scope:** `url:GET|/api/v1/question_banks/:id/questions`

Returns the paginated list of assessment questions in this bank.

#### Request Parameters:

| Parameter | Type               | Description                          |
| --------- | ------------------ | ------------------------------------ |
| `id`      | Required `integer` | The question bank unique identifier. |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/question_banks/:id/questions' \
     -H 'Authorization: Bearer <token>'
```

Returns a list of [AssessmentQuestion](#assessmentquestion) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Asset Processor

1EdTech Asset Processor services: Asset Service and Asset Report Service.

1EdTech Asset Processor services: Eula Service and Eula Acceptance Service.

## [Create an Asset Report](#method.lti/ims/asset_processor.create_report) <a href="#method.lti-ims-asset_processor.create_report" id="method.lti-ims-asset_processor.create_report"></a>

[Lti::Ims::AssetProcessorController#create\_report](https://github.com/instructure/canvas-lms/blob/master/app/controllers/lti/ims/asset_processor_controller.rb)

#### `POST /api/lti/asset_processors/:asset_processor_id/reports`

**Scope:** `url:POST|/api/lti/asset_processors/:asset_processor_id/reports`

Creates a report for a given Canvas-managed asset (such as a submission attachment).

Returns an HTTP 201 (Created) on success.

#### Request Parameters:

| Parameter            | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| -------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `assetId`            | `string`  | <p>The UUID of the asset to which the report applies. Canvas will supply<br>this to the tool in the the <code>LtiAssetProcessorSubmissionNotice</code>.</p>                                                                                                                                                                                                                                                                                   |
| `errorCode`          | `string`  | <p>A machine-readable code indicating the cause of the failure, for reports<br>with a processingProgress value of <code>Failed</code>. The following standard error<br>codes are available, but tools may use their own (in which case the tool<br>may provide human-readable information in the <code>comment</code> field):<br>UNSUPPORTED\_ASSET\_TYPE, ASSET\_TOO\_LARGE, ASSET\_TOO\_SMALL,<br>EULA\_NOT\_ACCEPTED, DOWNLOAD\_FAILED</p> |
| `indicationAlt`      | `string`  | <p>Alternate text representing the meaning of the indicationColor for screen<br>readers or as a tooltip over the indication color.</p>                                                                                                                                                                                                                                                                                                        |
| `indicationColor`    | `string`  | <p>A hex (#RRGGBB) color code the tool wishes to use indicating the outcome<br>of an asset's report.</p>                                                                                                                                                                                                                                                                                                                                      |
| `priority`           | `integer` | <p>A number from 0 (meaning "good" or "success") to 5 (meaning urgent or<br>time-critical notable features) indicating the tool's perceived priority<br>of the report. If a priority is not known or applicable, the tool should<br>use the value 0.</p>                                                                                                                                                                                      |
| `processingProgress` | `string`  | <p>Indicates the status of the report. Should be one of the following:<br>Processed, Processing, PendingManual, Failed, NotProcessed, NotReady.<br>If an unrecognized value is given, the value will be stored, but will<br>be treated by Canvas as <code>NotReady</code>.</p>                                                                                                                                                                |
| `result`             | `string`  | <p>A short string (16 characters or fewer) that briefly describes the<br>successful result of the processing. This should be provided if<br>processingProgress is Processed, and not provided otherwise.</p>                                                                                                                                                                                                                                  |
| `timestamp`          | `string`  | <p>An ISO8601 date time value with microsecond precision. Reports with newer<br>timestamps for the same asset and report type supersede<br>previously submitted reports with older (or equal) timestamps. Likewise,<br>if the timestamp provided is older than the latest timestamp for an<br>existing report (of same asset and type), the new report will be<br>ignored and the endpoint will return an HTTP 409 (Conflict).</p>            |
| `title`              | `string`  | A human-readable title for the report, to be displayed to the user.                                                                                                                                                                                                                                                                                                                                                                           |
| `type`               | `string`  | An opaque value representing the type of report.                                                                                                                                                                                                                                                                                                                                                                                              |
| `visibleToOwner`     | `boolean` | <p>A boolean value indicates whether the indicator and report<br>should be visible to the user who owns the asset being reported on.<br>If no value is provided, the platform should assume a default value of false</p>                                                                                                                                                                                                                      |

#### Example Request:

```bash
{
  "assetId" : "57d463ea-6e5d-45c8-a86f-64f3dd9ef81e",
  "type": "originality",
  "timestamp": "2025-01-24T17:56:53.221+00:00",
  "title": "Originality Report",
  "result" : "75/100",
  "indicationColor" : "#EC0000",
  "indicationAlt" : "High percentage of matched text.",
  "priority": 5,
  "processingProgress": "Processed"
}
```

```bash
{
  "assetId" : "57d463ea-6e5d-45c8-a86f-64f3dd9ef81e",
  "type": "originality",
  "timestamp": "2025-01-24T17:56:53.221+00:00",
  "title": "Originality Report",
  "priority": 0,
  "errorCode": "UNSUPPORTED_ASSET_TYPE",
  "processingProgress": "Failed"
}
```

#### Example Response:

```js
{
  "assetId" : "57d463ea-6e5d-45c8-a86f-64f3dd9ef81e",
  "type": "originality",
  "timestamp": "2025-01-24T17:56:53.221+00:00",
  "title": "Originality Report",
  "result" : "75/100",
  "indicationColor" : "#EC0000",
  "indicationAlt" : "High percentage of matched text.",
  "priority": 5,
  "processingProgress": "Processed"
}
```

## [Update Eula Deployment Configuration](#method.lti/ims/asset_processor_eula.update_tool_eula) <a href="#method.lti-ims-asset_processor_eula.update_tool_eula" id="method.lti-ims-asset_processor_eula.update_tool_eula"></a>

[Lti::Ims::AssetProcessorEulaController#update\_tool\_eula](https://github.com/instructure/canvas-lms/blob/master/app/controllers/lti/ims/asset_processor_eula_controller.rb)

#### `PUT /api/lti/asset_processor_eulas/:context_external_tool_id/deployment`

**Scope:** `url:PUT|/api/lti/asset_processor_eulas/:context_external_tool_id/deployment`

Provides a mechanism by which a platform can enable or disable the requirement for users to accept a EULA within the scope of an entire deployment

#### Request Parameters:

| Parameter      | Type      | Description                                                                          |
| -------------- | --------- | ------------------------------------------------------------------------------------ |
| `eulaRequired` | `boolean` | A boolean value representing whether or not the EULA is required for the deployment. |

#### Example Request:

```bash
{
  "eulaRequired": true,
}
```

#### Example Response:

```js
{
  "eulaRequired": true,
}
```

## [Create an Eula Acceptance](#method.lti/ims/asset_processor_eula.create_acceptance) <a href="#method.lti-ims-asset_processor_eula.create_acceptance" id="method.lti-ims-asset_processor_eula.create_acceptance"></a>

[Lti::Ims::AssetProcessorEulaController#create\_acceptance](https://github.com/instructure/canvas-lms/blob/master/app/controllers/lti/ims/asset_processor_eula_controller.rb)

#### `POST /api/lti/asset_processor_eulas/:context_external_tool_id/user`

**Scope:** `url:POST|/api/lti/asset_processor_eulas/:context_external_tool_id/user`

The EULA user acceptance service provides a mechanism by which a tool can notify a platform of whether or not a user has accepted a EULA.

#### Request Parameters:

| Parameter   | Type      | Description                                                                                                                                             |
| ----------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `userId`    | `string`  | <p>The userId represents the user who has accepted or declined the EULA,<br><code>lti\_id</code> of the Canvas User.</p>                                |
| `accepted`  | `boolean` | A boolean value representing whether or not the user has accepted the EULA                                                                              |
| `timestamp` | `string`  | <p>The timestamp represents the time at which the user accepted or declined the EULA.<br>This timestamp must be formatted as an ISO 8601 date time.</p> |

#### Example Request:

```bash
{
  "userId": "59ed2101-0302-406c-b53f-9705ae1cb357",
  "accepted": true,
  "timestamp": "2022-04-16T18:54:36.736+00:00"
}
```

#### Example Response:

```js
{
  "userId": "59ed2101-0302-406c-b53f-9705ae1cb357",
  "accepted": true,
  "timestamp": "2022-04-16T18:54:36.736+00:00"
}
```

## [Delete Eula Acceptances for deployment](#method.lti/ims/asset_processor_eula.delete_acceptances) <a href="#method.lti-ims-asset_processor_eula.delete_acceptances" id="method.lti-ims-asset_processor_eula.delete_acceptances"></a>

[Lti::Ims::AssetProcessorEulaController#delete\_acceptances](https://github.com/instructure/canvas-lms/blob/master/app/controllers/lti/ims/asset_processor_eula_controller.rb)

#### `DELETE /api/lti/asset_processor_eulas/:context_external_tool_id/user`

**Scope:** `url:DELETE|/api/lti/asset_processor_eulas/:context_external_tool_id/user`

Remove the EULA acceptance status for all users within the current deployment. This will allow a tool to reset the EULA acceptance status for all users, and force them to accept the EULA again in the case that the EULA has changed.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Assignment Extensions

API for setting extensions on student assignment submissions. These cannot be set for discussion assignments or quizzes. For quizzes, use [Quiz Extensions](/services/canvas/resources/quiz_extensions) instead.

#### An AssignmentExtension object looks like: <a href="#assignmentextension" id="assignmentextension"></a>

```js
{
  // The ID of the Assignment the extension belongs to.
  "assignment_id": 2,
  // The ID of the Student that needs the assignment extension.
  "user_id": 3,
  // Number of times the student is allowed to re-submit the assignment
  "extra_attempts": 2
}
```

## [Set extensions for student assignment submissions](#method.assignment_extensions.create) <a href="#method.assignment_extensions.create" id="method.assignment_extensions.create"></a>

[AssignmentExtensionsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_extensions_controller.rb)

#### `POST /api/v1/courses/:course_id/assignments/:assignment_id/extensions`

**Scope:** `url:POST|/api/v1/courses/:course_id/assignments/:assignment_id/extensions`

\<b>Responses\</b>

* \<b>200 OK\</b> if the request was successful
* \<b>403 Forbidden\</b> if you are not allowed to extend assignments for this course
* \<b>400 Bad Request\</b> if any of the extensions are invalid

#### Request Parameters:

| Parameter                                 | Type               | Description                                                                                |
| ----------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------ |
| `assignment_extensions[][user_id]`        | Required `integer` | The ID of the user we want to add assignment extensions for.                               |
| `assignment_extensions[][extra_attempts]` | Required `integer` | <p>Number of times the student is allowed to re-take the assignment over the<br>limit.</p> |

#### Example Request:

```bash
{
  "assignment_extensions": [{
    "user_id": 3,
    "extra_attempts": 2
  },{
    "user_id": 2,
    "extra_attempts": 2
  }]
}
```

#### Example Response:

```js
{
  "assignment_extensions": [AssignmentExtension]
}
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Assignment Groups

API for accessing Assignment Group and Assignment information.

#### A GradingRules object looks like: <a href="#gradingrules" id="gradingrules"></a>

```js
{
  // Number of lowest scores to be dropped for each user.
  "drop_lowest": 1,
  // Number of highest scores to be dropped for each user.
  "drop_highest": 1,
  // Assignment IDs that should never be dropped.
  "never_drop": [33, 17, 24]
}
```

#### An AssignmentGroup object looks like: <a href="#assignmentgroup" id="assignmentgroup"></a>

```js
{
  // the id of the Assignment Group
  "id": 1,
  // the name of the Assignment Group
  "name": "group2",
  // the position of the Assignment Group
  "position": 7,
  // the weight of the Assignment Group
  "group_weight": 20,
  // the sis source id of the Assignment Group
  "sis_source_id": "1234",
  // the integration data of the Assignment Group
  "integration_data": {"5678":"0954"},
  // the assignments in this Assignment Group (see the Assignment API for a
  // detailed list of fields)
  "assignments": [],
  // the grading rules that this Assignment Group has
  "rules": null
}
```

## [List assignment groups](#method.assignment_groups.index) <a href="#method.assignment_groups.index" id="method.assignment_groups.index"></a>

[AssignmentGroupsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_groups_controller.rb)

#### `GET /api/v1/courses/:course_id/assignment_groups`

**Scope:** `url:GET|/api/v1/courses/:course_id/assignment_groups`

Returns the paginated list of assignment groups for the current context. The returned groups are sorted by their position field.

#### Request Parameters:

| Parameter                               | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `include[]`                             | `string`  | <p>Associations to include with the group. "discussion\_topic", "all\_dates", "can\_edit",<br>"assignment\_visibility" & "submission" are only valid if "assignments" is also included.<br>"score\_statistics" requires that the "assignments" and "submission" options are included.<br>The "assignment\_visibility" option additionally requires that the Differentiated Assignments course feature be turned on.<br>If "observed\_users" is passed along with "assignments" and "submission", submissions for observed users will also be included as an array.<br>The "peer\_review" option requires that the Peer Review Grading course feature be turned on and that "assignments" is included. Allowed values: <code>assignments</code>, <code>discussion\_topic</code>, <code>all\_dates</code>, <code>assignment\_visibility</code>, <code>overrides</code>, <code>submission</code>, <code>observed\_users</code>, <code>can\_edit</code>, <code>score\_statistics</code>, <code>peer\_review</code></p> |
| `assignment_ids[]`                      | `string`  | <p>If "assignments" are included, optionally return only assignments having their ID in this array. This argument may also be passed as<br>a comma separated string.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `exclude_assignment_submission_types[]` | `string`  | <p>If "assignments" are included, those with the specified submission types<br>will be excluded from the assignment groups. Allowed values: <code>online\_quiz</code>, <code>discussion\_topic</code>, <code>wiki\_page</code>, <code>external\_tool</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `override_assignment_dates`             | `boolean` | Apply assignment overrides for each assignment, defaults to true.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `grading_period_id`                     | `integer` | <p>The id of the grading period in which assignment groups are being requested<br>(Requires grading periods to exist.)</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `scope_assignments_to_student`          | `boolean` | <p>If true, all assignments returned will apply to the current user in the<br>specified grading period. If assignments apply to other students in the<br>specified grading period, but not the current user, they will not be<br>returned. (Requires the grading\_period\_id argument and grading periods to<br>exist. In addition, the current user must be a student.)</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

Returns a list of [AssignmentGroup](#assignmentgroup) objects.

## [Get an Assignment Group](#method.assignment_groups_api.show) <a href="#method.assignment_groups_api.show" id="method.assignment_groups_api.show"></a>

[AssignmentGroupsApiController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_groups_api_controller.rb)

#### `GET /api/v1/courses/:course_id/assignment_groups/:assignment_group_id`

**Scope:** `url:GET|/api/v1/courses/:course_id/assignment_groups/:assignment_group_id`

Returns the assignment group with the given id.

#### Request Parameters:

| Parameter                   | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| --------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]`                 | `string`  | <p>Associations to include with the group. "discussion\_topic" and "assignment\_visibility" and "submission"<br>are only valid if "assignments" is also included. "score\_statistics" is only valid if "submission" and<br>"assignments" are also included. The "assignment\_visibility" option additionally requires that the Differentiated Assignments<br>course feature be turned on. Allowed values: <code>assignments</code>, <code>discussion\_topic</code>, <code>assignment\_visibility</code>, <code>submission</code>, <code>score\_statistics</code></p> |
| `override_assignment_dates` | `boolean` | Apply assignment overrides for each assignment, defaults to true.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `grading_period_id`         | `integer` | <p>The id of the grading period in which assignment groups are being requested<br>(Requires grading periods to exist on the account)</p>                                                                                                                                                                                                                                                                                                                                                                                                                             |

Returns an [AssignmentGroup](#assignmentgroup) object.

## [Create an Assignment Group](#method.assignment_groups_api.create) <a href="#method.assignment_groups_api.create" id="method.assignment_groups_api.create"></a>

[AssignmentGroupsApiController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_groups_api_controller.rb)

#### `POST /api/v1/courses/:course_id/assignment_groups`

**Scope:** `url:POST|/api/v1/courses/:course_id/assignment_groups`

Create a new assignment group for this course.

#### Request Parameters:

| Parameter          | Type      | Description                                                                      |
| ------------------ | --------- | -------------------------------------------------------------------------------- |
| `name`             | `string`  | The assignment group's name                                                      |
| `position`         | `integer` | The position of this assignment group in relation to the other assignment groups |
| `group_weight`     | `number`  | The percent of the total grade that this assignment group represents             |
| `sis_source_id`    | `string`  | The sis source id of the Assignment Group                                        |
| `integration_data` | `Object`  | The integration data of the Assignment Group                                     |

Returns an [AssignmentGroup](#assignmentgroup) object.

## [Edit an Assignment Group](#method.assignment_groups_api.update) <a href="#method.assignment_groups_api.update" id="method.assignment_groups_api.update"></a>

[AssignmentGroupsApiController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_groups_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/assignment_groups/:assignment_group_id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/assignment_groups/:assignment_group_id`

Modify an existing Assignment Group.

#### Request Parameters:

| Parameter          | Type      | Description                                                                                                                     |
| ------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `name`             | `string`  | The assignment group's name                                                                                                     |
| `position`         | `integer` | The position of this assignment group in relation to the other assignment groups                                                |
| `group_weight`     | `number`  | The percent of the total grade that this assignment group represents                                                            |
| `sis_source_id`    | `string`  | The sis source id of the Assignment Group                                                                                       |
| `integration_data` | `Object`  | The integration data of the Assignment Group                                                                                    |
| `rules`            | `string`  | <p>The grading rules that are applied within this assignment group<br>See the Assignment Group object definition for format</p> |

Returns an [AssignmentGroup](#assignmentgroup) object.

## [Destroy an Assignment Group](#method.assignment_groups_api.destroy) <a href="#method.assignment_groups_api.destroy" id="method.assignment_groups_api.destroy"></a>

[AssignmentGroupsApiController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_groups_api_controller.rb)

#### `DELETE /api/v1/courses/:course_id/assignment_groups/:assignment_group_id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/assignment_groups/:assignment_group_id`

Deletes the assignment group with the given id.

#### Request Parameters:

| Parameter             | Type      | Description                                                                                                                                                                                                                                                     |
| --------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `move_assignments_to` | `integer` | <p>The ID of an active Assignment Group to which the assignments that are<br>currently assigned to the destroyed Assignment Group will be assigned.<br>NOTE: If this argument is not provided, any assignments in this Assignment<br>Group will be deleted.</p> |

Returns an [AssignmentGroup](#assignmentgroup) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Assignments

API for accessing assignment information.

#### An ExternalToolTagAttributes object looks like: <a href="#externaltooltagattributes" id="externaltooltagattributes"></a>

```js
{
  // URL to the external tool
  "url": "http://instructure.com",
  // Whether or not there is a new tab for the external tool
  "new_tab": false,
  // the identifier for this tool_tag
  "resource_link_id": "ab81173af98b8c33e66a"
}
```

#### A LockInfo object looks like: <a href="#lockinfo" id="lockinfo"></a>

```js
{
  // Asset string for the object causing the lock
  "asset_string": "assignment_4",
  // (Optional) Time at which this was/will be unlocked. Must be before the due
  // date.
  "unlock_at": "2013-01-01T00:00:00-06:00",
  // (Optional) Time at which this was/will be locked. Must be after the due date.
  "lock_at": "2013-02-01T00:00:00-06:00",
  // (Optional) Context module causing the lock.
  "context_module": "{}",
  "manually_locked": true
}
```

#### A RubricRating object looks like: <a href="#rubricrating" id="rubricrating"></a>

```js
{
  "points": 10,
  "id": "rat1",
  "description": "Full marks",
  "long_description": "Student completed the assignment flawlessly."
}
```

#### A RubricCriteria object looks like: <a href="#rubriccriteria" id="rubriccriteria"></a>

```js
{
  "points": 10,
  // The id of rubric criteria.
  "id": "crit1",
  // (Optional) The id of the learning outcome this criteria uses, if any.
  "learning_outcome_id": "1234",
  // (Optional) The 3rd party vendor's GUID for the outcome this criteria
  // references, if any.
  "vendor_guid": "abdsfjasdfne3jsdfn2",
  "description": "Criterion 1",
  "long_description": "Criterion 1 more details",
  "criterion_use_range": true,
  "ratings": null,
  "ignore_for_scoring": true
}
```

#### An AssignmentDate object looks like: <a href="#assignmentdate" id="assignmentdate"></a>

```js
// Object representing a due date for an assignment or quiz. If the due date
// came from an assignment override, it will have an 'id' field.
{
  // (Optional, missing if 'base' is present) id of the assignment override this
  // date represents
  "id": 1,
  // (Optional, present if 'id' is missing) whether this date represents the
  // assignment's or quiz's default due date
  "base": true,
  "title": "Summer Session",
  // The due date for the assignment. Must be between the unlock date and the lock
  // date if there are lock dates
  "due_at": "2013-08-28T23:59:00-06:00",
  // The unlock date for the assignment. Must be before the due date if there is a
  // due date.
  "unlock_at": "2013-08-01T00:00:00-06:00",
  // The lock date for the assignment. Must be after the due date if there is a
  // due date.
  "lock_at": "2013-08-31T23:59:00-06:00"
}
```

#### A TurnitinSettings object looks like: <a href="#turnitinsettings" id="turnitinsettings"></a>

```js
{
  "originality_report_visibility": "after_grading",
  "s_paper_check": false,
  "internet_check": false,
  "journal_check": false,
  "exclude_biblio": false,
  "exclude_quoted": false,
  "exclude_small_matches_type": "percent",
  "exclude_small_matches_value": 50
}
```

#### A NeedsGradingCount object looks like: <a href="#needsgradingcount" id="needsgradingcount"></a>

```js
// Used by Assignment model
{
  // The section ID
  "section_id": "123456",
  // Number of submissions that need grading
  "needs_grading_count": 5
}
```

#### A ScoreStatistic object looks like: <a href="#scorestatistic" id="scorestatistic"></a>

```js
// Used by Assignment model
{
  // Min score
  "min": 1,
  // Max score
  "max": 10,
  // Mean score
  "mean": 6,
  // Upper quartile score
  "upper_q": 10,
  // Median score
  "median": 6,
  // Lower quartile score
  "lower_q": 1
}
```

#### An Assignment object looks like: <a href="#assignment" id="assignment"></a>

```js
{
  // the ID of the assignment
  "id": 4,
  // the name of the assignment
  "name": "some assignment",
  // the assignment description, in an HTML fragment
  "description": "<p>Do the following:</p>...",
  // The time at which this assignment was originally created
  "created_at": "2012-07-01T23:59:00-06:00",
  // The time at which this assignment was last modified in any way
  "updated_at": "2012-07-01T23:59:00-06:00",
  // the due date for the assignment. returns null if not present. NOTE: If this
  // assignment has assignment overrides, this field will be the due date as it
  // applies to the user requesting information from the API.
  "due_at": "2012-07-01T23:59:00-06:00",
  // the lock date (assignment is locked after this date). returns null if not
  // present. NOTE: If this assignment has assignment overrides, this field will
  // be the lock date as it applies to the user requesting information from the
  // API.
  "lock_at": "2012-07-01T23:59:00-06:00",
  // the unlock date (assignment is unlocked after this date) returns null if not
  // present NOTE: If this assignment has assignment overrides, this field will be
  // the unlock date as it applies to the user requesting information from the
  // API.
  "unlock_at": "2012-07-01T23:59:00-06:00",
  // whether this assignment has overrides
  "has_overrides": true,
  // (Optional) all dates associated with the assignment, if applicable
  "all_dates": null,
  // the ID of the course the assignment belongs to
  "course_id": 123,
  // the URL to the assignment's web page
  "html_url": "https://...",
  // the URL to download all submissions as a zip
  "submissions_download_url": "https://example.com/courses/:course_id/assignments/:id/submissions?zip=1",
  // the ID of the assignment's group
  "assignment_group_id": 2,
  // Boolean flag indicating whether the assignment requires a due date based on
  // the account level setting
  "due_date_required": true,
  // Allowed file extensions, which take effect if submission_types includes
  // 'online_upload'.
  "allowed_extensions": ["docx", "ppt"],
  // An integer indicating the maximum length an assignment's name may be
  "max_name_length": 15,
  // Boolean flag indicating whether or not Turnitin has been enabled for the
  // assignment. NOTE: This flag will not appear unless your account has the
  // Turnitin plugin available
  "turnitin_enabled": true,
  // Boolean flag indicating whether or not VeriCite has been enabled for the
  // assignment. NOTE: This flag will not appear unless your account has the
  // VeriCite plugin available
  "vericite_enabled": true,
  // Settings to pass along to turnitin to control what kinds of matches should be
  // considered. originality_report_visibility can be 'immediate',
  // 'after_grading', 'after_due_date', or 'never' exclude_small_matches_type can
  // be null, 'percent', 'words' exclude_small_matches_value: - if type is null,
  // this will be null also - if type is 'percent', this will be a number between
  // 0 and 100 representing match size to exclude as a percentage of the document
  // size. - if type is 'words', this will be number > 0 representing how many
  // words a match must contain for it to be considered NOTE: This flag will not
  // appear unless your account has the Turnitin plugin available
  "turnitin_settings": null,
  // If this is a group assignment, boolean flag indicating whether or not
  // students will be graded individually.
  "grade_group_students_individually": false,
  // (Optional) assignment's settings for external tools if submission_types
  // include 'external_tool'. Only url and new_tab are included (new_tab defaults
  // to false).  Use the 'External Tools' API if you need more information about
  // an external tool.
  "external_tool_tag_attributes": null,
  // Boolean indicating if peer reviews are required for this assignment
  "peer_reviews": false,
  // Boolean indicating peer reviews are assigned automatically. If false, the
  // teacher is expected to manually assign peer reviews.
  "automatic_peer_reviews": false,
  // Integer representing the amount of reviews each user is assigned. NOTE: This
  // key is NOT present unless you have automatic_peer_reviews set to true.
  "peer_review_count": 0,
  // String representing a date the reviews are due by. Must be a date that occurs
  // after the default due date. If blank, or date is not after the assignment's
  // due date, the assignment's due date will be used. NOTE: This key is NOT
  // present unless you have automatic_peer_reviews set to true.
  "peer_reviews_assign_at": "2012-07-01T23:59:00-06:00",
  // Boolean representing whether or not members from within the same group on a
  // group assignment can be assigned to peer review their own group's work
  "intra_group_peer_reviews": false,
  // The ID of the assignment’s group set, if this is a group assignment. For
  // group discussions, set group_category_id on the discussion topic, not the
  // linked assignment.
  "group_category_id": 1,
  // if the requesting user has grading rights, the number of submissions that
  // need grading.
  "needs_grading_count": 17,
  // if the requesting user has grading rights and the
  // 'needs_grading_count_by_section' flag is specified, the number of submissions
  // that need grading split out by section. NOTE: This key is NOT present unless
  // you pass the 'needs_grading_count_by_section' argument as true.  ANOTHER
  // NOTE: it's possible to be enrolled in multiple sections, and if a student is
  // setup that way they will show an assignment that needs grading in multiple
  // sections (effectively the count will be duplicated between sections)
  "needs_grading_count_by_section": [{"section_id":"123456","needs_grading_count":5}, {"section_id":"654321","needs_grading_count":0}],
  // the sorting order of the assignment in the group
  "position": 1,
  // (optional, present if Sync Grades to SIS feature is enabled)
  "post_to_sis": true,
  // (optional, Third Party unique identifier for Assignment)
  "integration_id": "12341234",
  // (optional, Third Party integration data for assignment)
  "integration_data": {"5678":"0954"},
  // the maximum points possible for the assignment
  "points_possible": 12.0,
  // the types of submissions allowed for this assignment list containing one or
  // more of the following: 'discussion_topic', 'online_quiz', 'on_paper', 'none',
  // 'external_tool', 'online_text_entry', 'online_url', 'online_upload',
  // 'media_recording', 'student_annotation'
  "submission_types": ["online_text_entry"],
  // If true, the assignment has been submitted to by at least one student
  "has_submitted_submissions": true,
  // The type of grading the assignment receives; one of 'pass_fail', 'percent',
  // 'letter_grade', 'gpa_scale', 'points'
  "grading_type": "points",
  // The id of the grading standard being applied to this assignment. Valid if
  // grading_type is 'letter_grade' or 'gpa_scale'.
  "grading_standard_id": null,
  // Whether the assignment is published
  "published": true,
  // Whether the assignment's 'published' state can be changed to false. Will be
  // false if there are student submissions for the assignment.
  "unpublishable": false,
  // Whether the assignment is only visible to overrides.
  "only_visible_to_overrides": false,
  // Whether or not this is locked for the user.
  "locked_for_user": false,
  // (Optional) Information for the user about the lock. Present when
  // locked_for_user is true.
  "lock_info": null,
  // (Optional) An explanation of why this is locked for the user. Present when
  // locked_for_user is true.
  "lock_explanation": "This assignment is locked until September 1 at 12:00am",
  // (Optional) id of the associated quiz (applies only when submission_types is
  // ['online_quiz'])
  "quiz_id": 620,
  // (Optional) whether anonymous submissions are accepted (applies only to quiz
  // assignments)
  "anonymous_submissions": false,
  // (Optional) the DiscussionTopic associated with the assignment, if applicable
  "discussion_topic": null,
  // (Optional) Boolean indicating if assignment will be frozen when it is copied.
  // NOTE: This field will only be present if the AssignmentFreezer plugin is
  // available for your account.
  "freeze_on_copy": false,
  // (Optional) Boolean indicating if assignment is frozen for the calling user.
  // NOTE: This field will only be present if the AssignmentFreezer plugin is
  // available for your account.
  "frozen": false,
  // (Optional) Array of frozen attributes for the assignment. Only account
  // administrators currently have permission to change an attribute in this list.
  // Will be empty if no attributes are frozen for this assignment. Possible
  // frozen attributes are: title, description, lock_at, points_possible,
  // grading_type, submission_types, assignment_group_id, allowed_extensions,
  // group_category_id, notify_of_update, peer_reviews NOTE: This field will only
  // be present if the AssignmentFreezer plugin is available for your account.
  "frozen_attributes": ["title"],
  // (Optional) If 'submission' is included in the 'include' parameter, includes a
  // Submission object that represents the current user's (user who is requesting
  // information from the api) current submission for the assignment. See the
  // Submissions API for an example response. If the user does not have a
  // submission, this key will be absent.
  "submission": null,
  // (Optional) If true, the rubric is directly tied to grading the assignment.
  // Otherwise, it is only advisory. Included if there is an associated rubric.
  "use_rubric_for_grading": true,
  // (Optional) An object describing the basic attributes of the rubric, including
  // the point total. Included if there is an associated rubric.
  "rubric_settings": {"points_possible":"12"},
  // (Optional) A list of scoring criteria and ratings for each rubric criterion.
  // Included if there is an associated rubric.
  "rubric": null,
  // (Optional) If 'assignment_visibility' is included in the 'include' parameter,
  // includes an array of student IDs who can see this assignment.
  "assignment_visibility": [137, 381, 572],
  // (Optional) If 'overrides' is included in the 'include' parameter, includes an
  // array of assignment override objects.
  "overrides": null,
  // (Optional) If true, the assignment will be omitted from the student's final
  // grade
  "omit_from_final_grade": true,
  // (Optional) If true, the assignment will not be shown in any gradebooks
  "hide_in_gradebook": true,
  // Boolean indicating if the assignment is moderated.
  "moderated_grading": true,
  // The maximum number of provisional graders who may issue grades for this
  // assignment. Only relevant for moderated assignments. Must be a positive
  // value, and must be set to 1 if the course has fewer than two active
  // instructors. Otherwise, the maximum value is the number of active instructors
  // in the course minus one, or 10 if the course has more than 11 active
  // instructors.
  "grader_count": 3,
  // The user ID of the grader responsible for choosing final grades for this
  // assignment. Only relevant for moderated assignments.
  "final_grader_id": 3,
  // Boolean indicating if provisional graders' comments are visible to other
  // provisional graders. Only relevant for moderated assignments.
  "grader_comments_visible_to_graders": true,
  // Boolean indicating if provisional graders' identities are hidden from other
  // provisional graders. Only relevant for moderated assignments with
  // grader_comments_visible_to_graders set to true.
  "graders_anonymous_to_graders": true,
  // Boolean indicating if provisional grader identities are visible to the final
  // grader. Only relevant for moderated assignments.
  "grader_names_visible_to_final_grader": true,
  // Boolean indicating if the assignment is graded anonymously. If true, graders
  // cannot see student identities.
  "anonymous_grading": true,
  // The number of submission attempts a student can make for this assignment. -1
  // is considered unlimited.
  "allowed_attempts": 2,
  // Whether the assignment has manual posting enabled. Only relevant for courses
  // using New Gradebook.
  "post_manually": true,
  // (Optional) If 'score_statistics' and 'submission' are included in the
  // 'include' parameter and statistics are available, includes the min, max, and
  // mode for this assignment
  "score_statistics": null,
  // (Optional) If retrieving a single assignment and 'can_submit' is included in
  // the 'include' parameter, flags whether user has the right to submit the
  // assignment (i.e. checks enrollment dates, submission types, locked status,
  // attempts remaining, etc...). Including 'can submit' automatically includes
  // 'submission' in the include parameter. Not available when observed_users are
  // included.
  "can_submit": true,
  // (Optional) The academic benchmark(s) associated with the assignment or the
  // assignment's rubric. Only included if 'ab_guid' is included in the 'include'
  // parameter.
  "ab_guid": ["ABCD", "EFGH"],
  // (Optional) The account-level academic integrity pledge text a student must
  // accept before submitting this assignment. Only present if
  // 'academic_integrity_pledge' is included in the 'include' parameter AND the
  // pledge is enabled for the account; otherwise the key is omitted. When present
  // but the pledge does not apply to this particular assignment (e.g. external
  // tool assignments or Canvas Career courses), the value is null.
  "academic_integrity_pledge": "This submission reflects my own ideas and work",
  // The id of the attachment to be annotated by students. Relevant only if
  // submission_types includes 'student_annotation'.
  "annotatable_attachment_id": null,
  // (Optional) Boolean indicating whether student names are anonymized
  "anonymize_students": false,
  // (Optional) Boolean indicating whether the Respondus LockDown Browser® is
  // required for this assignment.
  "require_lockdown_browser": false,
  // (Optional) Boolean indicating whether this assignment has important dates.
  "important_dates": false,
  // (Optional, Deprecated) Boolean indicating whether notifications are muted for
  // this assignment.
  "muted": false,
  // Boolean indicating whether peer reviews are anonymous.
  "anonymous_peer_reviews": false,
  // Boolean indicating whether instructor anotations are anonymous.
  "anonymous_instructor_annotations": false,
  // Boolean indicating whether this assignment has graded submissions.
  "graded_submissions_exist": false,
  // Boolean indicating whether this is a quiz lti assignment.
  "is_quiz_assignment": false,
  // Boolean indicating whether this assignment is in a closed grading period.
  "in_closed_grading_period": false,
  // Boolean indicating whether this assignment can be duplicated.
  "can_duplicate": false,
  // If this assignment is a duplicate, it is the original assignment's course_id
  "original_course_id": 4,
  // If this assignment is a duplicate, it is the original assignment's id
  "original_assignment_id": 4,
  // If this assignment is a duplicate, it is the original assignment's
  // lti_resource_link_id
  "original_lti_resource_link_id": 4,
  // If this assignment is a duplicate, it is the original assignment's name
  "original_assignment_name": "some assignment",
  // If this assignment is a duplicate, it is the original assignment's quiz_id
  "original_quiz_id": 4,
  // String indicating what state this assignment is in.
  "workflow_state": "unpublished"
}
```

#### A BasicUser object looks like: <a href="#basicuser" id="basicuser"></a>

```js
{
  // The user's ID
  "id": "123456",
  // The user's name
  "name": "Dankey Kang"
}
```

#### An AssignmentOverride object looks like: <a href="#assignmentoverride" id="assignmentoverride"></a>

```js
{
  // the ID of the assignment override
  "id": 4,
  // the ID of the assignment the override applies to (present if the override
  // applies to an assignment)
  "assignment_id": 123,
  // the ID of the quiz the override applies to (present if the override applies
  // to a quiz)
  "quiz_id": 123,
  // the ID of the module the override applies to (present if the override applies
  // to a module)
  "context_module_id": 123,
  // the ID of the discussion the override applies to (present if the override
  // applies to an ungraded discussion)
  "discussion_topic_id": 123,
  // the ID of the page the override applies to (present if the override applies
  // to a page)
  "wiki_page_id": 123,
  // the ID of the file the override applies to (present if the override applies
  // to a file)
  "attachment_id": 123,
  // the IDs of the override's target students (present if the override targets an
  // ad-hoc set of students)
  "student_ids": [1, 2, 3],
  // the ID of the override's target group (present if the override targets a
  // group and the assignment is a group assignment)
  "group_id": 2,
  // the ID of the overrides's target section (present if the override targets a
  // section)
  "course_section_id": 1,
  // the title of the override
  "title": "an assignment override",
  // the overridden due at (present if due_at is overridden)
  "due_at": "2012-07-01T23:59:00-06:00",
  // the overridden all day flag (present if due_at is overridden)
  "all_day": true,
  // the overridden all day date (present if due_at is overridden)
  "all_day_date": "2012-07-01",
  // the overridden unlock at (present if unlock_at is overridden)
  "unlock_at": "2012-07-01T23:59:00-06:00",
  // the overridden lock at, if any (present if lock_at is overridden)
  "lock_at": "2012-07-01T23:59:00-06:00"
}
```

## [Delete an assignment](#method.assignments.destroy) <a href="#method.assignments.destroy" id="method.assignments.destroy"></a>

[AssignmentsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignments_controller.rb)

#### `DELETE /api/v1/courses/:course_id/assignments/:id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/assignments/:id`

Delete the given assignment.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/assignments/<assignment_id> \
     -X DELETE \
     -H 'Authorization: Bearer <token>'
```

Returns an [Assignment](#assignment) object.

## [List assignments](#method.assignments_api.index) <a href="#method.assignments_api.index" id="method.assignments_api.index"></a>

[AssignmentsApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignments_api_controller.rb)

#### `GET /api/v1/courses/:course_id/assignments`

**Scope:** `url:GET|/api/v1/courses/:course_id/assignments`

#### `GET /api/v1/courses/:course_id/assignment_groups/:assignment_group_id/assignments`

**Scope:** `url:GET|/api/v1/courses/:course_id/assignment_groups/:assignment_group_id/assignments`

Returns the paginated list of assignments for the current course or assignment group.

#### Request Parameters:

| Parameter                        | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| -------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]`                      | `string`  | <p>Optional information to include with each assignment:<br>submission:: The current user's current +Submission+<br>assignment\_visibility:: An array of ids of students who can see the assignment<br>all\_dates:: An array of +AssignmentDate+ structures, one for each override, and also a +base+ if the assignment has an "Everyone" / "Everyone Else" date<br>overrides:: An array of +AssignmentOverride+ structures<br>observed\_users:: An array of submissions for observed users<br>can\_edit:: an extra Boolean value will be included with each +Assignment+ (and +AssignmentDate+ if +all\_dates+ is supplied) to indicate whether the caller can edit the assignment or date. Moderated grading and closed grading periods may restrict a user's ability to edit an assignment.<br>score\_statistics:: An object containing min, max, and mean score on this assignment. This will not be included for students if there are less than 5 graded assignments or if disabled by the instructor. Only valid if 'submission' is also included.<br>ab\_guid:: An array of guid strings for academic benchmarks Allowed values: <code>submission</code>, <code>assignment\_visibility</code>, <code>all\_dates</code>, <code>overrides</code>, <code>observed\_users</code>, <code>can\_edit</code>, <code>score\_statistics</code>, <code>ab\_guid</code></p> |
| `search_term`                    | `string`  | The partial title of the assignments to match and return.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `override_assignment_dates`      | `boolean` | Apply assignment overrides for each assignment, defaults to true.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `needs_grading_count_by_section` | `boolean` | Split up "needs\_grading\_count" by sections into the "needs\_grading\_count\_by\_section" key, defaults to false                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `bucket`                         | `string`  | If included, only return certain assignments depending on due date and submission status. Allowed values: `past`, `overdue`, `undated`, `ungraded`, `unsubmitted`, `upcoming`, `future`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `assignment_ids[]`               | `string`  | if set, return only assignments specified                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `order_by`                       | `string`  | Determines the order of the assignments. Defaults to "position". Allowed values: `position`, `name`, `due_at`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `post_to_sis`                    | `boolean` | Return only assignments that have post\_to\_sis set or not set.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `new_quizzes`                    | `boolean` | Return only New Quizzes assignments                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

Returns a list of [Assignment](#assignment) objects.

## [List assignments for user](#method.assignments_api.user_index) <a href="#method.assignments_api.user_index" id="method.assignments_api.user_index"></a>

[AssignmentsApiController#user\_index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignments_api_controller.rb)

#### `GET /api/v1/users/:user_id/courses/:course_id/assignments`

**Scope:** `url:GET|/api/v1/users/:user_id/courses/:course_id/assignments`

Returns the paginated list of assignments for the specified user if the current user has rights to view. See [List assignments](#method.assignments_api.index) for valid arguments.

## [Duplicate assignment](#method.assignments_api.duplicate) <a href="#method.assignments_api.duplicate" id="method.assignments_api.duplicate"></a>

[AssignmentsApiController#duplicate](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignments_api_controller.rb)

#### `POST /api/v1/courses/:course_id/assignments/:assignment_id/duplicate`

**Scope:** `url:POST|/api/v1/courses/:course_id/assignments/:assignment_id/duplicate`

Duplicate an assignment and return a json based on result\_type argument.

#### Request Parameters:

| Parameter     | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `result_type` | `string` | <p>Optional information:<br>When the root account has the feature <code>newquizzes\_on\_quiz\_page</code> enabled<br>and this argument is set to "Quiz" the response will be serialized into a<br><a href="/pages/lh0hBZ4haBZgUMlbdl3w#Quiz">quiz format</a>;<br>When this argument isn't specified the response will be serialized into an<br>assignment format; Allowed values: <code>Quiz</code></p> |

#### Example Request:

```bash
curl -X POST -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/courses/123/assignments/123/duplicate
```

```bash
curl -X POST -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/courses/123/assignments/123/duplicate?result_type=Quiz
```

Returns an [Assignment](#assignment) object.

## [List group members for a student on an assignment](#method.assignments_api.student_group_members) <a href="#method.assignments_api.student_group_members" id="method.assignments_api.student_group_members"></a>

[AssignmentsApiController#student\_group\_members](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignments_api_controller.rb)

#### `GET /api/v1/courses/:course_id/assignments/:assignment_id/users/:user_id/group_members`

**Scope:** `url:GET|/api/v1/courses/:course_id/assignments/:assignment_id/users/:user_id/group_members`

Returns student ids and names for the group.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/assignments/1/users/1/group_members
```

Returns a list of [BasicUser](#basicuser) objects.

## [Get a single assignment](#method.assignments_api.show) <a href="#method.assignments_api.show" id="method.assignments_api.show"></a>

[AssignmentsApiController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignments_api_controller.rb)

#### `GET /api/v1/courses/:course_id/assignments/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/assignments/:id`

Returns the assignment with the given id.

#### Request Parameters:

| Parameter                        | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| -------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]`                      | `string`  | <p>Associations to include with the assignment. The "assignment\_visibility" option<br>requires that the Differentiated Assignments course feature be turned on. If<br>"observed\_users" is passed, submissions for observed users will also be included.<br>For "score\_statistics" to be included, the "submission" option must also be set.<br>The "peer\_review" option returns peer review sub assignment data if it exists, regardless<br>of the Peer Review Allocation and Grading feature state. If no peer review sub assignment<br>exists, the feature must be enabled to receive a null value; otherwise the key is omitted.<br>The "academic\_integrity\_pledge" option returns the account-level academic integrity<br>pledge text a student must accept before submitting this assignment. The key is only<br>present when the pledge is enabled for the account; when present but the pledge does not<br>apply to this assignment (e.g. external tool assignments or Canvas Career courses) the<br>value is null. Allowed values: <code>submission</code>, <code>assignment\_visibility</code>, <code>overrides</code>, <code>observed\_users</code>, <code>can\_edit</code>, <code>score\_statistics</code>, <code>ab\_guid</code>, <code>peer\_review</code>, <code>academic\_integrity\_pledge</code></p> |
| `override_assignment_dates`      | `boolean` | Apply assignment overrides to the assignment, defaults to true.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `needs_grading_count_by_section` | `boolean` | Split up "needs\_grading\_count" by sections into the "needs\_grading\_count\_by\_section" key, defaults to false                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `all_dates`                      | `boolean` | All dates associated with the assignment, if applicable                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

Returns an [Assignment](#assignment) object.

## [Create an assignment](#method.assignments_api.create) <a href="#method.assignments_api.create" id="method.assignments_api.create"></a>

[AssignmentsApiController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignments_api_controller.rb)

#### `POST /api/v1/courses/:course_id/assignments`

**Scope:** `url:POST|/api/v1/courses/:course_id/assignments`

Create a new assignment for this course. The assignment is created in the active state.

#### Request Parameters:

| Parameter                                           | Type                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `assignment[name]`                                  | Required `string`    | The assignment name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `assignment[position]`                              | `integer`            | <p>The position of this assignment in the group when displaying<br>assignment lists.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `assignment[submission_types][]`                    | `string`             | <p>List of supported submission types for the assignment.<br>Unless the assignment is allowing online submissions, the array should<br>only have one element.<br>If not allowing online submissions, your options are:<br>"online\_quiz"<br>"none"<br>"on\_paper"<br>"discussion\_topic"<br>"external\_tool"<br>If you are allowing online submissions, you can have one or many<br>allowed submission types:<br>"online\_upload"<br>"online\_text\_entry"<br>"online\_url"<br>"media\_recording" (Only valid when the Kaltura plugin is enabled)<br>"student\_annotation" Allowed values: <code>online\_quiz</code>, <code>none</code>, <code>on\_paper</code>, <code>discussion\_topic</code>, <code>external\_tool</code>, <code>online\_upload</code>, <code>online\_text\_entry</code>, <code>online\_url</code>, <code>media\_recording</code>, <code>student\_annotation</code></p> |
| `assignment[allowed_extensions][]`                  | `string`             | <p>Allowed extensions if submission\_types includes "online\_upload"<br>Example:<br>allowed\_extensions: \["docx","ppt"]</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `assignment[turnitin_enabled]`                      | `boolean`            | <p>Only applies when the Turnitin plugin is enabled for a course and<br>the submission\_types array includes "online\_upload".<br>Toggles Turnitin submissions for the assignment.<br>Will be ignored if Turnitin is not available for the course.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `assignment[vericite_enabled]`                      | `boolean`            | <p>Only applies when the VeriCite plugin is enabled for a course and<br>the submission\_types array includes "online\_upload".<br>Toggles VeriCite submissions for the assignment.<br>Will be ignored if VeriCite is not available for the course.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `assignment[turnitin_settings]`                     | `string`             | <p>Settings to send along to turnitin. See Assignment object definition for<br>format.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `assignment[integration_data]`                      | `string`             | Data used for SIS integrations. Requires admin-level token with the "Manage SIS" permission. JSON string required.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `assignment[integration_id]`                        | `string`             | Unique ID from third party integrations                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `assignment[peer_reviews]`                          | `boolean`            | <p>If submission\_types does not include external\_tool,discussion\_topic,<br>online\_quiz, or on\_paper, determines whether or not peer reviews<br>will be turned on for the assignment.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `assignment[automatic_peer_reviews]`                | `boolean`            | <p>Whether peer reviews will be assigned automatically by Canvas or if<br>teachers must manually assign peer reviews. Does not apply if peer reviews<br>are not enabled.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `assignment[notify_of_update]`                      | `boolean`            | <p>If true, Canvas will send a notification to students in the class<br>notifying them that the content has changed.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `assignment[group_category_id]`                     | `integer`            | <p>If present, the assignment will become a group assignment assigned<br>to the group.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `assignment[grade_group_students_individually]`     | `integer`            | <p>If this is a group assignment, teachers have the options to grade<br>students individually. If false, Canvas will apply the assignment's<br>score to each member of the group. If true, the teacher can manually<br>assign scores to each member of the group.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `assignment[external_tool_tag_attributes]`          | `string`             | <p>Hash of external tool parameters if submission\_types is \["external\_tool"].<br>See Assignment object definition for format.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `assignment[points_possible]`                       | `number`             | The maximum points possible on the assignment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `assignment[grading_type]`                          | `string`             | <p>The strategy used for grading the assignment.<br>The assignment defaults to "points" if this field is omitted. Allowed values: <code>pass\_fail</code>, <code>percent</code>, <code>letter\_grade</code>, <code>gpa\_scale</code>, <code>points</code>, <code>not\_graded</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `assignment[due_at]`                                | `DateTime`           | <p>The day/time the assignment is due. Must be between the lock dates if there are lock dates.<br>Accepts times in ISO 8601 format, e.g. 2014-10-21T18:48:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `assignment[lock_at]`                               | `DateTime`           | <p>The day/time the assignment is locked after. Must be after the due date if there is a due date.<br>Accepts times in ISO 8601 format, e.g. 2014-10-21T18:48:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `assignment[unlock_at]`                             | `DateTime`           | <p>The day/time the assignment is unlocked. Must be before the due date if there is a due date.<br>Accepts times in ISO 8601 format, e.g. 2014-10-21T18:48:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `assignment[description]`                           | `string`             | The assignment's description, supports HTML.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `assignment[assignment_group_id]`                   | `integer`            | <p>The assignment group id to put the assignment in.<br>Defaults to the top assignment group in the course.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `assignment[assignment_overrides][]`                | `AssignmentOverride` | List of overrides for the assignment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `assignment[only_visible_to_overrides]`             | `boolean`            | <p>Whether this assignment is only visible to overrides<br>(Only useful if 'differentiated assignments' account setting is on)</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `assignment[published]`                             | `boolean`            | <p>Whether this assignment is published.<br>(Only useful if 'draft state' account setting is on)<br>Unpublished assignments are not visible to students.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `assignment[grading_standard_id]`                   | `integer`            | <p>The grading standard id to set for the course. If no value is provided for this argument the current grading\_standard will be un-set from this course.<br>This will update the grading\_type for the course to 'letter\_grade' unless it is already 'gpa\_scale'.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `assignment[omit_from_final_grade]`                 | `boolean`            | Whether this assignment is counted towards a student's final grade.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `assignment[hide_in_gradebook]`                     | `boolean`            | Whether this assignment is shown in the gradebook.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `assignment[quiz_lti]`                              | `boolean`            | <p>Whether this assignment should use the Quizzes 2 LTI tool. Sets the<br>submission type to 'external\_tool' and configures the external tool<br>attributes to use the Quizzes 2 LTI tool configured for this course.<br>Has no effect if no Quizzes 2 LTI tool is configured.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `assignment[moderated_grading]`                     | `boolean`            | Whether this assignment is moderated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `assignment[grader_count]`                          | `integer`            | <p>The maximum number of provisional graders who may issue grades for this<br>assignment. Only relevant for moderated assignments. Must be a positive<br>value, and must be set to 1 if the course has fewer than two active<br>instructors. Otherwise, the maximum value is the number of active<br>instructors in the course minus one, or 10 if the course has more than 11<br>active instructors.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `assignment[final_grader_id]`                       | `integer`            | <p>The user ID of the grader responsible for choosing final grades for this<br>assignment. Only relevant for moderated assignments.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `assignment[grader_comments_visible_to_graders]`    | `boolean`            | <p>Boolean indicating if provisional graders' comments are visible to other<br>provisional graders. Only relevant for moderated assignments.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `assignment[graders_anonymous_to_graders]`          | `boolean`            | <p>Boolean indicating if provisional graders' identities are hidden from<br>other provisional graders. Only relevant for moderated assignments.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `assignment[graders_names_visible_to_final_grader]` | `boolean`            | <p>Boolean indicating if provisional grader identities are visible to the<br>the final grader. Only relevant for moderated assignments.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `assignment[anonymous_grading]`                     | `boolean`            | <p>Boolean indicating if the assignment is graded anonymously. If true,<br>graders cannot see student identities.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `assignment[allowed_attempts]`                      | `integer`            | The number of submission attempts allowed for this assignment. Set to -1 for unlimited attempts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `assignment[annotatable_attachment_id]`             | `integer`            | <p>The Attachment ID of the document being annotated.<br>Only applies when submission\_types includes "student\_annotation".</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `assignment[asset_processors][]`                    | `Array`              | <p>Document processors for this assignment. New document processors can only be added<br>via the interactive LTI Deep Linking flow (in a browser), not via API token or JWT authentication.<br>Deletion of document processors (passing an empty array) is allowed via API.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `assignment[peer_review][points_possible]`          | `number`             | The maximum points possible for peer reviews.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `assignment[peer_review][grading_type]`             | `string`             | <p>The strategy used for grading peer reviews.<br>Defaults to "points" if this field is omitted. Allowed values: <code>pass\_fail</code>, <code>percent</code>, <code>letter\_grade</code>, <code>gpa\_scale</code>, <code>points</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `assignment[peer_review][due_at]`                   | `DateTime`           | <p>The day/time the peer reviews are due. Must be between the lock dates if there are lock dates.<br>Accepts times in ISO 8601 format, e.g. 2025-08-20T12:10:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `assignment[peer_review][lock_at]`                  | `DateTime`           | <p>The day/time the peer reviews are locked after. Must be after the due date if there is a due date.<br>Accepts times in ISO 8601 format, e.g. 2025-08-25T12:10:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `assignment[peer_review][unlock_at]`                | `DateTime`           | <p>The day/time the peer reviews are unlocked. Must be before the due date if there is a due date.<br>Accepts times in ISO 8601 format, e.g. 2025-08-15T12:10:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `assignment[peer_review][peer_review_overrides][]`  | `AssignmentOverride` | List of overrides for the peer reviews.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

Returns an [Assignment](#assignment) object.

## [Edit an assignment](#method.assignments_api.update) <a href="#method.assignments_api.update" id="method.assignments_api.update"></a>

[AssignmentsApiController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignments_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/assignments/:id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/assignments/:id`

Modify an existing assignment.

#### Request Parameters:

| Parameter                                           | Type                 | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| --------------------------------------------------- | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `assignment[name]`                                  | `string`             | The assignment name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `assignment[position]`                              | `integer`            | <p>The position of this assignment in the group when displaying<br>assignment lists.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `assignment[submission_types][]`                    | `string`             | <p>Only applies if the assignment doesn't have student submissions.<br>List of supported submission types for the assignment.<br>Unless the assignment is allowing online submissions, the array should<br>only have one element.<br>If not allowing online submissions, your options are:<br>"online\_quiz"<br>"none"<br>"on\_paper"<br>"discussion\_topic"<br>"external\_tool"<br>If you are allowing online submissions, you can have one or many<br>allowed submission types:<br>"online\_upload"<br>"online\_text\_entry"<br>"online\_url"<br>"media\_recording" (Only valid when the Kaltura plugin is enabled)<br>"student\_annotation" Allowed values: <code>online\_quiz</code>, <code>none</code>, <code>on\_paper</code>, <code>discussion\_topic</code>, <code>external\_tool</code>, <code>online\_upload</code>, <code>online\_text\_entry</code>, <code>online\_url</code>, <code>media\_recording</code>, <code>student\_annotation</code></p> |
| `assignment[allowed_extensions][]`                  | `string`             | <p>Allowed extensions if submission\_types includes "online\_upload"<br>Example:<br>allowed\_extensions: \["docx","ppt"]</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `assignment[turnitin_enabled]`                      | `boolean`            | <p>Only applies when the Turnitin plugin is enabled for a course and<br>the submission\_types array includes "online\_upload".<br>Toggles Turnitin submissions for the assignment.<br>Will be ignored if Turnitin is not available for the course.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `assignment[vericite_enabled]`                      | `boolean`            | <p>Only applies when the VeriCite plugin is enabled for a course and<br>the submission\_types array includes "online\_upload".<br>Toggles VeriCite submissions for the assignment.<br>Will be ignored if VeriCite is not available for the course.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `assignment[turnitin_settings]`                     | `string`             | <p>Settings to send along to turnitin. See Assignment object definition for<br>format.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `assignment[sis_assignment_id]`                     | `string`             | The sis id of the Assignment                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `assignment[integration_data]`                      | `string`             | Data used for SIS integrations. Requires admin-level token with the "Manage SIS" permission. JSON string required.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `assignment[integration_id]`                        | `string`             | Unique ID from third party integrations                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `assignment[peer_reviews]`                          | `boolean`            | <p>If submission\_types does not include external\_tool,discussion\_topic,<br>online\_quiz, or on\_paper, determines whether or not peer reviews<br>will be turned on for the assignment.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `assignment[automatic_peer_reviews]`                | `boolean`            | <p>Whether peer reviews will be assigned automatically by Canvas or if<br>teachers must manually assign peer reviews. Does not apply if peer reviews<br>are not enabled.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `assignment[notify_of_update]`                      | `boolean`            | <p>If true, Canvas will send a notification to students in the class<br>notifying them that the content has changed.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `assignment[group_category_id]`                     | `integer`            | <p>If present, the assignment will become a group assignment assigned<br>to the group.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `assignment[grade_group_students_individually]`     | `integer`            | <p>If this is a group assignment, teachers have the options to grade<br>students individually. If false, Canvas will apply the assignment's<br>score to each member of the group. If true, the teacher can manually<br>assign scores to each member of the group.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `assignment[external_tool_tag_attributes]`          | `string`             | <p>Hash of external tool parameters if submission\_types is \["external\_tool"].<br>See Assignment object definition for format.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `assignment[points_possible]`                       | `number`             | The maximum points possible on the assignment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `assignment[grading_type]`                          | `string`             | <p>The strategy used for grading the assignment.<br>The assignment defaults to "points" if this field is omitted. Allowed values: <code>pass\_fail</code>, <code>percent</code>, <code>letter\_grade</code>, <code>gpa\_scale</code>, <code>points</code>, <code>not\_graded</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `assignment[due_at]`                                | `DateTime`           | <p>The day/time the assignment is due.<br>Accepts times in ISO 8601 format, e.g. 2014-10-21T18:48:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `assignment[lock_at]`                               | `DateTime`           | <p>The day/time the assignment is locked after. Must be after the due date if there is a due date.<br>Accepts times in ISO 8601 format, e.g. 2014-10-21T18:48:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `assignment[unlock_at]`                             | `DateTime`           | <p>The day/time the assignment is unlocked. Must be before the due date if there is a due date.<br>Accepts times in ISO 8601 format, e.g. 2014-10-21T18:48:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `assignment[description]`                           | `string`             | The assignment's description, supports HTML.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `assignment[assignment_group_id]`                   | `integer`            | <p>The assignment group id to put the assignment in.<br>Defaults to the top assignment group in the course.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `assignment[assignment_overrides][]`                | `AssignmentOverride` | <p>List of overrides for the assignment.<br>If the +assignment\[assignment\_overrides]+ key is absent, any existing<br>overrides are kept as is. If the +assignment\[assignment\_overrides]+ key is<br>present, existing overrides are updated or deleted (and new ones created,<br>as necessary) to match the provided list.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `assignment[only_visible_to_overrides]`             | `boolean`            | <p>Whether this assignment is only visible to overrides<br>(Only useful if 'differentiated assignments' account setting is on)</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `assignment[published]`                             | `boolean`            | <p>Whether this assignment is published.<br>(Only useful if 'draft state' account setting is on)<br>Unpublished assignments are not visible to students.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `assignment[grading_standard_id]`                   | `integer`            | <p>The grading standard id to set for the course. If no value is provided for this argument the current grading\_standard will be un-set from this course.<br>This will update the grading\_type for the course to 'letter\_grade' unless it is already 'gpa\_scale'.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `assignment[omit_from_final_grade]`                 | `boolean`            | Whether this assignment is counted towards a student's final grade.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `assignment[hide_in_gradebook]`                     | `boolean`            | Whether this assignment is shown in the gradebook.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `assignment[moderated_grading]`                     | `boolean`            | Whether this assignment is moderated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `assignment[grader_count]`                          | `integer`            | <p>The maximum number of provisional graders who may issue grades for this<br>assignment. Only relevant for moderated assignments. Must be a positive<br>value, and must be set to 1 if the course has fewer than two active<br>instructors. Otherwise, the maximum value is the number of active<br>instructors in the course minus one, or 10 if the course has more than 11<br>active instructors.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `assignment[final_grader_id]`                       | `integer`            | <p>The user ID of the grader responsible for choosing final grades for this<br>assignment. Only relevant for moderated assignments.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `assignment[grader_comments_visible_to_graders]`    | `boolean`            | <p>Boolean indicating if provisional graders' comments are visible to other<br>provisional graders. Only relevant for moderated assignments.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `assignment[graders_anonymous_to_graders]`          | `boolean`            | <p>Boolean indicating if provisional graders' identities are hidden from<br>other provisional graders. Only relevant for moderated assignments.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `assignment[graders_names_visible_to_final_grader]` | `boolean`            | <p>Boolean indicating if provisional grader identities are visible to the<br>the final grader. Only relevant for moderated assignments.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `assignment[anonymous_grading]`                     | `boolean`            | <p>Boolean indicating if the assignment is graded anonymously. If true,<br>graders cannot see student identities.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `assignment[allowed_attempts]`                      | `integer`            | <p>The number of submission attempts allowed for this assignment. Set to -1 or null for<br>unlimited attempts.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `assignment[annotatable_attachment_id]`             | `integer`            | <p>The Attachment ID of the document being annotated.<br>Only applies when submission\_types includes "student\_annotation".</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `assignment[asset_processors][]`                    | `Array`              | <p>Document processors for this assignment. New document processors can only be added<br>via the interactive LTI Deep Linking flow (in a browser), not via API token or JWT authentication.<br>Deletion of document processors (passing an empty array) is allowed via API.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `assignment[force_updated_at]`                      | `boolean`            | If true, updated\_at will be set even if no changes were made.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `assignment[peer_review][points_possible]`          | `number`             | The maximum points possible for peer reviews.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `assignment[peer_review][grading_type]`             | `string`             | <p>The strategy used for grading peer reviews.<br>Defaults to "points" if this field is omitted. Allowed values: <code>pass\_fail</code>, <code>percent</code>, <code>letter\_grade</code>, <code>gpa\_scale</code>, <code>points</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `assignment[peer_review][due_at]`                   | `DateTime`           | <p>The day/time the peer reviews are due. Must be between the lock dates if there are lock dates.<br>Accepts times in ISO 8601 format, e.g. 2025-08-20T12:10:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `assignment[peer_review][lock_at]`                  | `DateTime`           | <p>The day/time the peer reviews are locked after. Must be after the due date if there is a due date.<br>Accepts times in ISO 8601 format, e.g. 2025-08-25T12:10:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `assignment[peer_review][unlock_at]`                | `DateTime`           | <p>The day/time the peer reviews are unlocked. Must be before the due date if there is a due date.<br>Accepts times in ISO 8601 format, e.g. 2025-08-15T12:10:00Z.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `assignment[peer_review][peer_review_overrides][]`  | `AssignmentOverride` | <p>List of overrides for the peer reviews.<br>When updating overrides:<br>- Include "id" to update an existing override<br>- Omit "id" to create a new override<br>- Omit an override from the list to delete it</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `assignment[submission_types][]`                    | `string`             | **\[DEPRECATED]** Effective 2021-05-26 (notice given 2021-02-18) Only applies if the assignment doesn't have student submissions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

Returns an [Assignment](#assignment) object.

## [Bulk update assignment dates](#method.assignments_api.bulk_update) <a href="#method.assignments_api.bulk_update" id="method.assignments_api.bulk_update"></a>

[AssignmentsApiController#bulk\_update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignments_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/assignments/bulk_update`

**Scope:** `url:PUT|/api/v1/courses/:course_id/assignments/bulk_update`

Update due dates and availability dates for multiple assignments in a course.

Accepts a JSON array of objects containing two keys each: +id+, the assignment id, and +all\_dates+, an array of +AssignmentDate+ structures containing the base and/or override dates for the assignment, as returned from the [List assignments](#method.assignments_api.index) endpoint with +include\[]=all\_dates+.

This endpoint cannot create or destroy assignment overrides; any existing assignment overrides that are not referenced in the arguments will be left alone. If an override is given, any dates that are not supplied with it will be defaulted. To clear a date, specify null explicitly.

All referenced assignments will be validated before any are saved. A list of errors will be returned if any provided dates are invalid, and no changes will be saved.

The bulk update is performed in a background job, use the [Progress API](https://developerdocs.instructure.com/services/canvas/resources/pages/3xnEhMZQuJstdXB8KHiv#method.progress.show) to check its status.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/1/assignments/bulk_update' \
     -X PUT \
     --data '[{
           "id": 1,
           "all_dates": [{
             "base": true,
             "due_at": "2020-08-29T23:59:00-06:00"
           }, {
             "id": 2,
             "due_at": "2020-08-30T23:59:00-06:00"
           }]
         }]' \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer <token>"
```

Returns a [Progress](/services/canvas/resources/progress#progress) object.

## [List assignment overrides](#method.assignment_overrides.index) <a href="#method.assignment_overrides.index" id="method.assignment_overrides.index"></a>

[AssignmentOverridesController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_overrides_controller.rb)

#### `GET /api/v1/courses/:course_id/assignments/:assignment_id/overrides`

**Scope:** `url:GET|/api/v1/courses/:course_id/assignments/:assignment_id/overrides`

Returns the paginated list of overrides for this assignment that target sections/groups/students visible to the current user.

Returns a list of [AssignmentOverride](#assignmentoverride) objects.

## [Get a single assignment override](#method.assignment_overrides.show) <a href="#method.assignment_overrides.show" id="method.assignment_overrides.show"></a>

[AssignmentOverridesController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_overrides_controller.rb)

#### `GET /api/v1/courses/:course_id/assignments/:assignment_id/overrides/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/assignments/:assignment_id/overrides/:id`

Returns details of the the override with the given id.

Returns an [AssignmentOverride](#assignmentoverride) object.

## [Redirect to the assignment override for a group](#method.assignment_overrides.group_alias) <a href="#method.assignment_overrides.group_alias" id="method.assignment_overrides.group_alias"></a>

[AssignmentOverridesController#group\_alias](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_overrides_controller.rb)

#### `GET /api/v1/groups/:group_id/assignments/:assignment_id/override`

**Scope:** `url:GET|/api/v1/groups/:group_id/assignments/:assignment_id/override`

Responds with a redirect to the override for the given group, if any (404 otherwise).

## [Redirect to the assignment override for a section](#method.assignment_overrides.section_alias) <a href="#method.assignment_overrides.section_alias" id="method.assignment_overrides.section_alias"></a>

[AssignmentOverridesController#section\_alias](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_overrides_controller.rb)

#### `GET /api/v1/sections/:course_section_id/assignments/:assignment_id/override`

**Scope:** `url:GET|/api/v1/sections/:course_section_id/assignments/:assignment_id/override`

Responds with a redirect to the override for the given section, if any (404 otherwise).

## [Create an assignment override](#method.assignment_overrides.create) <a href="#method.assignment_overrides.create" id="method.assignment_overrides.create"></a>

[AssignmentOverridesController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_overrides_controller.rb)

#### `POST /api/v1/courses/:course_id/assignments/:assignment_id/overrides`

**Scope:** `url:POST|/api/v1/courses/:course_id/assignments/:assignment_id/overrides`

One of student\_ids, group\_id, or course\_section\_id must be present. At most one should be present; if multiple are present only the most specific (student\_ids first, then group\_id, then course\_section\_id) is used and any others are ignored.

#### Request Parameters:

| Parameter                                | Type       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ---------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `assignment_override[student_ids][]`     | `integer`  | <p>The IDs of<br>the override's target students. If present, the IDs must each identify a<br>user with an active student enrollment in the course that is not already<br>targetted by a different adhoc override.</p>                                                                                                                                                                                                                                                     |
| `assignment_override[title]`             | `string`   | <p>The title of the adhoc<br>assignment override. Required if student\_ids is present, ignored<br>otherwise (the title is set to the name of the targetted group or section<br>instead).</p>                                                                                                                                                                                                                                                                              |
| `assignment_override[group_id]`          | `integer`  | <p>The ID of the<br>override's target group. If present, the following conditions must be met<br>for the override to be successful:<br>1. the assignment MUST be a group assignment (a group\_category\_id is assigned to it)<br>2. the ID must identify an active group in the group set the assignment is in<br>3. the ID must not be targetted by a different override<br>See <a href="#Group+assignments-appendix">Appendix: Group assignments</a> for more info.</p> |
| `assignment_override[course_section_id]` | `integer`  | <p>The ID<br>of the override's target section. If present, must identify an active<br>section of the assignment's course not already targetted by a different<br>override.</p>                                                                                                                                                                                                                                                                                            |
| `assignment_override[due_at]`            | `DateTime` | <p>The day/time<br>the overridden assignment is due. Accepts times in ISO 8601 format, e.g.<br>2014-10-21T18:48:00Z. If absent, this override will not affect due date.<br>May be present but null to indicate the override removes any previous due<br>date.</p>                                                                                                                                                                                                         |
| `assignment_override[unlock_at]`         | `DateTime` | <p>The day/time<br>the overridden assignment becomes unlocked. Accepts times in ISO 8601<br>format, e.g. 2014-10-21T18:48:00Z. If absent, this override will not<br>affect the unlock date. May be present but null to indicate the override<br>removes any previous unlock date.</p>                                                                                                                                                                                     |
| `assignment_override[lock_at]`           | `DateTime` | <p>The day/time<br>the overridden assignment becomes locked. Accepts times in ISO 8601<br>format, e.g. 2014-10-21T18:48:00Z. If absent, this override will not<br>affect the lock date. May be present but null to indicate the override<br>removes any previous lock date.</p>                                                                                                                                                                                           |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/1/assignments/2/overrides.json' \
     -X POST \
     -F 'assignment_override[student_ids][]=8' \
     -F 'assignment_override[title]=Fred Flinstone' \
     -F 'assignment_override[due_at]=2012-10-08T21:00:00Z' \
     -H "Authorization: Bearer <token>"
```

Returns an [AssignmentOverride](#assignmentoverride) object.

## [Update an assignment override](#method.assignment_overrides.update) <a href="#method.assignment_overrides.update" id="method.assignment_overrides.update"></a>

[AssignmentOverridesController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_overrides_controller.rb)

#### `PUT /api/v1/courses/:course_id/assignments/:assignment_id/overrides/:id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/assignments/:assignment_id/overrides/:id`

All current overridden values must be supplied if they are to be retained; e.g. if due\_at was overridden, but this PUT omits a value for due\_at, due\_at will no longer be overridden. If the override is adhoc and student\_ids is not supplied, the target override set is unchanged. Target override sets cannot be changed for group or section overrides.

#### Request Parameters:

| Parameter                            | Type       | Description                                                                                                                                                                                                                                                                           |
| ------------------------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `assignment_override[student_ids][]` | `integer`  | <p>The IDs of the<br>override's target students. If present, the IDs must each identify a<br>user with an active student enrollment in the course that is not already<br>targetted by a different adhoc override. Ignored unless the override<br>being updated is adhoc.</p>          |
| `assignment_override[title]`         | `string`   | <p>The title of an adhoc<br>assignment override. Ignored unless the override being updated is adhoc.</p>                                                                                                                                                                              |
| `assignment_override[due_at]`        | `DateTime` | <p>The day/time<br>the overridden assignment is due. Accepts times in ISO 8601 format, e.g.<br>2014-10-21T18:48:00Z. If absent, this override will not affect due date.<br>May be present but null to indicate the override removes any previous due<br>date.</p>                     |
| `assignment_override[unlock_at]`     | `DateTime` | <p>The day/time<br>the overridden assignment becomes unlocked. Accepts times in ISO 8601<br>format, e.g. 2014-10-21T18:48:00Z. If absent, this override will not<br>affect the unlock date. May be present but null to indicate the override<br>removes any previous unlock date.</p> |
| `assignment_override[lock_at]`       | `DateTime` | <p>The day/time<br>the overridden assignment becomes locked. Accepts times in ISO 8601<br>format, e.g. 2014-10-21T18:48:00Z. If absent, this override will not<br>affect the lock date. May be present but null to indicate the override<br>removes any previous lock date.</p>       |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/1/assignments/2/overrides/3.json' \
     -X PUT \
     -F 'assignment_override[title]=Fred Flinstone' \
     -F 'assignment_override[due_at]=2012-10-08T21:00:00Z' \
     -H "Authorization: Bearer <token>"
```

Returns an [AssignmentOverride](#assignmentoverride) object.

## [Delete an assignment override](#method.assignment_overrides.destroy) <a href="#method.assignment_overrides.destroy" id="method.assignment_overrides.destroy"></a>

[AssignmentOverridesController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_overrides_controller.rb)

#### `DELETE /api/v1/courses/:course_id/assignments/:assignment_id/overrides/:id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/assignments/:assignment_id/overrides/:id`

Deletes an override and returns its former details.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/1/assignments/2/overrides/3.json' \
     -X DELETE \
     -H "Authorization: Bearer <token>"
```

Returns an [AssignmentOverride](#assignmentoverride) object.

## [Batch retrieve overrides in a course](#method.assignment_overrides.batch_retrieve) <a href="#method.assignment_overrides.batch_retrieve" id="method.assignment_overrides.batch_retrieve"></a>

[AssignmentOverridesController#batch\_retrieve](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_overrides_controller.rb)

#### `GET /api/v1/courses/:course_id/assignments/overrides`

**Scope:** `url:GET|/api/v1/courses/:course_id/assignments/overrides`

Returns a list of specified overrides in this course, providing they target sections/groups/students visible to the current user. Returns null elements in the list for requests that were not found.

#### Request Parameters:

| Parameter                               | Type              | Description                          |
| --------------------------------------- | ----------------- | ------------------------------------ |
| `assignment_overrides[][id]`            | Required `string` | Ids of overrides to retrieve         |
| `assignment_overrides[][assignment_id]` | Required `string` | Ids of assignments for each override |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/12/assignments/overrides.json?assignment_overrides[][id]=109&assignment_overrides[][assignment_id]=122&assignment_overrides[][id]=99&assignment_overrides[][assignment_id]=111' \
     -H "Authorization: Bearer <token>"
```

Returns a list of [AssignmentOverride](#assignmentoverride) objects.

## [Batch create overrides in a course](#method.assignment_overrides.batch_create) <a href="#method.assignment_overrides.batch_create" id="method.assignment_overrides.batch_create"></a>

[AssignmentOverridesController#batch\_create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_overrides_controller.rb)

#### `POST /api/v1/courses/:course_id/assignments/overrides`

**Scope:** `url:POST|/api/v1/courses/:course_id/assignments/overrides`

Creates the specified overrides for each assignment. Handles creation in a transaction, so all records are created or none are.

One of student\_ids, group\_id, or course\_section\_id must be present. At most one should be present; if multiple are present only the most specific (student\_ids first, then group\_id, then course\_section\_id) is used and any others are ignored.

Errors are reported in an errors attribute, an array of errors corresponding to inputs. Global errors will be reported as a single element errors array

#### Request Parameters:

| Parameter                | Type                          | Description                                                                                                                                                            |
| ------------------------ | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `assignment_overrides[]` | Required `AssignmentOverride` | <p>Attributes for the new assignment overrides.<br>See <a href="#method.assignment_overrides.create">Create an assignment override</a> for available<br>attributes</p> |

#### Example Request:

```bash
curl "https://<canvas>/api/v1/courses/12/assignments/overrides.json" \
     -X POST \
     -F "assignment_overrides[][assignment_id]=109" \
     -F 'assignment_overrides[][student_ids][]=8' \
     -F "assignment_overrides[][title]=foo" \
     -F "assignment_overrides[][assignment_id]=13" \
     -F "assignment_overrides[][course_section_id]=200" \
     -F "assignment_overrides[][due_at]=2012-10-08T21:00:00Z" \
     -H "Authorization: Bearer <token>"
```

Returns a list of [AssignmentOverride](#assignmentoverride) objects.

## [Batch update overrides in a course](#method.assignment_overrides.batch_update) <a href="#method.assignment_overrides.batch_update" id="method.assignment_overrides.batch_update"></a>

[AssignmentOverridesController#batch\_update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/assignment_overrides_controller.rb)

#### `PUT /api/v1/courses/:course_id/assignments/overrides`

**Scope:** `url:PUT|/api/v1/courses/:course_id/assignments/overrides`

Updates a list of specified overrides for each assignment. Handles overrides in a transaction, so either all updates are applied or none. See [Update an assignment override](#method.assignment_overrides.update) for available attributes.

All current overridden values must be supplied if they are to be retained; e.g. if due\_at was overridden, but this PUT omits a value for due\_at, due\_at will no longer be overridden. If the override is adhoc and student\_ids is not supplied, the target override set is unchanged. Target override sets cannot be changed for group or section overrides.

Errors are reported in an errors attribute, an array of errors corresponding to inputs. Global errors will be reported as a single element errors array

#### Request Parameters:

| Parameter                | Type                          | Description                           |
| ------------------------ | ----------------------------- | ------------------------------------- |
| `assignment_overrides[]` | Required `AssignmentOverride` | Attributes for the updated overrides. |

#### Example Request:

```bash
curl "https://<canvas>/api/v1/courses/12/assignments/overrides.json" \
     -X PUT \
     -F "assignment_overrides[][id]=122" \
     -F "assignment_overrides[][assignment_id]=109" \
     -F "assignment_overrides[][title]=foo" \
     -F "assignment_overrides[][id]=993" \
     -F "assignment_overrides[][assignment_id]=13" \
     -F "assignment_overrides[][due_at]=2012-10-08T21:00:00Z" \
     -H "Authorization: Bearer <token>"
```

Returns a list of [AssignmentOverride](#assignmentoverride) objects.

## Appendixes

### Appendix: Group assignments <a href="#groupassignments-appendix" id="groupassignments-appendix"></a>

The following diagram provides an example to describe the structure of group assignments. It also shows the correspondence between the fields of an assignment override API request and the resources they map to.

![Group assignments structure example](/files/zTTzPiM5or9k2qvMEEXx)

The components in yellow are *group sets*. When creating or updating an assignment override, you will refer to the group set by the `group_category_id` field.

The components in green are *groups*. An assignment can become a group assignment iff it has a `group_category_id` that maps to an active group set, as well as a `group_id` that maps to an active, valid group. In the API, you will be specifying the group by the `group_id` field of the `assignment_override` construct.

**Important**: an assignment must be assigned to a group set (the `group_category_id` field) on **creation** for an override with a `group_id` to be effective.

**See Also:**

* [Creating an assignment override](#method.assignment_overrides.create)
* [Creating an assignment](#method.assignments_api.create)
* [Assignment](#Assignment)

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Authentication Providers

#### An AuthenticationProvider object looks like: <a href="#authenticationprovider" id="authenticationprovider"></a>

```js
{
  // Valid for SAML providers.
  "identifier_format": "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress",
  // Valid for all providers.
  "auth_type": "saml",
  // Valid for all providers.
  "id": 1649,
  // Valid for SAML providers.
  "log_out_url": "http://example.com/saml1/slo",
  // Valid for SAML and CAS providers.
  "log_in_url": "http://example.com/saml1/sli",
  // Valid for SAML providers.
  "certificate_fingerprint": "111222",
  // Valid for SAML providers.
  "requested_authn_context": null,
  // Valid for LDAP providers.
  "auth_host": "127.0.0.1",
  // Valid for LDAP providers.
  "auth_filter": "filter1",
  // Valid for LDAP providers.
  "auth_over_tls": null,
  // Valid for LDAP and CAS providers.
  "auth_base": null,
  // Valid for LDAP providers.
  "auth_username": "username1",
  // Valid for LDAP providers.
  "auth_port": null,
  // Valid for all providers.
  "position": 1,
  // Valid for SAML providers.
  "idp_entity_id": "http://example.com/saml1",
  // Valid for SAML providers.
  "login_attribute": "nameid",
  // Valid for SAML providers.
  "sig_alg": "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
  // Just In Time provisioning. Valid for all providers except Canvas (which has
  // the similar in concept self_registration setting).
  "jit_provisioning": null,
  "federated_attributes": null,
  // If multi-factor authentication is required when logging in with this
  // authentication provider. The account must not have MFA disabled.
  "mfa_required": null
}
```

#### A SSOSettings object looks like: <a href="#ssosettings" id="ssosettings"></a>

```js
// Settings that are applicable across an account's authentication
// configuration, even if there are multiple individual providers
{
  // The label used for unique login identifiers.
  "login_handle_name": "Username",
  // The url to redirect users to for password resets. Leave blank for default
  // Canvas behavior
  "change_password_url": "https://example.com/reset_password",
  // If a discovery url is set, canvas will forward all users to that URL when
  // they need to be authenticated. That page will need to then help the user
  // figure out where they need to go to log in. If no discovery url is
  // configured, the first configuration will be used to attempt to authenticate
  // the user.
  "auth_discovery_url": "https://example.com/which_account",
  // If an unknown user url is set, Canvas will forward to that url when a service
  // authenticates a user, but that user does not exist in Canvas. The default
  // behavior is to present an error.
  "unknown_user_url": "https://example.com/register_for_canvas",
  // A login help URL shown as a 'Trouble logging in?' link on the login page and
  // in failed login messages. Falls back to the global setting if not set.
  "login_help_url": "https://example.com/login-help",
  // The SAML Service Provider entity ID Canvas presents to your IdP. May be a URL
  // or a URN. Defaults to <host>/saml2 if not set. Only settable by site admins,
  // and only returned when a SAML provider is configured.
  "saml_entity_id": "http://example.com/saml2"
}
```

#### A FederatedAttributesConfig object looks like: <a href="#federatedattributesconfig" id="federatedattributesconfig"></a>

```js
// A mapping of Canvas attribute names to attribute names that a provider may
// send, in order to update the value of these attributes when a user logs in.
// The values can be a FederatedAttributeConfig, or a raw string corresponding
// to the "attribute" property of a FederatedAttributeConfig. In responses, full
// FederatedAttributeConfig objects are returned if JIT provisioning is enabled,
// otherwise just the attribute names are returned.
{
  // A comma separated list of role names to grant to the user. Note that these
  // only apply at the root account level, and not sub-accounts. If the attribute
  // is not marked for provisioning only, the user will also be removed from any
  // other roles they currently hold that are not still specified by the IdP.
  "admin_roles": null,
  // The full display name of the user
  "display_name": null,
  // The user's e-mail address
  "email": null,
  // The first, or given, name of the user
  "given_name": null,
  // The secondary unique identifier for SIS purposes
  "integration_id": null,
  // The user's preferred locale/language
  "locale": null,
  // The full name of the user
  "name": null,
  // The unique SIS identifier
  "sis_user_id": null,
  // The full name of the user for sorting purposes
  "sortable_name": null,
  // The surname, or last name, of the user
  "surname": null,
  // The user's preferred time zone
  "timezone": null
}
```

#### A FederatedAttributeConfig object looks like: <a href="#federatedattributeconfig" id="federatedattributeconfig"></a>

```js
// A single attribute name to be federated when a user logs in
{
  // The name of the attribute as it will be sent from the authentication provider
  "attribute": "mail",
  // If the attribute should be applied only when provisioning a new user, rather
  // than all logins
  "provisioning_only": false,
  // (only for email) If the email address is trusted and should be automatically
  // confirmed
  "autoconfirm": false
}
```

## [List authentication providers](#method.authentication_providers.index) <a href="#method.authentication_providers.index" id="method.authentication_providers.index"></a>

[AuthenticationProvidersController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_providers_controller.rb)

#### `GET /api/v1/accounts/:account_id/authentication_providers`

**Scope:** `url:GET|/api/v1/accounts/:account_id/authentication_providers`

Returns a paginated list of authentication providers

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/accounts/<account_id>/authentication_providers' \
     -H 'Authorization: Bearer <token>'
```

Returns a list of [AuthenticationProvider](#authenticationprovider) objects.

## [Get authentication provider](#method.authentication_providers.show) <a href="#method.authentication_providers.show" id="method.authentication_providers.show"></a>

[AuthenticationProvidersController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_providers_controller.rb)

#### `GET /api/v1/accounts/:account_id/authentication_providers/:id`

**Scope:** `url:GET|/api/v1/accounts/:account_id/authentication_providers/:id`

Get the specified authentication provider

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/accounts/<account_id>/authentication_providers/<id>' \
     -H 'Authorization: Bearer <token>'
```

Returns an [AuthenticationProvider](#authenticationprovider) object.

## [Add authentication provider](#method.authentication_providers.create) <a href="#method.authentication_providers.create" id="method.authentication_providers.create"></a>

[AuthenticationProvidersController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_providers_controller.rb)

#### `POST /api/v1/accounts/:account_id/authentication_providers`

**Scope:** `url:POST|/api/v1/accounts/:account_id/authentication_providers`

Add external authentication provider(s) for the account. Services may be Apple, CAS, Facebook, GitHub, Google, LDAP, LinkedIn, Microsoft, OpenID Connect, or SAML.

Each authentication provider is specified as a set of parameters as described below. A provider specification must include an 'auth\_type' parameter with a value of 'apple', 'canvas', 'cas', 'clever', 'facebook', 'github', 'google', 'ldap', 'linkedin', 'microsoft', 'openid\_connect', or 'saml'. The other recognized parameters depend on this auth\_type; unrecognized parameters are discarded. Provider specifications not specifying a valid auth\_type are ignored.

You can set the 'position' for any provider. The config in the 1st position is considered the default. You can set 'jit\_provisioning' for any provider besides Canvas. You can set 'mfa\_required' for any provider.

For Apple, the additional recognized parameters are:

* client\_id \[Required]

  The developer’s client identifier, as provided by WWDR. Not available if configured globally for Canvas.
* login\_attribute \[Optional]

  The attribute to use to look up the user's login in Canvas. Either 'sub' (the default), or 'email'
* federated\_attributes \[Optional]

  See FederatedAttributesConfig. Valid provider attributes are 'email', 'firstName', 'lastName', and 'sub'.

For Canvas, the additional recognized parameter is:

* self\_registration

  'all', 'none', or 'observer' - who is allowed to register as a new user

For CAS, the additional recognized parameters are:

* auth\_base

  The CAS server's URL.
* log\_in\_url \[Optional]

  An alternate SSO URL for logging into CAS. You probably should not set this.

For Clever, the additional recognized parameters are:

* client\_id \[Required]

  The Clever application's Client ID. Not available if configured globally for Canvas.
* client\_secret \[Required]

  The Clever application's Client Secret. Not available if configured globally for Canvas.
* district\_id \[Optional]

  A district's Clever ID. Leave this blank to let Clever handle the details with its District Picker. This is required for Clever Instant Login to work in a multi-tenant environment.
* login\_attribute \[Optional]

  The attribute to use to look up the user's login in Canvas. Either 'id' (the default), 'sis\_id', 'email', 'student\_number', or 'teacher\_number'. Note that some fields may not be populated for all users at Clever.
* federated\_attributes \[Optional]

  See FederatedAttributesConfig. Valid provider attributes are 'id', 'sis\_id', 'email', 'student\_number', and 'teacher\_number'.

For Facebook, the additional recognized parameters are:

* app\_id \[Required]

  The Facebook App ID. Not available if configured globally for Canvas.
* app\_secret \[Required]

  The Facebook App Secret. Not available if configured globally for Canvas.
* login\_attribute \[Optional]

  The attribute to use to look up the user's login in Canvas. Either 'id' (the default), or 'email'
* federated\_attributes \[Optional]

  See FederatedAttributesConfig. Valid provider attributes are 'email', 'first\_name', 'id', 'last\_name', 'locale', and 'name'.

For GitHub, the additional recognized parameters are:

* domain \[Optional]

  The domain of a GitHub Enterprise installation. I.e. github.mycompany.com. If not set, it will default to the public github.com.
* client\_id \[Required]

  The GitHub application's Client ID. Not available if configured globally for Canvas.
* client\_secret \[Required]

  The GitHub application's Client Secret. Not available if configured globally for Canvas.
* login\_attribute \[Optional]

  The attribute to use to look up the user's login in Canvas. Either 'id' (the default), or 'login'
* federated\_attributes \[Optional]

  See FederatedAttributesConfig. Valid provider attributes are 'email', 'id', 'login', and 'name'.

For Google, the additional recognized parameters are:

* client\_id \[Required]

  The Google application's Client ID. Not available if configured globally for Canvas.
* client\_secret \[Required]

  The Google application's Client Secret. Not available if configured globally for Canvas.
* hosted\_domain \[Optional]

  A Google Apps domain to restrict logins to. See <https://developers.google.com/identity/protocols/OpenIDConnect?hl=en#hd-param>
* login\_attribute \[Optional]

  The attribute to use to look up the user's login in Canvas. Either 'sub' (the default), or 'email'
* federated\_attributes \[Optional]

  See FederatedAttributesConfig. Valid provider attributes are 'email', 'family\_name', 'given\_name', 'locale', 'name', and 'sub'.

For LDAP, the additional recognized parameters are:

* auth\_host

  The LDAP server's URL.
* auth\_port \[Optional, Integer]

  The LDAP server's TCP port. (default: 389)
* auth\_over\_tls \[Optional]

  Whether to use TLS. Can be 'simple\_tls', or 'start\_tls'. For backwards compatibility, booleans are also accepted, with true meaning simple\_tls. If not provided, it will default to start\_tls.
* auth\_base \[Optional]

  A default treebase parameter for searches performed against the LDAP server.
* auth\_filter

  LDAP search filter. Use {{login}} as a placeholder for the username supplied by the user. For example: "(sAMAccountName={{login}})".
* identifier\_format \[Optional]

  The LDAP attribute to use to look up the Canvas login. Omit to use the username supplied by the user.
* auth\_username

  Username
* auth\_password

  Password

For LinkedIn, the additional recognized parameters are:

* client\_id \[Required]

  The LinkedIn application's Client ID. Not available if configured globally for Canvas.
* client\_secret \[Required]

  The LinkedIn application's Client Secret. Not available if configured globally for Canvas.
* login\_attribute \[Optional]

  The attribute to use to look up the user's login in Canvas. Either 'id' (the default), or 'emailAddress'
* federated\_attributes \[Optional]

  See FederatedAttributesConfig. Valid provider attributes are 'emailAddress', 'firstName', 'id', 'formattedName', and 'lastName'.

For Microsoft, the additional recognized parameters are:

* application\_id \[Required]

  The application's ID.
* application\_secret \[Required]

  The application's Client Secret (Password)
* tenant \[Optional]

  See <https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-protocols/> Valid values are 'common', 'organizations', 'consumers', or an Azure Active Directory Tenant (as either a UUID or domain, such as contoso.onmicrosoft.com). Defaults to 'common'
* login\_attribute \[Optional]

  See <https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-tokens/#idtokens> Valid values are 'sub', 'email', 'oid', or 'preferred\_username'. Note that email may not always be populated in the user's profile at Microsoft. Oid will not be populated for personal Microsoft accounts. Defaults to 'sub'
* federated\_attributes \[Optional]

  See FederatedAttributesConfig. Valid provider attributes are 'email', 'name', 'preferred\_username', 'oid', and 'sub'.

For OpenID Connect, the additional recognized parameters are:

* client\_id \[Required]

  The application's Client ID.
* client\_secret \[Required]

  The application's Client Secret.
* authorize\_url \[Required]

  The URL for getting starting the OAuth 2.0 web flow
* token\_url \[Required]

  The URL for exchanging the OAuth 2.0 authorization code for an Access Token and ID Token
* scope \[Optional]

  Space separated additional scopes to request for the token. Note that you need not specify the 'openid' scope, or any scopes that can be automatically inferred by the rules defined at <http://openid.net/specs/openid-connect-core-1\\_0.html#ScopeClaims>
* end\_session\_endpoint \[Optional]

  URL to send the end user to after logging out of Canvas. See <https://openid.net/specs/openid-connect-session-1\\_0.html#RPLogout>
* userinfo\_endpoint \[Optional]

  URL to request additional claims from. If the initial ID Token received from the provider cannot be used to satisfy the login\_attribute and all federated\_attributes, this endpoint will be queried for additional information.
* login\_attribute \[Optional]

  The attribute of the ID Token to look up the user's login in Canvas. Defaults to 'sub'.
* federated\_attributes \[Optional]

  See FederatedAttributesConfig. Any value is allowed for the provider attribute names, but standard claims are listed at <http://openid.net/specs/openid-connect-core-1\\_0.html#StandardClaims>

For SAML, the additional recognized parameters are:

* metadata \[Optional]

  An XML document to parse as SAML metadata, and automatically populate idp\_entity\_id, log\_in\_url, log\_out\_url, certificate\_fingerprint, and identifier\_format
* metadata\_uri \[Optional]

  A URI to download the SAML metadata from, and automatically populate idp\_entity\_id, log\_in\_url, log\_out\_url, certificate\_fingerprint, and identifier\_format. This URI will also be saved, and the metadata periodically refreshed, automatically. If the metadata contains multiple entities, also supply idp\_entity\_id to distinguish which one you want (otherwise the only entity in the metadata will be inferred). If you provide the URI 'urn:mace:incommon' or '<http://ukfederation.org.uk>', the InCommon or UK Access Management Federation metadata aggregate, respectively, will be used instead, and additional validation checks will happen (including validating that the metadata has been properly signed with the appropriate key).
* idp\_entity\_id

  The SAML IdP's entity ID
* log\_in\_url

  The SAML service's SSO target URL
* log\_out\_url \[Optional]

  The SAML service's SLO target URL
* certificate\_fingerprint

  The SAML service's certificate fingerprint.
* identifier\_format

  The SAML service's identifier format. Must be one of:

  * urn:oasis:names:flag\_tc:SAML:1.1:nameid-format:emailAddress
  * urn:oasis:names:flag\_tc:SAML:2.0:nameid-format:entity
  * urn:oasis:names:flag\_tc:SAML:2.0:nameid-format:kerberos
  * urn:oasis:names:flag\_tc:SAML:2.0:nameid-format:persistent
  * urn:oasis:names:flag\_tc:SAML:2.0:nameid-format:transient
  * urn:oasis:names:flag\_tc:SAML:1.1:nameid-format:unspecified
  * urn:oasis:names:flag\_tc:SAML:1.1:nameid-format:WindowsDomainQualifiedName
  * urn:oasis:names:flag\_tc:SAML:1.1:nameid-format:X509SubjectName
* requested\_authn\_context \[Optional]

  The SAML AuthnContext
* sig\_alg \[Optional]

  If set, +AuthnRequest+, +LogoutRequest+, and +LogoutResponse+ messages are signed with the corresponding algorithm. Supported algorithms are:

  * <http://www.w3.org/2000/09/xmldsig#rsa-sha1>
  * <http://www.w3.org/2001/04/xmldsig-more#rsa-sha256>

  RSA-SHA1 and RSA-SHA256 are acceptable aliases.
* federated\_attributes \[Optional]

  See FederatedAttributesConfig. Any value is allowed for the provider attribute names.

#### Example Request:

```bash
# Create LDAP config
curl 'https://<canvas>/api/v1/accounts/<account_id>/authentication_providers' \
     -F 'auth_type=ldap' \
     -F 'auth_host=ldap.mydomain.edu' \
     -F 'auth_filter=(sAMAccountName={{login}})' \
     -F 'auth_username=username' \
     -F 'auth_password=bestpasswordever' \
     -F 'position=1' \
     -H 'Authorization: Bearer <token>'
```

```bash
# Create SAML config
curl 'https://<canvas>/api/v1/accounts/<account_id>/authentication_providers' \
     -F 'auth_type=saml' \
     -F 'idp_entity_id=<idp_entity_id>' \
     -F 'log_in_url=<login_url>' \
     -F 'log_out_url=<logout_url>' \
     -F 'certificate_fingerprint=<fingerprint>' \
     -H 'Authorization: Bearer <token>'
```

```bash
# Create CAS config
curl 'https://<canvas>/api/v1/accounts/<account_id>/authentication_providers' \
     -F 'auth_type=cas' \
     -F 'auth_base=cas.mydomain.edu' \
     -F 'log_in_url=<login_url>' \
     -H 'Authorization: Bearer <token>'
```

Returns an [AuthenticationProvider](#authenticationprovider) object.

## [Update authentication provider](#method.authentication_providers.update) <a href="#method.authentication_providers.update" id="method.authentication_providers.update"></a>

[AuthenticationProvidersController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_providers_controller.rb)

#### `PUT /api/v1/accounts/:account_id/authentication_providers/:id`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/authentication_providers/:id`

Update an authentication provider using the same options as the [Add authentication provider](#method.authentication_providers.create) endpoint. You cannot update an existing provider to a new authentication type.

#### Example Request:

```bash
# update SAML config
curl -X PUT 'https://<canvas>/api/v1/accounts/<account_id>/authentication_providers/<id>' \
     -F 'idp_entity_id=<new_idp_entity_id>' \
     -F 'log_in_url=<new_url>' \
     -H 'Authorization: Bearer <token>'
```

Returns an [AuthenticationProvider](#authenticationprovider) object.

## [Delete authentication provider](#method.authentication_providers.destroy) <a href="#method.authentication_providers.destroy" id="method.authentication_providers.destroy"></a>

[AuthenticationProvidersController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_providers_controller.rb)

#### `DELETE /api/v1/accounts/:account_id/authentication_providers/:id`

**Scope:** `url:DELETE|/api/v1/accounts/:account_id/authentication_providers/:id`

Delete the config

#### Example Request:

```bash
curl -X DELETE 'https://<canvas>/api/v1/accounts/<account_id>/authentication_providers/<id>' \
     -H 'Authorization: Bearer <token>'
```

## [Restore a deleted authentication provider](#method.authentication_providers.restore) <a href="#method.authentication_providers.restore" id="method.authentication_providers.restore"></a>

[AuthenticationProvidersController#restore](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_providers_controller.rb)

#### `PUT /api/v1/accounts/:account_id/authentication_providers/:id/restore`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/authentication_providers/:id/restore`

Restore an authentication provider back to active that was previously deleted. Only available to admins who can manage\_authentication\_provider for given root account.

#### Example Request:

```bash
curl -X PUT 'https://<canvas>/api/v1/accounts/<account_id>/authentication_providers/<id>/restore' \
     -H 'Authorization: Bearer <token>'
```

Returns an [AuthenticationProvider](#authenticationprovider) object.

## [Show account auth settings](#method.authentication_providers.show_sso_settings) <a href="#method.authentication_providers.show_sso_settings" id="method.authentication_providers.show_sso_settings"></a>

[AuthenticationProvidersController#show\_sso\_settings](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_providers_controller.rb)

#### `GET /api/v1/accounts/:account_id/sso_settings`

**Scope:** `url:GET|/api/v1/accounts/:account_id/sso_settings`

The way to get the current state of each account level setting that's relevant to Single Sign On configuration

You can list the current state of each setting with "update\_sso\_settings"

#### Example Request:

```bash
curl -XGET 'https://<canvas>/api/v1/accounts/<account_id>/sso_settings' \
     -H 'Authorization: Bearer <token>'
```

Returns a [SSOSettings](#ssosettings) object.

## [Update account auth settings](#method.authentication_providers.update_sso_settings) <a href="#method.authentication_providers.update_sso_settings" id="method.authentication_providers.update_sso_settings"></a>

[AuthenticationProvidersController#update\_sso\_settings](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_providers_controller.rb)

#### `PUT /api/v1/accounts/:account_id/sso_settings`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/sso_settings`

For various cases of mixed SSO configurations, you may need to set some configuration at the account level to handle the particulars of your setup.

This endpoint accepts a PUT request to set several possible account settings. All setting are optional on each request, any that are not provided at all are simply retained as is. Any that provide the key but a null-ish value (blank string, null, undefined) will be UN-set.

You can list the current state of each setting with "show\_sso\_settings"

#### Example Request:

```bash
curl -XPUT 'https://<canvas>/api/v1/accounts/<account_id>/sso_settings' \
     -F 'sso_settings[auth_discovery_url]=<new_url>' \
     -F 'sso_settings[change_password_url]=<new_url>' \
     -F 'sso_settings[login_handle_name]=<new_handle>' \
     -H 'Authorization: Bearer <token>'
```

Returns a [SSOSettings](#ssosettings) object.

## [Force password reset](#method.authentication_providers.force_password_reset) <a href="#method.authentication_providers.force_password_reset" id="method.authentication_providers.force_password_reset"></a>

[AuthenticationProvidersController#force\_password\_reset](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_providers_controller.rb)

#### `POST /api/v1/accounts/:account_id/authentication_providers/force_password_reset`

**Scope:** `url:POST|/api/v1/accounts/:account_id/authentication_providers/force_password_reset`

Enqueues a job to set the must\_reset\_password flag on all active Canvas login pseudonyms for the account. Affected users will be required to change their password on next login. Only available for accounts that have Canvas authentication enabled.

#### Example Request:

```bash
curl -X POST 'https://<canvas>/api/v1/accounts/<account_id>/authentication_providers/force_password_reset' \
     -H 'Authorization: Bearer <token>'
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Authentications Log

Query audit log of authentication events (logins and logouts).

For each endpoint, a compound document is returned. The primary collection of event objects is paginated, ordered by date descending. Secondary collections of logins, accounts, page views, and users related to the returned events are also included. Refer to the Logins, Accounts, Page Views, and Users APIs for descriptions of the objects in those collections.

Authentication logs are stored for one year.

#### An AuthenticationEvent object looks like: <a href="#authenticationevent" id="authenticationevent"></a>

```js
{
  // timestamp of the event
  "created_at": "2012-07-19T15:00:00-06:00",
  // authentication event type ('login' or 'logout')
  "event_type": "login",
  // ID of the pseudonym (login) associated with the event
  "pseudonym_id": 9478,
  // ID of the account associated with the event. will match the account_id in the
  // associated pseudonym.
  "account_id": 2319,
  // ID of the user associated with the event will match the user_id in the
  // associated pseudonym.
  "user_id": 362
}
```

## [Query by login.](#method.authentication_audit_api.for_login) <a href="#method.authentication_audit_api.for_login" id="method.authentication_audit_api.for_login"></a>

[AuthenticationAuditApiController#for\_login](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_audit_api_controller.rb)

#### `GET /api/v1/audit/authentication/logins/:login_id`

**Scope:** `url:GET|/api/v1/audit/authentication/logins/:login_id`

List authentication events for a given login.

#### Request Parameters:

| Parameter    | Type       | Description                                                                                           |
| ------------ | ---------- | ----------------------------------------------------------------------------------------------------- |
| `start_time` | `DateTime` | <p>The beginning of the time range from which you want events.<br>Events are stored for one year.</p> |
| `end_time`   | `DateTime` | The end of the time range from which you want events.                                                 |

## [Query by account.](#method.authentication_audit_api.for_account) <a href="#method.authentication_audit_api.for_account" id="method.authentication_audit_api.for_account"></a>

[AuthenticationAuditApiController#for\_account](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_audit_api_controller.rb)

#### `GET /api/v1/audit/authentication/accounts/:account_id`

**Scope:** `url:GET|/api/v1/audit/authentication/accounts/:account_id`

List authentication events for a given account.

#### Request Parameters:

| Parameter          | Type       | Description                                                                                                                                                                                                                                   |
| ------------------ | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `start_time`       | `DateTime` | <p>The beginning of the time range from which you want events.<br>Events are stored for one year.</p>                                                                                                                                         |
| `end_time`         | `DateTime` | The end of the time range from which you want events.                                                                                                                                                                                         |
| `user_id`          | `string`   | Only include events for this user. Defaults to all users in the account.                                                                                                                                                                      |
| `auth_provider_id` | `string`   | <p>Only include events for logins tied to this authentication provider.<br>Accepts an authentication provider id, or the string "unknown" to<br>match logins that have no explicit provider.<br>Defaults to all providers in the account.</p> |

## [Query by user.](#method.authentication_audit_api.for_user) <a href="#method.authentication_audit_api.for_user" id="method.authentication_audit_api.for_user"></a>

[AuthenticationAuditApiController#for\_user](https://github.com/instructure/canvas-lms/blob/master/app/controllers/authentication_audit_api_controller.rb)

#### `GET /api/v1/audit/authentication/users/:user_id`

**Scope:** `url:GET|/api/v1/audit/authentication/users/:user_id`

List authentication events for a given user.

#### Request Parameters:

| Parameter    | Type       | Description                                                                                           |
| ------------ | ---------- | ----------------------------------------------------------------------------------------------------- |
| `start_time` | `DateTime` | <p>The beginning of the time range from which you want events.<br>Events are stored for one year.</p> |
| `end_time`   | `DateTime` | The end of the time range from which you want events.                                                 |

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Blackout Dates

API for accessing blackout date information.

#### A BlackoutDate object looks like: <a href="#blackoutdate" id="blackoutdate"></a>

```js
// Blackout dates are used to prevent scheduling assignments on a given date in
// course pacing.
{
  // the ID of the blackout date
  "id": 1,
  // the context owning the blackout date
  "context_id": 1,
  "context_type": "Course",
  // the start date of the blackout date
  "start_date": "2022-01-01",
  // the end date of the blackout date
  "end_date": "2022-01-02",
  // title of the blackout date
  "event_title": "some title"
}
```

## [List blackout dates](#method.blackout_dates.index) <a href="#method.blackout_dates.index" id="method.blackout_dates.index"></a>

[BlackoutDatesController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/blackout_dates_controller.rb)

#### `GET /api/v1/courses/:course_id/blackout_dates`

**Scope:** `url:GET|/api/v1/courses/:course_id/blackout_dates`

#### `GET /api/v1/accounts/:account_id/blackout_dates`

**Scope:** `url:GET|/api/v1/accounts/:account_id/blackout_dates`

Returns the list of blackout dates for the current context.

Returns a list of [BlackoutDate](#blackoutdate) objects.

## [Get a single blackout date](#method.blackout_dates.show) <a href="#method.blackout_dates.show" id="method.blackout_dates.show"></a>

[BlackoutDatesController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/blackout_dates_controller.rb)

#### `GET /api/v1/courses/:course_id/blackout_dates/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/blackout_dates/:id`

#### `GET /api/v1/accounts/:account_id/blackout_dates/:id`

**Scope:** `url:GET|/api/v1/accounts/:account_id/blackout_dates/:id`

Returns the blackout date with the given id.

Returns a [BlackoutDate](#blackoutdate) object.

## [New Blackout Date](#method.blackout_dates.new) <a href="#method.blackout_dates.new" id="method.blackout_dates.new"></a>

[BlackoutDatesController#new](https://github.com/instructure/canvas-lms/blob/master/app/controllers/blackout_dates_controller.rb)

#### `GET /api/v1/courses/:course_id/blackout_dates/new`

**Scope:** `url:GET|/api/v1/courses/:course_id/blackout_dates/new`

#### `GET /api/v1/accounts/:account_id/blackout_dates/new`

**Scope:** `url:GET|/api/v1/accounts/:account_id/blackout_dates/new`

Initialize an unsaved Blackout Date for the given context.

Returns a [BlackoutDate](#blackoutdate) object.

## [Create Blackout Date](#method.blackout_dates.create) <a href="#method.blackout_dates.create" id="method.blackout_dates.create"></a>

[BlackoutDatesController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/blackout_dates_controller.rb)

#### `POST /api/v1/courses/:course_id/blackout_dates`

**Scope:** `url:POST|/api/v1/courses/:course_id/blackout_dates`

#### `POST /api/v1/accounts/:account_id/blackout_dates`

**Scope:** `url:POST|/api/v1/accounts/:account_id/blackout_dates`

Create a blackout date for the given context.

#### Request Parameters:

| Parameter     | Type     | Description                          |
| ------------- | -------- | ------------------------------------ |
| `start_date`  | `Date`   | The start date of the blackout date. |
| `end_date`    | `Date`   | The end date of the blackout date.   |
| `event_title` | `string` | The title of the blackout date.      |

Returns a [BlackoutDate](#blackoutdate) object.

## [Update Blackout Date](#method.blackout_dates.update) <a href="#method.blackout_dates.update" id="method.blackout_dates.update"></a>

[BlackoutDatesController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/blackout_dates_controller.rb)

#### `PUT /api/v1/courses/:course_id/blackout_dates/:id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/blackout_dates/:id`

#### `PUT /api/v1/accounts/:account_id/blackout_dates/:id`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/blackout_dates/:id`

Update a blackout date for the given context.

#### Request Parameters:

| Parameter     | Type     | Description                          |
| ------------- | -------- | ------------------------------------ |
| `start_date`  | `Date`   | The start date of the blackout date. |
| `end_date`    | `Date`   | The end date of the blackout date.   |
| `event_title` | `string` | The title of the blackout date.      |

Returns a [BlackoutDate](#blackoutdate) object.

## [Delete Blackout Date](#method.blackout_dates.destroy) <a href="#method.blackout_dates.destroy" id="method.blackout_dates.destroy"></a>

[BlackoutDatesController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/blackout_dates_controller.rb)

#### `DELETE /api/v1/courses/:course_id/blackout_dates/:id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/blackout_dates/:id`

#### `DELETE /api/v1/accounts/:account_id/blackout_dates/:id`

**Scope:** `url:DELETE|/api/v1/accounts/:account_id/blackout_dates/:id`

Delete a blackout date for the given context.

Returns a [BlackoutDate](#blackoutdate) object.

## [Update a list of Blackout Dates](#method.blackout_dates.bulk_update) <a href="#method.blackout_dates.bulk_update" id="method.blackout_dates.bulk_update"></a>

[BlackoutDatesController#bulk\_update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/blackout_dates_controller.rb)

#### `PUT /api/v1/courses/:course_id/blackout_dates`

**Scope:** `url:PUT|/api/v1/courses/:course_id/blackout_dates`

Create, update, and delete blackout dates to sync the db with the incoming data.

#### Request Parameters:

| Parameter         | Type     | Description                                                                                                                                                                                                                                                                            |
| ----------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `blackout_dates:` | `string` | <p>\[blackout\_date, ...]<br>An object containing the array of BlackoutDates we want to exist after this operation.<br>For array entries, if it has an id it will be updated, if not created, and if<br>an existing BlackoutDate id is missing from the array, it will be deleted.</p> |

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# BlockEditorTemplate

Block Editor Templates are pre-build templates that can be used to create pages. The BlockEditorTemplate API allows you to create, retrieve, update, and delete templates.

#### A BlockEditorTemplate object looks like: <a href="#blockeditortemplate" id="blockeditortemplate"></a>

```js
{
  // the ID of the page
  "id": 1,
  // name of the template
  "name": "Navigation Bar",
  // description of the template
  "description": "A bar of links to other content",
  // the creation date for the template
  "created_at": "2012-08-06T16:46:33-06:00",
  // the date the template was last updated
  "updated_at": "2012-08-08T14:25:20-06:00",
  // The JSON data that is the template
  "node_tree": null,
  // The version of the editor that created the template
  "editor_version": "1.0",
  // The type of template. One of 'block', 'section', or 'page'
  "template_type": "page",
  // String indicating what state this assignment is in.
  "workflow_state": "unpublished"
}
```

## [List block templates](#method.block_editor_templates_api.index) <a href="#method.block_editor_templates_api.index" id="method.block_editor_templates_api.index"></a>

[BlockEditorTemplatesApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/block_editor_templates_api_controller.rb)

#### `GET /api/v1/courses/:course_id/block_editor_templates`

**Scope:** `url:GET|/api/v1/courses/:course_id/block_editor_templates`

A list of the block templates available to the current user.

#### Request Parameters:

| Parameter   | Type      | Description                                                                                                |
| ----------- | --------- | ---------------------------------------------------------------------------------------------------------- |
| `sort`      | `string`  | Sort results by this field. Allowed values: `name`, `created_at`, `updated_at`                             |
| `order`     | `string`  | The sorting order. Defaults to 'asc'. Allowed values: `asc`, `desc`                                        |
| `drafts`    | `boolean` | <p>If true, include draft templates. If false or omitted<br>only published templates will be returned.</p> |
| `type[]`    | `string`  | What type of templates should be returned. Allowed values: `page`, `section`, `block`                      |
| `include[]` | `string`  | no description Allowed values: `node_tree`, `thumbnail`                                                    |

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
     https://<canvas>/api/v1/courses/123/block_editor_templates?sort=name&order=asc&drafts=true
```

Returns a list of [BlockEditorTemplate](#blockeditortemplate) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Blueprint Courses

Configure blueprint courses

#### A BlueprintTemplate object looks like: <a href="#blueprinttemplate" id="blueprinttemplate"></a>

```js
{
  // The ID of the template.
  "id": 1,
  // The ID of the Course the template belongs to.
  "course_id": 2,
  // Time when the last export was completed
  "last_export_completed_at": "2013-08-28T23:59:00-06:00",
  // Number of associated courses for the template
  "associated_course_count": 3,
  // Details of the latest migration
  "latest_migration": null
}
```

#### A BlueprintMigration object looks like: <a href="#blueprintmigration" id="blueprintmigration"></a>

```js
{
  // The ID of the migration.
  "id": 1,
  // The ID of the template the migration belongs to. Only present when querying a
  // blueprint course.
  "template_id": 2,
  // The ID of the associated course's blueprint subscription. Only present when
  // querying a course associated with a blueprint.
  "subscription_id": 101,
  // The ID of the user who queued the migration.
  "user_id": 3,
  // Current state of the content migration: queued, exporting, imports_queued,
  // completed, exports_failed, imports_failed
  "workflow_state": "running",
  // Time when the migration was queued
  "created_at": "2013-08-28T23:59:00-06:00",
  // Time when the exports begun
  "exports_started_at": "2013-08-28T23:59:00-06:00",
  // Time when the exports were completed and imports were queued
  "imports_queued_at": "2013-08-28T23:59:00-06:00",
  // Time when the imports were completed
  "imports_completed_at": "2013-08-28T23:59:00-06:00",
  // User-specified comment describing changes made in this operation
  "comment": "Fixed spelling in question 3 of midterm exam"
}
```

#### A BlueprintRestriction object looks like: <a href="#blueprintrestriction" id="blueprintrestriction"></a>

```js
// A set of restrictions on editing for copied objects in associated courses
{
  // Restriction on main content (e.g. title, description).
  "content": true,
  // Restriction on points possible for assignments and graded learning objects
  "points": true,
  // Restriction on due dates for assignments and graded learning objects
  "due_dates": false,
  // Restriction on availability dates for an object
  "availability_dates": true
}
```

#### A ChangeRecord object looks like: <a href="#changerecord" id="changerecord"></a>

```js
// Describes a learning object change propagated to associated courses from a
// blueprint course
{
  // The ID of the learning object that was changed in the blueprint course.
  "asset_id": 2,
  // The type of the learning object that was changed in the blueprint course. 
  // One of 'assignment', 'attachment', 'discussion_topic', 'external_tool',
  // 'quiz', 'wiki_page', 'syllabus', or 'settings'.  For 'syllabus' or
  // 'settings', the asset_id is the course id.
  "asset_type": "assignment",
  // The name of the learning object that was changed in the blueprint course.
  "asset_name": "Some Assignment",
  // The type of change; one of 'created', 'updated', 'deleted'
  "change_type": "created",
  // The URL of the changed object
  "html_url": "https://canvas.example.com/courses/101/assignments/2",
  // Whether the object is locked in the blueprint
  "locked": false,
  // A list of ExceptionRecords for linked courses that did not receive this
  // update.
  "exceptions": [{"course_id":101,"conflicting_changes":["points"]}]
}
```

#### An ExceptionRecord object looks like: <a href="#exceptionrecord" id="exceptionrecord"></a>

```js
// Lists associated courses that did not receive a change propagated from a
// blueprint
{
  // The ID of the associated course
  "course_id": 101,
  // A list of change classes in the associated course's copy of the item that
  // prevented a blueprint change from being applied. One or more of ['content',
  // 'points', 'due_dates', 'availability_dates'].
  "conflicting_changes": ["points"]
}
```

#### A BlueprintSubscription object looks like: <a href="#blueprintsubscription" id="blueprintsubscription"></a>

```js
// Associates a course with a blueprint
{
  // The ID of the blueprint course subscription
  "id": 101,
  // The ID of the blueprint template the associated course is subscribed to
  "template_id": 1,
  // The blueprint course subscribed to
  "blueprint_course": {"id":2,"name":"Biology 100 Blueprint","course_code":"BIOL 100 BP","term_name":"Default term"}
}
```

## [Get blueprint information](#method.master_courses/master_templates.show) <a href="#method.master_courses-master_templates.show" id="method.master_courses-master_templates.show"></a>

[MasterCourses::MasterTemplatesController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `GET /api/v1/courses/:course_id/blueprint_templates/:template_id`

**Scope:** `url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id`

Using 'default' as the template\_id should suffice for the current implmentation (as there should be only one template per course). However, using specific template ids may become necessary in the future

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/blueprint_templates/default \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'
```

Returns a [BlueprintTemplate](#blueprinttemplate) object.

## [Get associated course information](#method.master_courses/master_templates.associated_courses) <a href="#method.master_courses-master_templates.associated_courses" id="method.master_courses-master_templates.associated_courses"></a>

[MasterCourses::MasterTemplatesController#associated\_courses](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `GET /api/v1/courses/:course_id/blueprint_templates/:template_id/associated_courses`

**Scope:** `url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id/associated_courses`

Returns a list of courses that are configured to receive updates from this blueprint

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/associated_courses \
  -H 'Authorization: Bearer <ACCESS_TOKEN>'
```

Returns a list of [Course](/services/canvas/resources/courses#course) objects.

## [Update associated courses](#method.master_courses/master_templates.update_associations) <a href="#method.master_courses-master_templates.update_associations" id="method.master_courses-master_templates.update_associations"></a>

[MasterCourses::MasterTemplatesController#update\_associations](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `PUT /api/v1/courses/:course_id/blueprint_templates/:template_id/update_associations`

**Scope:** `url:PUT|/api/v1/courses/:course_id/blueprint_templates/:template_id/update_associations`

Send a list of course ids to add or remove new associations for the template. Cannot add courses that do not belong to the blueprint course's account. Also cannot add other blueprint courses or courses that already have an association with another blueprint course.

After associating new courses, [start a sync](#method.master_courses/master_templates.queue_migration) to populate their contents from the blueprint.

#### Request Parameters:

| Parameter              | Type    | Description                             |
| ---------------------- | ------- | --------------------------------------- |
| `course_ids_to_add`    | `Array` | Courses to add as associated courses    |
| `course_ids_to_remove` | `Array` | Courses to remove as associated courses |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/update_associations \
-X PUT \
-H 'Authorization: Bearer <token>' \
-d 'course_ids_to_add[]=1' \
-d 'course_ids_to_remove[]=2' \
```

## [Begin a migration to push to associated courses](#method.master_courses/master_templates.queue_migration) <a href="#method.master_courses-master_templates.queue_migration" id="method.master_courses-master_templates.queue_migration"></a>

[MasterCourses::MasterTemplatesController#queue\_migration](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `POST /api/v1/courses/:course_id/blueprint_templates/:template_id/migrations`

**Scope:** `url:POST|/api/v1/courses/:course_id/blueprint_templates/:template_id/migrations`

Begins a migration to push recently updated content to all associated courses. Only one migration can be running at a time.

#### Request Parameters:

| Parameter                    | Type      | Description                                                                                                                                                                                                                                                                                                                                                                       |
| ---------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `comment`                    | `string`  | An optional comment to be included in the sync history.                                                                                                                                                                                                                                                                                                                           |
| `send_notification`          | `boolean` | Send a notification to the calling user when the sync completes.                                                                                                                                                                                                                                                                                                                  |
| `copy_settings`              | `boolean` | <p>Whether course settings should be copied over to associated courses.<br>Defaults to true for newly associated courses.</p>                                                                                                                                                                                                                                                     |
| `send_item_notifications`    | `boolean` | <p>By default, new-item notifications are suppressed in blueprint syncs.<br>If this option is set, teachers and students may receive notifications<br>for items such as announcements and assignments that are created<br>in associated courses (subject to the usual notification settings).<br>This option requires the Blueprint Item Notifications feature to be enabled.</p> |
| `publish_after_initial_sync` | `boolean` | If set, newly associated courses will be automatically published after the sync completes                                                                                                                                                                                                                                                                                         |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/migrations \
-X POST \
-F 'comment=Fixed spelling in question 3 of midterm exam' \
-F 'send_notification=true' \
-H 'Authorization: Bearer <token>'
```

Returns a [BlueprintMigration](#blueprintmigration) object.

## [Set or remove restrictions on a blueprint course object](#method.master_courses/master_templates.restrict_item) <a href="#method.master_courses-master_templates.restrict_item" id="method.master_courses-master_templates.restrict_item"></a>

[MasterCourses::MasterTemplatesController#restrict\_item](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `PUT /api/v1/courses/:course_id/blueprint_templates/:template_id/restrict_item`

**Scope:** `url:PUT|/api/v1/courses/:course_id/blueprint_templates/:template_id/restrict_item`

If a blueprint course object is restricted, editing will be limited for copies in associated courses.

#### Request Parameters:

| Parameter      | Type                   | Description                                                                                                                                                                                                                                               |
| -------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `content_type` | `string`               | \[String, "assignment"                                                                                                                                                                                                                                    |
| `content_id`   | `integer`              | The ID of the object.                                                                                                                                                                                                                                     |
| `restricted`   | `boolean`              | Whether to apply restrictions.                                                                                                                                                                                                                            |
| `restrictions` | `BlueprintRestriction` | <p>(Optional) If the object is restricted, this specifies a set of restrictions. If not specified,<br>the course-level restrictions will be used. See <a href="/pages/Dq3HF46TIgKustPuq4C9#method.courses.update">Course API update documentation</a></p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/restrict_item \
-X PUT \
-H 'Authorization: Bearer <token>' \
-d 'content_type=assignment' \
-d 'content_id=2' \
-d 'restricted=true'
```

## [Get unsynced changes](#method.master_courses/master_templates.unsynced_changes) <a href="#method.master_courses-master_templates.unsynced_changes" id="method.master_courses-master_templates.unsynced_changes"></a>

[MasterCourses::MasterTemplatesController#unsynced\_changes](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `GET /api/v1/courses/:course_id/blueprint_templates/:template_id/unsynced_changes`

**Scope:** `url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id/unsynced_changes`

Retrieve a list of learning objects that have changed since the last blueprint sync operation. If no syncs have been completed, a ChangeRecord with a change\_type of +initial\_sync+ is returned.

Returns a list of [ChangeRecord](#changerecord) objects.

## [List blueprint migrations](#method.master_courses/master_templates.migrations_index) <a href="#method.master_courses-master_templates.migrations_index" id="method.master_courses-master_templates.migrations_index"></a>

[MasterCourses::MasterTemplatesController#migrations\_index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `GET /api/v1/courses/:course_id/blueprint_templates/:template_id/migrations`

**Scope:** `url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id/migrations`

Shows a paginated list of migrations for the template, starting with the most recent. This endpoint can be called on a blueprint course. See also [the associated course side](#method.master_courses/master_templates.imports_index).

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/migrations \
-H 'Authorization: Bearer <token>'
```

Returns a list of [BlueprintMigration](#blueprintmigration) objects.

## [Show a blueprint migration](#method.master_courses/master_templates.migrations_show) <a href="#method.master_courses-master_templates.migrations_show" id="method.master_courses-master_templates.migrations_show"></a>

[MasterCourses::MasterTemplatesController#migrations\_show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `GET /api/v1/courses/:course_id/blueprint_templates/:template_id/migrations/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id/migrations/:id`

Shows the status of a migration. This endpoint can be called on a blueprint course. See also [the associated course side](#method.master_courses/master_templates.imports_show).

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/migrations/:id \
-H 'Authorization: Bearer <token>'
```

Returns a [BlueprintMigration](#blueprintmigration) object.

## [Get migration details](#method.master_courses/master_templates.migration_details) <a href="#method.master_courses-master_templates.migration_details" id="method.master_courses-master_templates.migration_details"></a>

[MasterCourses::MasterTemplatesController#migration\_details](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `GET /api/v1/courses/:course_id/blueprint_templates/:template_id/migrations/:id/details`

**Scope:** `url:GET|/api/v1/courses/:course_id/blueprint_templates/:template_id/migrations/:id/details`

Show the changes that were propagated in a blueprint migration. This endpoint can be called on a blueprint course. See also [the associated course side](#method.master_courses/master_templates.import_details).

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/blueprint_templates/default/migrations/2/details \
-H 'Authorization: Bearer <token>'
```

Returns a list of [ChangeRecord](#changerecord) objects.

## [List blueprint subscriptions](#method.master_courses/master_templates.subscriptions_index) <a href="#method.master_courses-master_templates.subscriptions_index" id="method.master_courses-master_templates.subscriptions_index"></a>

[MasterCourses::MasterTemplatesController#subscriptions\_index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `GET /api/v1/courses/:course_id/blueprint_subscriptions`

**Scope:** `url:GET|/api/v1/courses/:course_id/blueprint_subscriptions`

Returns a list of blueprint subscriptions for the given course. (Currently a course may have no more than one.)

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/2/blueprint_subscriptions \
-H 'Authorization: Bearer <token>'
```

Returns a list of [BlueprintSubscription](#blueprintsubscription) objects.

## [List blueprint imports](#method.master_courses/master_templates.imports_index) <a href="#method.master_courses-master_templates.imports_index" id="method.master_courses-master_templates.imports_index"></a>

[MasterCourses::MasterTemplatesController#imports\_index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `GET /api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations`

**Scope:** `url:GET|/api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations`

Shows a paginated list of migrations imported into a course associated with a blueprint, starting with the most recent. See also [the blueprint course side](#method.master_courses/master_templates.migrations_index).

Use 'default' as the subscription\_id to use the currently active blueprint subscription.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/2/blueprint_subscriptions/default/migrations \
-H 'Authorization: Bearer <token>'
```

Returns a list of [BlueprintMigration](#blueprintmigration) objects.

## [Show a blueprint import](#method.master_courses/master_templates.imports_show) <a href="#method.master_courses-master_templates.imports_show" id="method.master_courses-master_templates.imports_show"></a>

[MasterCourses::MasterTemplatesController#imports\_show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `GET /api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations/:id`

Shows the status of an import into a course associated with a blueprint. See also [the blueprint course side](#method.master_courses/master_templates.migrations_show).

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/2/blueprint_subscriptions/default/migrations/:id \
-H 'Authorization: Bearer <token>'
```

Returns a [BlueprintMigration](#blueprintmigration) object.

## [Get import details](#method.master_courses/master_templates.import_details) <a href="#method.master_courses-master_templates.import_details" id="method.master_courses-master_templates.import_details"></a>

[MasterCourses::MasterTemplatesController#import\_details](https://github.com/instructure/canvas-lms/blob/master/app/controllers/master_courses/master_templates_controller.rb)

#### `GET /api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations/:id/details`

**Scope:** `url:GET|/api/v1/courses/:course_id/blueprint_subscriptions/:subscription_id/migrations/:id/details`

Show the changes that were propagated to a course associated with a blueprint. See also [the blueprint course side](#method.master_courses/master_templates.migration_details).

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/2/blueprint_subscriptions/default/7/details \
-H 'Authorization: Bearer <token>'
```

Returns a list of [ChangeRecord](#changerecord) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Bookmarks

#### A Bookmark object looks like: <a href="#bookmark" id="bookmark"></a>

```js
{
  "id": 1,
  "name": "Biology 101",
  "url": "/courses/1",
  "position": 1,
  "data": {"active_tab":1}
}
```

## [List bookmarks](#method.bookmarks/bookmarks.index) <a href="#method.bookmarks-bookmarks.index" id="method.bookmarks-bookmarks.index"></a>

[Bookmarks::BookmarksController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/bookmarks/bookmarks_controller.rb)

#### `GET /api/v1/users/self/bookmarks`

**Scope:** `url:GET|/api/v1/users/self/bookmarks`

Returns the paginated list of bookmarks.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/users/self/bookmarks' \
     -H 'Authorization: Bearer <token>'
```

Returns a list of [Bookmark](#bookmark) objects.

## [Create bookmark](#method.bookmarks/bookmarks.create) <a href="#method.bookmarks-bookmarks.create" id="method.bookmarks-bookmarks.create"></a>

[Bookmarks::BookmarksController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/bookmarks/bookmarks_controller.rb)

#### `POST /api/v1/users/self/bookmarks`

**Scope:** `url:POST|/api/v1/users/self/bookmarks`

Creates a bookmark.

#### Request Parameters:

| Parameter  | Type      | Description                                           |
| ---------- | --------- | ----------------------------------------------------- |
| `name`     | `string`  | The name of the bookmark                              |
| `url`      | `string`  | The url of the bookmark                               |
| `position` | `integer` | The position of the bookmark. Defaults to the bottom. |
| `data`     | `string`  | The data associated with the bookmark                 |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/users/self/bookmarks' \
     -F 'name=Biology 101' \
     -F 'url=/courses/1' \
     -H 'Authorization: Bearer <token>'
```

Returns a [Bookmark](#bookmark) object.

## [Get bookmark](#method.bookmarks/bookmarks.show) <a href="#method.bookmarks-bookmarks.show" id="method.bookmarks-bookmarks.show"></a>

[Bookmarks::BookmarksController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/bookmarks/bookmarks_controller.rb)

#### `GET /api/v1/users/self/bookmarks/:id`

**Scope:** `url:GET|/api/v1/users/self/bookmarks/:id`

Returns the details for a bookmark.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/users/self/bookmarks/1' \
     -H 'Authorization: Bearer <token>'
```

Returns a [Bookmark](#bookmark) object.

## [Update bookmark](#method.bookmarks/bookmarks.update) <a href="#method.bookmarks-bookmarks.update" id="method.bookmarks-bookmarks.update"></a>

[Bookmarks::BookmarksController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/bookmarks/bookmarks_controller.rb)

#### `PUT /api/v1/users/self/bookmarks/:id`

**Scope:** `url:PUT|/api/v1/users/self/bookmarks/:id`

Updates a bookmark

#### Request Parameters:

| Parameter  | Type      | Description                                           |
| ---------- | --------- | ----------------------------------------------------- |
| `name`     | `string`  | The name of the bookmark                              |
| `url`      | `string`  | The url of the bookmark                               |
| `position` | `integer` | The position of the bookmark. Defaults to the bottom. |
| `data`     | `string`  | The data associated with the bookmark                 |

#### Example Request:

```bash
curl -X PUT 'https://<canvas>/api/v1/users/self/bookmarks/1' \
     -F 'name=Biology 101' \
     -F 'url=/courses/1' \
     -H 'Authorization: Bearer <token>'
```

Returns a [Folder](/services/canvas/resources/files#folder) object.

## [Delete bookmark](#method.bookmarks/bookmarks.destroy) <a href="#method.bookmarks-bookmarks.destroy" id="method.bookmarks-bookmarks.destroy"></a>

[Bookmarks::BookmarksController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/bookmarks/bookmarks_controller.rb)

#### `DELETE /api/v1/users/self/bookmarks/:id`

**Scope:** `url:DELETE|/api/v1/users/self/bookmarks/:id`

Deletes a bookmark

#### Example Request:

```bash
curl -X DELETE 'https://<canvas>/api/v1/users/self/bookmarks/1' \
     -H 'Authorization: Bearer <token>'
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Brand Configs

## [Get the brand config variables that should be used for this domain](#method.brand_configs_api.show) <a href="#method.brand_configs_api.show" id="method.brand_configs_api.show"></a>

[BrandConfigsApiController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/brand_configs_api_controller.rb)

#### `GET /api/v1/brand_variables`

**Scope:** `url:GET|/api/v1/brand_variables`

Will redirect to a static json file that has all of the brand variables used by this account. Even though this is a redirect, do not store the redirected url since if the account makes any changes it will redirect to a new url. Needs no authentication.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/brand_variables'
```

## [Get the brand config variables for a sub-account or course](#method.brand_configs_api.show_context) <a href="#method.brand_configs_api.show_context" id="method.brand_configs_api.show_context"></a>

[BrandConfigsApiController#show\_context](https://github.com/instructure/canvas-lms/blob/master/app/controllers/brand_configs_api_controller.rb)

#### `GET /api/v1/accounts/:account_id/brand_variables`

**Scope:** `url:GET|/api/v1/accounts/:account_id/brand_variables`

#### `GET /api/v1/courses/:course_id/brand_variables`

**Scope:** `url:GET|/api/v1/courses/:course_id/brand_variables`

Will redirect to a static json file that has all of the brand variables used by the provided context. Even though this is a redirect, do not store the redirected url since if the sub-account makes any changes it will redirect to a new url.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/accounts/123/brand_variables'
  -H 'Authorization: Bearer <token>'
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Calendar Events

API for creating, accessing and updating calendar events.

#### A CalendarEvent object looks like: <a href="#calendarevent" id="calendarevent"></a>

```js
{
  // The ID of the calendar event
  "id": 234,
  // The title of the calendar event
  "title": "Paintball Fight!",
  // The start timestamp of the event
  "start_at": "2012-07-19T15:00:00-06:00",
  // The end timestamp of the event
  "end_at": "2012-07-19T16:00:00-06:00",
  // The HTML description of the event
  "description": "<b>It's that time again!</b>",
  // The location name of the event
  "location_name": "Greendale Community College",
  // The address where the event is taking place
  "location_address": "Greendale, Colorado",
  // the context code of the calendar this event belongs to (course, group, user,
  // or account)
  "context_code": "course_123",
  // if specified, it indicates which calendar this event should be displayed on.
  // for example, a section-level event would have the course's context code here,
  // while the section's context code would be returned above)
  "effective_context_code": null,
  // the context name of the calendar this event belongs to (course, user or
  // group)
  "context_name": "Chemistry 101",
  // a comma-separated list of all calendar contexts this event is part of
  "all_context_codes": "course_123,course_456",
  // Current state of the event ('active', 'locked' or 'deleted') 'locked'
  // indicates that start_at/end_at cannot be changed (though the event could be
  // deleted). Normally only reservations or time slots with reservations are
  // locked (see the Appointment Groups API)
  "workflow_state": "active",
  // Whether this event should be displayed on the calendar. Only true for
  // course-level events with section-level child events.
  "hidden": false,
  // Normally null. If this is a reservation (see the Appointment Groups API), the
  // id will indicate the time slot it is for. If this is a section-level event,
  // this will be the course-level parent event.
  "parent_event_id": null,
  // The number of child_events. See child_events (and parent_event_id)
  "child_events_count": 0,
  // Included by default, but may be excluded (see include[] option). If this is a
  // time slot (see the Appointment Groups API) this will be a list of any
  // reservations. If this is a course-level event, this will be a list of
  // section-level events (if any)
  "child_events": null,
  // URL for this calendar event (to update, delete, etc.)
  "url": "https://example.com/api/v1/calendar_events/234",
  // URL for a user to view this event
  "html_url": "https://example.com/calendar?event_id=234&include_contexts=course_123",
  // The date of this event
  "all_day_date": "2012-07-19",
  // Boolean indicating whether this is an all-day event (midnight to midnight)
  "all_day": false,
  // When the calendar event was created
  "created_at": "2012-07-12T10:55:20-06:00",
  // When the calendar event was last updated
  "updated_at": "2012-07-12T10:55:20-06:00",
  // Various Appointment-Group-related fields.These fields are only pertinent to
  // time slots (appointments) and reservations of those time slots. See the
  // Appointment Groups API. The id of the appointment group
  "appointment_group_id": null,
  // The API URL of the appointment group
  "appointment_group_url": null,
  // If the event is a reservation, this a boolean indicating whether it is the
  // current user's reservation, or someone else's
  "own_reservation": false,
  // If the event is a time slot, the API URL for reserving it
  "reserve_url": null,
  // If the event is a time slot, a boolean indicating whether the user has
  // already made a reservation for it
  "reserved": false,
  // The type of participant to sign up for a slot: 'User' or 'Group'
  "participant_type": "User",
  // If the event is a time slot, this is the participant limit
  "participants_per_appointment": null,
  // If the event is a time slot and it has a participant limit, an integer
  // indicating how many slots are available
  "available_slots": null,
  // If the event is a user-level reservation, this will contain the user
  // participant JSON (refer to the Users API).
  "user": null,
  // If the event is a group-level reservation, this will contain the group
  // participant JSON (refer to the Groups API).
  "group": null,
  // Boolean indicating whether this has important dates.
  "important_dates": true,
  // Identifies the recurring event series this event may belong to.
  "series_uuid": null,
  // An iCalendar RRULE for defining how events in a recurring event series
  // repeat.
  "rrule": null,
  // Boolean indicating if is the first event in the series of recurring events.
  "series_head": null,
  // A natural language expression of how events occur in the series.
  "series_natural_language": "Daily 5 times",
  // Boolean indicating whether this has blackout date.
  "blackout_date": true
}
```

#### An AssignmentEvent object looks like: <a href="#assignmentevent" id="assignmentevent"></a>

```js
{
  // A synthetic ID for the assignment
  "id": "assignment_987",
  // The title of the assignment
  "title": "Essay",
  // The due_at timestamp of the assignment
  "start_at": "2012-07-19T23:59:00-06:00",
  // The due_at timestamp of the assignment
  "end_at": "2012-07-19T23:59:00-06:00",
  // The HTML description of the assignment
  "description": "<b>Write an essay. Whatever you want.</b>",
  // the context code of the (course) calendar this assignment belongs to
  "context_code": "course_123",
  // Current state of the assignment ('published' or 'deleted')
  "workflow_state": "published",
  // URL for this assignment (note that updating/deleting should be done via the
  // Assignments API)
  "url": "https://example.com/api/v1/calendar_events/assignment_987",
  // URL for a user to view this assignment
  "html_url": "http://example.com/courses/123/assignments/987",
  // The due date of this assignment
  "all_day_date": "2012-07-19",
  // Boolean indicating whether this is an all-day event (e.g. assignment due at
  // midnight)
  "all_day": true,
  // When the assignment was created
  "created_at": "2012-07-12T10:55:20-06:00",
  // When the assignment was last updated
  "updated_at": "2012-07-12T10:55:20-06:00",
  // The full assignment JSON data (See the Assignments API)
  "assignment": null,
  // The list of AssignmentOverrides that apply to this event (See the Assignments
  // API). This information is useful for determining which students or sections
  // this assignment-due event applies to.
  "assignment_overrides": null,
  // Boolean indicating whether this has important dates.
  "important_dates": true,
  // An iCalendar RRULE for defining how events in a recurring event series
  // repeat.
  "rrule": "FREQ=DAILY;INTERVAL=1;COUNT=5",
  // Trueif this is the first event in the series of recurring events.
  "series_head": null,
  // A natural language expression of how events occur in the series.
  "series_natural_language": "Daily 5 times"
}
```

## [List calendar events](#method.calendar_events_api.index) <a href="#method.calendar_events_api.index" id="method.calendar_events_api.index"></a>

[CalendarEventsApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `GET /api/v1/calendar_events`

**Scope:** `url:GET|/api/v1/calendar_events`

Retrieve the paginated list of calendar events or assignments for the current user

#### Request Parameters:

| Parameter         | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                          |
| ----------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`            | `string`  | Defaults to "event" Allowed values: `event`, `assignment`, `sub_assignment`                                                                                                                                                                                                                                                                                                                          |
| `start_date`      | `Date`    | <p>Only return events since the start\_date (inclusive).<br>Defaults to today. The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.</p>                                                                                                                                                                                                                                    |
| `end_date`        | `Date`    | <p>Only return events before the end\_date (inclusive).<br>Defaults to start\_date. The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.<br>If end\_date is the same as start\_date, then only events on that day are<br>returned.</p>                                                                                                                                     |
| `undated`         | `boolean` | <p>Defaults to false (dated events only).<br>If true, only return undated events and ignore start\_date and end\_date.</p>                                                                                                                                                                                                                                                                           |
| `all_events`      | `boolean` | <p>Defaults to false (uses start\_date, end\_date, and undated criteria).<br>If true, all events are returned, ignoring start\_date, end\_date, and undated criteria.</p>                                                                                                                                                                                                                            |
| `context_codes[]` | `string`  | <p>List of context codes of courses, groups, users, or accounts whose events you want to see.<br>If not specified, defaults to the current user (i.e personal calendar,<br>no course/group events). Limited to 10 context codes, additional ones are<br>ignored. The format of this field is the context type, followed by an<br>underscore, followed by the context id. For example: course\_42</p> |
| `excludes[]`      | `Array`   | Array of attributes to exclude. Possible values are "description", "child\_events" and "assignment"                                                                                                                                                                                                                                                                                                  |
| `includes[]`      | `Array`   | Array of optional attributes to include. Possible values are "web\_conference" and "series\_natural\_language"                                                                                                                                                                                                                                                                                       |
| `important_dates` | `boolean` | <p>Defaults to false.<br>If true, only events with important dates set to true will be returned.</p>                                                                                                                                                                                                                                                                                                 |
| `blackout_date`   | `boolean` | <p>Defaults to false.<br>If true, only events with blackout date set to true will be returned.</p>                                                                                                                                                                                                                                                                                                   |

Returns a list of [CalendarEvent](#calendarevent) objects.

## [List calendar events for a user](#method.calendar_events_api.user_index) <a href="#method.calendar_events_api.user_index" id="method.calendar_events_api.user_index"></a>

[CalendarEventsApiController#user\_index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `GET /api/v1/users/:user_id/calendar_events`

**Scope:** `url:GET|/api/v1/users/:user_id/calendar_events`

Retrieve the paginated list of calendar events or assignments for the specified user. To view calendar events for a user other than yourself, you must either be an observer of that user or an administrator.

#### Request Parameters:

| Parameter                    | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                          |
| ---------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`                       | `string`  | Defaults to "event" Allowed values: `event`, `assignment`                                                                                                                                                                                                                                                                                                                                            |
| `start_date`                 | `Date`    | <p>Only return events since the start\_date (inclusive).<br>Defaults to today. The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.</p>                                                                                                                                                                                                                                    |
| `end_date`                   | `Date`    | <p>Only return events before the end\_date (inclusive).<br>Defaults to start\_date. The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ.<br>If end\_date is the same as start\_date, then only events on that day are<br>returned.</p>                                                                                                                                     |
| `undated`                    | `boolean` | <p>Defaults to false (dated events only).<br>If true, only return undated events and ignore start\_date and end\_date.</p>                                                                                                                                                                                                                                                                           |
| `all_events`                 | `boolean` | <p>Defaults to false (uses start\_date, end\_date, and undated criteria).<br>If true, all events are returned, ignoring start\_date, end\_date, and undated criteria.</p>                                                                                                                                                                                                                            |
| `context_codes[]`            | `string`  | <p>List of context codes of courses, groups, users, or accounts whose events you want to see.<br>If not specified, defaults to the current user (i.e personal calendar,<br>no course/group events). Limited to 10 context codes, additional ones are<br>ignored. The format of this field is the context type, followed by an<br>underscore, followed by the context id. For example: course\_42</p> |
| `excludes[]`                 | `Array`   | Array of attributes to exclude. Possible values are "description", "child\_events" and "assignment"                                                                                                                                                                                                                                                                                                  |
| `submission_types[]`         | `Array`   | <p>When type is "assignment", specifies the allowable submission types for returned assignments.<br>Ignored if type is not "assignment" or if exclude\_submission\_types is provided.</p>                                                                                                                                                                                                            |
| `exclude_submission_types[]` | `Array`   | <p>When type is "assignment", specifies the submission types to be excluded from the returned<br>assignments. Ignored if type is not "assignment".</p>                                                                                                                                                                                                                                               |
| `includes[]`                 | `Array`   | Array of optional attributes to include. Possible values are "web\_conference" and "series\_natural\_language"                                                                                                                                                                                                                                                                                       |
| `important_dates`            | `boolean` | <p>Defaults to false<br>If true, only events with important dates set to true will be returned.</p>                                                                                                                                                                                                                                                                                                  |
| `blackout_date`              | `boolean` | <p>Defaults to false<br>If true, only events with blackout date set to true will be returned.</p>                                                                                                                                                                                                                                                                                                    |

Returns a list of [CalendarEvent](#calendarevent) objects.

## [Create a calendar event](#method.calendar_events_api.create) <a href="#method.calendar_events_api.create" id="method.calendar_events_api.create"></a>

[CalendarEventsApiController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `POST /api/v1/calendar_events`

**Scope:** `url:POST|/api/v1/calendar_events`

Create and return a new calendar event

#### Request Parameters:

| Parameter                                           | Type              | Description                                                                                                                                                                                                                                                    |
| --------------------------------------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `calendar_event[context_code]`                      | Required `string` | <p>Context code of the course, group, user, or account whose calendar<br>this event should be added to.</p>                                                                                                                                                    |
| `calendar_event[title]`                             | `string`          | Short title for the calendar event.                                                                                                                                                                                                                            |
| `calendar_event[description]`                       | `string`          | Longer HTML description of the event.                                                                                                                                                                                                                          |
| `calendar_event[start_at]`                          | `DateTime`        | Start date/time of the event.                                                                                                                                                                                                                                  |
| `calendar_event[end_at]`                            | `DateTime`        | End date/time of the event.                                                                                                                                                                                                                                    |
| `calendar_event[location_name]`                     | `string`          | Location name of the event.                                                                                                                                                                                                                                    |
| `calendar_event[location_address]`                  | `string`          | Location address                                                                                                                                                                                                                                               |
| `calendar_event[time_zone_edited]`                  | `string`          | <p>Time zone of the user editing the event. Allowed time zones are<br><a href="http://www.iana.org/time-zones">IANA time zones</a> or friendlier<br><a href="http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html">Ruby on Rails time zones</a>.</p> |
| `calendar_event[all_day]`                           | `boolean`         | When true event is considered to span the whole day and times are ignored.                                                                                                                                                                                     |
| `calendar_event[child_event_data][X][start_at]`     | `DateTime`        | <p>Section-level start time(s) if this is a course event. X can be any<br>identifier, provided that it is consistent across the start\_at, end\_at<br>and context\_code</p>                                                                                    |
| `calendar_event[child_event_data][X][end_at]`       | `DateTime`        | Section-level end time(s) if this is a course event.                                                                                                                                                                                                           |
| `calendar_event[child_event_data][X][context_code]` | `string`          | Context code(s) corresponding to the section-level start and end time(s).                                                                                                                                                                                      |
| `calendar_event[duplicate][count]`                  | `number`          | Number of times to copy/duplicate the event. Count cannot exceed 200.                                                                                                                                                                                          |
| `calendar_event[duplicate][interval]`               | `number`          | Defaults to 1 if duplicate `count` is set. The interval between the duplicated events.                                                                                                                                                                         |
| `calendar_event[duplicate][frequency]`              | `string`          | Defaults to "weekly". The frequency at which to duplicate the event Allowed values: `daily`, `weekly`, `monthly`                                                                                                                                               |
| `calendar_event[duplicate][append_iterator]`        | `boolean`         | <p>Defaults to false. If set to <code>true</code>, an increasing counter number will be appended to the event title<br>when the event is duplicated. (e.g. Event 1, Event 2, Event 3, etc)</p>                                                                 |
| `calendar_event[rrule]`                             | `string`          | <p>The recurrence rule to create a series of recurring events.<br>Its value is the <a href="https://icalendar.org/iCalendar-RFC-5545/3-8-5-3-recurrence-rule.html">iCalendar RRULE</a><br>defining how the event repeats. Unending series not supported.</p>   |
| `calendar_event[blackout_date]`                     | `boolean`         | <p>If the blackout\_date is true, this event represents a holiday or some<br>other special day that does not count in course pacing.</p>                                                                                                                       |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/calendar_events.json' \
     -X POST \
     -F 'calendar_event[context_code]=course_123' \
     -F 'calendar_event[title]=Paintball Fight!' \
     -F 'calendar_event[start_at]=2012-07-19T21:00:00Z' \
     -F 'calendar_event[end_at]=2012-07-19T22:00:00Z' \
     -H "Authorization: Bearer <token>"
```

## [Get a single calendar event or assignment](#method.calendar_events_api.show) <a href="#method.calendar_events_api.show" id="method.calendar_events_api.show"></a>

[CalendarEventsApiController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `GET /api/v1/calendar_events/:id`

**Scope:** `url:GET|/api/v1/calendar_events/:id`

Returns detailed information about a specific calendar event or assignment.

Returns a [CalendarEvent](#calendarevent) object.

## [Reserve a time slot](#method.calendar_events_api.reserve) <a href="#method.calendar_events_api.reserve" id="method.calendar_events_api.reserve"></a>

[CalendarEventsApiController#reserve](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `POST /api/v1/calendar_events/:id/reservations`

**Scope:** `url:POST|/api/v1/calendar_events/:id/reservations`

#### `POST /api/v1/calendar_events/:id/reservations/:participant_id`

**Scope:** `url:POST|/api/v1/calendar_events/:id/reservations/:participant_id`

Reserves a particular time slot and return the new reservation

#### Request Parameters:

| Parameter         | Type      | Description                                                                                                                                                     |
| ----------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `participant_id`  | `string`  | <p>User or group id for whom you are making the reservation (depends on the<br>participant type). Defaults to the current user (or user's candidate group).</p> |
| `comments`        | `string`  | Comments to associate with this reservation                                                                                                                     |
| `cancel_existing` | `boolean` | <p>Defaults to false. If true, cancel any previous reservation(s) for this<br>participant and appointment group.</p>                                            |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/calendar_events/345/reservations.json' \
     -X POST \
     -F 'cancel_existing=true' \
     -H "Authorization: Bearer <token>"
```

## [Update a calendar event](#method.calendar_events_api.update) <a href="#method.calendar_events_api.update" id="method.calendar_events_api.update"></a>

[CalendarEventsApiController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `PUT /api/v1/calendar_events/:id`

**Scope:** `url:PUT|/api/v1/calendar_events/:id`

Update and return a calendar event

#### Request Parameters:

| Parameter                                           | Type       | Description                                                                                                                                                                                                                                                                                                                                                                                                                  |
| --------------------------------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `calendar_event[context_code]`                      | `string`   | <p>Context code of the course, group, user, or account to move this event to.<br>Scheduler appointments and events with section-specific times cannot be moved between calendars.</p>                                                                                                                                                                                                                                        |
| `calendar_event[title]`                             | `string`   | Short title for the calendar event.                                                                                                                                                                                                                                                                                                                                                                                          |
| `calendar_event[description]`                       | `string`   | Longer HTML description of the event.                                                                                                                                                                                                                                                                                                                                                                                        |
| `calendar_event[start_at]`                          | `DateTime` | Start date/time of the event.                                                                                                                                                                                                                                                                                                                                                                                                |
| `calendar_event[end_at]`                            | `DateTime` | End date/time of the event.                                                                                                                                                                                                                                                                                                                                                                                                  |
| `calendar_event[location_name]`                     | `string`   | Location name of the event.                                                                                                                                                                                                                                                                                                                                                                                                  |
| `calendar_event[location_address]`                  | `string`   | Location address                                                                                                                                                                                                                                                                                                                                                                                                             |
| `calendar_event[time_zone_edited]`                  | `string`   | <p>Time zone of the user editing the event. Allowed time zones are<br><a href="http://www.iana.org/time-zones">IANA time zones</a> or friendlier<br><a href="http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html">Ruby on Rails time zones</a>.</p>                                                                                                                                                               |
| `calendar_event[all_day]`                           | `boolean`  | When true event is considered to span the whole day and times are ignored.                                                                                                                                                                                                                                                                                                                                                   |
| `calendar_event[child_event_data][X][start_at]`     | `DateTime` | <p>Section-level start time(s) if this is a course event. X can be any<br>identifier, provided that it is consistent across the start\_at, end\_at<br>and context\_code</p>                                                                                                                                                                                                                                                  |
| `calendar_event[child_event_data][X][end_at]`       | `DateTime` | Section-level end time(s) if this is a course event.                                                                                                                                                                                                                                                                                                                                                                         |
| `calendar_event[child_event_data][X][context_code]` | `string`   | Context code(s) corresponding to the section-level start and end time(s).                                                                                                                                                                                                                                                                                                                                                    |
| `calendar_event[rrule]`                             | `string`   | <p>Valid if the event whose ID is in the URL is part of a series.<br>This defines the shape of the recurring event series after it's updated.<br>Its value is the iCalendar RRULE. Unending series are not supported.</p>                                                                                                                                                                                                    |
| `which`                                             | `string`   | <p>Valid if the event whose ID is in the URL is part of a series.<br>Update just the event whose ID is in in the URL, all events<br>in the series, or the given event and all those following.<br>Some updates may create a new series. For example, changing the start time<br>of this and all following events from the middle of a series. Allowed values: <code>one</code>, <code>all</code>, <code>following</code></p> |
| `calendar_event[blackout_date]`                     | `boolean`  | <p>If the blackout\_date is true, this event represents a holiday or some<br>other special day that does not count in course pacing.</p>                                                                                                                                                                                                                                                                                     |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/calendar_events/234' \
     -X PUT \
     -F 'calendar_event[title]=Epic Paintball Fight!' \
     -H "Authorization: Bearer <token>"
```

## [Delete a calendar event](#method.calendar_events_api.destroy) <a href="#method.calendar_events_api.destroy" id="method.calendar_events_api.destroy"></a>

[CalendarEventsApiController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `DELETE /api/v1/calendar_events/:id`

**Scope:** `url:DELETE|/api/v1/calendar_events/:id`

Delete an event from the calendar and return the deleted event

#### Request Parameters:

| Parameter       | Type     | Description                                                                                                                                                                                                                                                                   |
| --------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cancel_reason` | `string` | Reason for deleting/canceling the event.                                                                                                                                                                                                                                      |
| `which`         | `string` | <p>Valid if the event whose ID is in the URL is part of a series.<br>Delete just the event whose ID is in in the URL, all events<br>in the series, or the given event and all those following. Allowed values: <code>one</code>, <code>all</code>, <code>following</code></p> |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/calendar_events/234' \
     -X DELETE \
     -F 'cancel_reason=Greendale layed off the janitorial staff :(' \
     -F 'which=following'
     -H "Authorization: Bearer <token>"
```

## [Save enabled account calendars](#method.calendar_events_api.save_enabled_account_calendars) <a href="#method.calendar_events_api.save_enabled_account_calendars" id="method.calendar_events_api.save_enabled_account_calendars"></a>

[CalendarEventsApiController#save\_enabled\_account\_calendars](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `POST /api/v1/calendar_events/save_enabled_account_calendars`

**Scope:** `url:POST|/api/v1/calendar_events/save_enabled_account_calendars`

Creates and updates the enabled\_account\_calendars and mark\_feature\_as\_seen user preferences

#### Request Parameters:

| Parameter                     | Type      | Description                                                           |
| ----------------------------- | --------- | --------------------------------------------------------------------- |
| `mark_feature_as_seen`        | `boolean` | Flag to mark account calendars feature as seen                        |
| `enabled_account_calendars[]` | `Array`   | An array of account Ids to remember in the calendars list of the user |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/calendar_events/save_enabled_account_calendars' \
     -X POST \
     -F 'mark_feature_as_seen=true' \
     -F 'enabled_account_calendars[]=1' \
     -F 'enabled_account_calendars[]=2' \
     -H "Authorization: Bearer <token>"
```

## [Set a course timetable](#method.calendar_events_api.set_course_timetable) <a href="#method.calendar_events_api.set_course_timetable" id="method.calendar_events_api.set_course_timetable"></a>

[CalendarEventsApiController#set\_course\_timetable](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `POST /api/v1/courses/:course_id/calendar_events/timetable`

**Scope:** `url:POST|/api/v1/courses/:course_id/calendar_events/timetable`

Creates and updates "timetable" events for a course. Can automaticaly generate a series of calendar events based on simple schedules (e.g. "Monday and Wednesday at 2:00pm" )

Existing timetable events for the course and course sections will be updated if they still are part of the timetable. Otherwise, they will be deleted.

#### Request Parameters:

| Parameter                                        | Type     | Description                                                                                                                                                                            |
| ------------------------------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `timetables[course_section_id][]`                | `Array`  | <p>An array of timetable objects for the course section specified by course\_section\_id.<br>If course\_section\_id is set to "all", events will be created for the entire course.</p> |
| `timetables[course_section_id][][weekdays]`      | `string` | <p>A comma-separated list of abbreviated weekdays<br>(Mon-Monday, Tue-Tuesday, Wed-Wednesday, Thu-Thursday, Fri-Friday, Sat-Saturday, Sun-Sunday)</p>                                  |
| `timetables[course_section_id][][start_time]`    | `string` | Time to start each event at (e.g. "9:00 am")                                                                                                                                           |
| `timetables[course_section_id][][end_time]`      | `string` | Time to end each event at (e.g. "9:00 am")                                                                                                                                             |
| `timetables[course_section_id][][location_name]` | `string` | A location name to set for each event                                                                                                                                                  |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/calendar_events/timetable' \
     -X POST \
     -F 'timetables[all][][weekdays]=Mon,Wed,Fri' \
     -F 'timetables[all][][start_time]=11:00 am' \
     -F 'timetables[all][][end_time]=11:50 am' \
     -F 'timetables[all][][location_name]=Room 237' \
     -H "Authorization: Bearer <token>"
```

## [Get course timetable](#method.calendar_events_api.get_course_timetable) <a href="#method.calendar_events_api.get_course_timetable" id="method.calendar_events_api.get_course_timetable"></a>

[CalendarEventsApiController#get\_course\_timetable](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `GET /api/v1/courses/:course_id/calendar_events/timetable`

**Scope:** `url:GET|/api/v1/courses/:course_id/calendar_events/timetable`

Returns the last timetable set by the [Set a course timetable](#method.calendar_events_api.set_course_timetable) endpoint

## [Create or update events directly for a course timetable](#method.calendar_events_api.set_course_timetable_events) <a href="#method.calendar_events_api.set_course_timetable_events" id="method.calendar_events_api.set_course_timetable_events"></a>

[CalendarEventsApiController#set\_course\_timetable\_events](https://github.com/instructure/canvas-lms/blob/master/app/controllers/calendar_events_api_controller.rb)

#### `POST /api/v1/courses/:course_id/calendar_events/timetable_events`

**Scope:** `url:POST|/api/v1/courses/:course_id/calendar_events/timetable_events`

Creates and updates "timetable" events for a course or course section. Similar to [setting a course timetable](#method.calendar_events_api.set_course_timetable), but instead of generating a list of events based on a timetable schedule, this endpoint expects a complete list of events.

#### Request Parameters:

| Parameter                 | Type       | Description                                                                                                                                                                  |
| ------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `course_section_id`       | `string`   | <p>Events will be created for the course section specified by course\_section\_id.<br>If not present, events will be created for the entire course.</p>                      |
| `events[]`                | `Array`    | An array of event objects to use.                                                                                                                                            |
| `events[][start_at]`      | `DateTime` | Start time for the event                                                                                                                                                     |
| `events[][end_at]`        | `DateTime` | End time for the event                                                                                                                                                       |
| `events[][location_name]` | `string`   | Location name for the event                                                                                                                                                  |
| `events[][code]`          | `string`   | <p>A unique identifier that can be used to update the event at a later time<br>If one is not specified, an identifier will be generated based on the start and end times</p> |
| `events[][title]`         | `string`   | Title for the meeting. If not present, will default to the associated course's name                                                                                          |

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Canvas Career Experiences

API for managing user career experience and role preferences in Canvas.

#### An ExperienceSummary object looks like: <a href="#experiencesummary" id="experiencesummary"></a>

```js
{
  // The current active experience. One of: 'academic', 'career_learner',
  // 'career_learning_provider'.
  "current_app": "career_learner",
  // List of available experiences for the user. Can include: 'academic',
  // 'career_learner', 'career_learning_provider'.
  "available_apps": ["academic", "career_learner"]
}
```

## [Check if Canvas Career is enabled](#method.career_experience.enabled) <a href="#method.career_experience.enabled" id="method.career_experience.enabled"></a>

[CareerExperienceController#enabled](https://github.com/instructure/canvas-lms/blob/master/app/controllers/career_experience_controller.rb)

#### `GET /api/v1/career/enabled`

**Scope:** `url:GET|/api/v1/career/enabled`

Returns whether the root account has Canvas Career (Horizon) enabled in at least one subaccount.

#### Example Request:

```bash
curl https://<canvas>/api/v1/career/enabled \
  -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{"enabled": true}
```

## [Get current and available experiences](#method.career_experience.experience_summary) <a href="#method.career_experience.experience_summary" id="method.career_experience.experience_summary"></a>

[CareerExperienceController#experience\_summary](https://github.com/instructure/canvas-lms/blob/master/app/controllers/career_experience_controller.rb)

#### `GET /api/v1/career/experience_summary`

**Scope:** `url:GET|/api/v1/career/experience_summary`

Returns the current user's active experience and available experiences they can switch to.

#### Example Request:

```bash
curl https://<canvas>/api/v1/career/experience_summary \
  -H 'Authorization: Bearer <token>'
```

Returns an [ExperienceSummary](#experiencesummary) object.

## [Switch experience](#method.career_experience.switch_experience) <a href="#method.career_experience.switch_experience" id="method.career_experience.switch_experience"></a>

[CareerExperienceController#switch\_experience](https://github.com/instructure/canvas-lms/blob/master/app/controllers/career_experience_controller.rb)

#### `POST /api/v1/career/switch_experience`

**Scope:** `url:POST|/api/v1/career/switch_experience`

Switch the current user's active experience to the specified one.

#### Request Parameters:

| Parameter    | Type              | Description                                                       |
| ------------ | ----------------- | ----------------------------------------------------------------- |
| `experience` | Required `string` | The experience to switch to. Allowed values: `academic`, `career` |

#### Example Request:

```bash
curl -X POST https://<canvas>/api/v1/career/switch_experience \
  -H 'Authorization: Bearer <token>' \
  -d 'experience=academic'
```

## [Switch role](#method.career_experience.switch_role) <a href="#method.career_experience.switch_role" id="method.career_experience.switch_role"></a>

[CareerExperienceController#switch\_role](https://github.com/instructure/canvas-lms/blob/master/app/controllers/career_experience_controller.rb)

#### `POST /api/v1/career/switch_role`

**Scope:** `url:POST|/api/v1/career/switch_role`

Switch the current user's role within the current experience.

#### Request Parameters:

| Parameter | Type              | Description                                                           |
| --------- | ----------------- | --------------------------------------------------------------------- |
| `role`    | Required `string` | The role to switch to. Allowed values: `learner`, `learning_provider` |

#### Example Request:

```bash
curl -X POST https://<canvas>/api/v1/career/switch_role \
  -H 'Authorization: Bearer <token>' \
  -d 'role=learner'
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Canvas Career User Context

Consolidated API for retrieving all user context data needed by Journey in a single request. Replaces separate calls to permissions, experience\_summary, enrollments, and admin roles endpoints.

#### A CareerUserContext object looks like: <a href="#careerusercontext" id="careerusercontext"></a>

```js
{
  // Account permission checks for the authenticated user.
  "permissions": null,
  // Career experience summary including current app and available apps.
  "experience": null,
  // Distinct enrollment types for the user (active, invited, and pending).
  "enrollment_types": null,
  // Admin roles on the domain root account.
  "admin_roles": null,
  // Whether the user is a site admin.
  "is_site_admin": null,
  // Whether the user admins a subaccount under the domain root. When account_id
  // is provided, true only if the user can admin that specific account.
  "is_subaccount_admin": null,
  // Whether the user is an admin on the domain root account or a site admin.
  "is_root_account_admin": null,
  // Whether the resolved account (account_id, or the domain root when omitted) is
  // itself a root account rather than a sub-account.
  "is_root_account": null
}
```

## [Get career user context](#method.career_user_context.show) <a href="#method.career_user_context.show" id="method.career_user_context.show"></a>

[CareerUserContextController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/career_user_context_controller.rb)

#### `GET /api/v1/career/user_context`

**Scope:** `url:GET|/api/v1/career/user_context`

Returns consolidated user context data for Journey, combining account permissions, career experience info, enrollment types, admin roles, and site admin status in a single response.

#### Request Parameters:

| Parameter    | Type     | Description                                                                                                                                                                                                                                     |
| ------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `account_id` | `string` | <p>Canvas account ID for permission and subaccount admin checks. Defaults<br>to the domain root account ("self"). Other fields (experience,<br>enrollment\_types, admin\_roles, is\_site\_admin) always resolve against<br>the domain root.</p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/career/user_context \
  -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "permissions": {"manage": true, "manage_site_settings": false, ...},
  "experience": {"current_app": "career_learner", "available_apps": ["career_learner"]},
  "enrollment_types": ["StudentEnrollment", "TeacherEnrollment"],
  "admin_roles": [{"role": "AccountAdmin"}],
  "is_site_admin": false,
  "is_subaccount_admin": false,
  "is_root_account": true
}
```

Returns a [CareerUserContext](#careerusercontext) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Collaborations

API for accessing course and group collaboration information.

#### A Collaboration object looks like: <a href="#collaboration" id="collaboration"></a>

```js
{
  // The unique identifier for the collaboration
  "id": 43,
  // A name for the type of collaboration
  "collaboration_type": "Microsoft Office",
  // The collaboration document identifier for the collaboration provider
  "document_id": "oinwoenfe8w8ef_onweufe89fef",
  // The canvas id of the user who created the collaboration
  "user_id": 92,
  // The canvas id of the course or group to which the collaboration belongs
  "context_id": 77,
  // The canvas type of the course or group to which the collaboration belongs
  "context_type": "Course",
  // The LTI launch url to view collaboration.
  "url": null,
  // The timestamp when the collaboration was created
  "created_at": "2012-06-01T00:00:00-06:00",
  // The timestamp when the collaboration was last modified
  "updated_at": "2012-06-01T00:00:00-06:00",
  "description": null,
  "title": null,
  // Another representation of the collaboration type
  "type": "ExternalToolCollaboration",
  // The LTI launch url to edit the collaboration
  "update_url": null,
  // The name of the user who owns the collaboration
  "user_name": "John Danger"
}
```

#### A Collaborator object looks like: <a href="#collaborator" id="collaborator"></a>

```js
{
  // The unique user or group identifier for the collaborator.
  "id": 12345,
  // The type of collaborator (e.g. 'user' or 'group').
  "type": "user",
  // The name of the collaborator.
  "name": "Don Draper"
}
```

## [List collaborations](#method.collaborations.api_index) <a href="#method.collaborations.api_index" id="method.collaborations.api_index"></a>

[CollaborationsController#api\_index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/collaborations_controller.rb)

#### `GET /api/v1/courses/:course_id/collaborations`

**Scope:** `url:GET|/api/v1/courses/:course_id/collaborations`

#### `GET /api/v1/groups/:group_id/collaborations`

**Scope:** `url:GET|/api/v1/groups/:group_id/collaborations`

A paginated list of collaborations the current user has access to in the context of the course provided in the url. NOTE: this only returns ExternalToolCollaboration type collaborations.

curl https\://\<canvas>/api/v1/courses/1/collaborations/

Returns a list of [Collaboration](#collaboration) objects.

## [List members of a collaboration.](#method.collaborations.members) <a href="#method.collaborations.members" id="method.collaborations.members"></a>

[CollaborationsController#members](https://github.com/instructure/canvas-lms/blob/master/app/controllers/collaborations_controller.rb)

#### `GET /api/v1/collaborations/:id/members`

**Scope:** `url:GET|/api/v1/collaborations/:id/members`

A paginated list of the collaborators of a given collaboration

#### Request Parameters:

| Parameter   | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]` | `string` | <p>- "collaborator\_lti\_id": Optional information to include with each member.<br>Represents an identifier to be used for the member in an LTI context.<br>- "avatar\_image\_url": Optional information to include with each member.<br>The url for the avatar of a collaborator with type 'user'. Allowed values: <code>collaborator\_lti\_id</code>, <code>avatar\_image\_url</code></p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/collaborations/1/members
```

Returns a list of [Collaborator](#collaborator) objects.

## [List potential members](#method.collaborations.potential_collaborators) <a href="#method.collaborations.potential_collaborators" id="method.collaborations.potential_collaborators"></a>

[CollaborationsController#potential\_collaborators](https://github.com/instructure/canvas-lms/blob/master/app/controllers/collaborations_controller.rb)

#### `GET /api/v1/courses/:course_id/potential_collaborators`

**Scope:** `url:GET|/api/v1/courses/:course_id/potential_collaborators`

#### `GET /api/v1/groups/:group_id/potential_collaborators`

**Scope:** `url:GET|/api/v1/groups/:group_id/potential_collaborators`

A paginated list of the users who can potentially be added to a collaboration in the given context.

For courses, this consists of all enrolled users. For groups, it is comprised of the group members plus the admins of the course containing the group.

Returns a list of [User](/services/canvas/resources/users#user) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# CommMessages

API for accessing the messages (emails, sms, etc) that have been sent to a user.

#### A CommMessage object looks like: <a href="#commmessage" id="commmessage"></a>

```js
{
  // The ID of the CommMessage.
  "id": 42,
  // The date and time this message was created
  "created_at": "2013-03-19T21:00:00Z",
  // The date and time this message was sent
  "sent_at": "2013-03-20T22:42:00Z",
  // The workflow state of the message. Possible values: 'created' : The message
  // has been created, but not yet processed. 'staged' : The message is queued for
  // sending. 'sending' : The message is being sent currently. 'sent' : The
  // message has been successfully sent. 'bounced' : An error occurred during the
  // sending of the message.'dashboard' : The message has been sent to the
  // dashboard. 'closed' :  The message has been sent and closed, typically for
  // dashboard messages or messages sent to deleted users. 'cancelled' : The
  // message was cancelled before it could be sent.
  "workflow_state": "sent",
  // The address that was put in the 'from' field of the message
  "from": "notifications@example.com",
  // The display name for the from address
  "from_name": "Instructure Canvas",
  // The address the message was sent to:
  "to": "someone@example.com",
  // The reply_to header of the message
  "reply_to": "notifications+specialdata@example.com",
  // The message subject
  "subject": "example subject line",
  // The plain text body of the message
  "body": "This is the body of the message",
  // The HTML body of the message.
  "html_body": "<html><body>This is the body of the message</body></html>"
}
```

## [List of CommMessages for a user](#method.comm_messages_api.index) <a href="#method.comm_messages_api.index" id="method.comm_messages_api.index"></a>

[CommMessagesApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/comm_messages_api_controller.rb)

#### `GET /api/v1/comm_messages`

**Scope:** `url:GET|/api/v1/comm_messages`

Retrieve a paginated list of messages sent to a user.

#### Request Parameters:

| Parameter    | Type              | Description                                                                                                                       |
| ------------ | ----------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `user_id`    | Required `string` | The user id for whom you want to retrieve CommMessages                                                                            |
| `start_time` | `DateTime`        | <p>The beginning of the time range you want to retrieve message from.<br>Up to a year prior to the current date is available.</p> |
| `end_time`   | `DateTime`        | <p>The end of the time range you want to retrieve messages for.<br>Up to a year prior to the current date is available.</p>       |

Returns a list of [CommMessage](#commmessage) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Communication Channels

API for accessing users' email and SMS communication channels.

In this API, the `:user_id` parameter can always be replaced with `self` if the requesting user is asking for his/her own information.

#### A CommunicationChannel object looks like: <a href="#communicationchannel" id="communicationchannel"></a>

```js
{
  // The ID of the communication channel.
  "id": 16,
  // The address, or path, of the communication channel.
  "address": "sheldon@caltech.example.com",
  // The type of communcation channel being described. Possible values are:
  // 'email', 'push', 'sms'. This field determines the type of value seen in
  // 'address'.
  "type": "email",
  // The position of this communication channel relative to the user's other
  // channels when they are ordered.
  "position": 1,
  // The ID of the user that owns this communication channel.
  "user_id": 1,
  // The number of bounces the channel has experienced. This is reset if the
  // channel sends successfully.
  "bounce_count": 0,
  // The time the last bounce occurred.
  "last_bounce_at": "2012-05-30T17:00:00Z",
  // The current state of the communication channel. Possible values are:
  // 'unconfirmed' or 'active'.
  "workflow_state": "active"
}
```

## [List user communication channels](#method.communication_channels.index) <a href="#method.communication_channels.index" id="method.communication_channels.index"></a>

[CommunicationChannelsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/communication_channels_controller.rb)

#### `GET /api/v1/users/:user_id/communication_channels`

**Scope:** `url:GET|/api/v1/users/:user_id/communication_channels`

Returns a paginated list of communication channels for the specified user, sorted by position.

#### Example Request:

```bash
curl https://<canvas>/api/v1/users/12345/communication_channels \
     -H 'Authorization: Bearer <token>'
```

Returns a list of [CommunicationChannel](#communicationchannel) objects.

## [Create a communication channel](#method.communication_channels.create) <a href="#method.communication_channels.create" id="method.communication_channels.create"></a>

[CommunicationChannelsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/communication_channels_controller.rb)

#### `POST /api/v1/users/:user_id/communication_channels`

**Scope:** `url:POST|/api/v1/users/:user_id/communication_channels`

Creates a new communication channel for the specified user.

#### Request Parameters:

| Parameter                        | Type              | Description                                                                                                                                                                                                                                                                                                                                                                                                                          |
| -------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `communication_channel[address]` | Required `string` | An email address or SMS number. Not required for "push" type channels.                                                                                                                                                                                                                                                                                                                                                               |
| `communication_channel[type]`    | Required `string` | <p>The type of communication channel.<br>In order to enable push notification support, the server must be<br>properly configured (via <code>sns\_creds</code> in Vault) to communicate with Amazon<br>Simple Notification Services, and the developer key used to create<br>the access token from this request must have an SNS ARN configured on<br>it. Allowed values: <code>email</code>, <code>sms</code>, <code>push</code></p> |
| `communication_channel[token]`   | `string`          | <p>A registration id, device token, or equivalent token given to an app when<br>registering with a push notification provider. Only valid for "push" type channels.</p>                                                                                                                                                                                                                                                              |
| `skip_confirmation`              | `boolean`         | <p>Only valid for site admins and account admins making requests; If true, the channel is<br>automatically validated and no confirmation email or SMS is sent.<br>Otherwise, the user must respond to a confirmation message to confirm the<br>channel.</p>                                                                                                                                                                          |

#### Example Request:

```bash
curl https://<canvas>/api/v1/users/1/communication_channels \
     -H 'Authorization: Bearer <token>' \
     -d 'communication_channel[address]=new@example.com' \
     -d 'communication_channel[type]=email' \
```

Returns a [CommunicationChannel](#communicationchannel) object.

## [Delete a communication channel](#method.communication_channels.destroy) <a href="#method.communication_channels.destroy" id="method.communication_channels.destroy"></a>

[CommunicationChannelsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/communication_channels_controller.rb)

#### `DELETE /api/v1/users/:user_id/communication_channels/:id`

**Scope:** `url:DELETE|/api/v1/users/:user_id/communication_channels/:id`

#### `DELETE /api/v1/users/:user_id/communication_channels/:type/:address`

**Scope:** `url:DELETE|/api/v1/users/:user_id/communication_channels/:type/:address`

Delete an existing communication channel.

#### Example Request:

```bash
curl https://<canvas>/api/v1/users/5/communication_channels/3
     -H 'Authorization: Bearer <token>
     -X DELETE
```

Returns a [CommunicationChannel](#communicationchannel) object.

## [Delete a push notification endpoint](#method.communication_channels.delete_push_token) <a href="#method.communication_channels.delete_push_token" id="method.communication_channels.delete_push_token"></a>

[CommunicationChannelsController#delete\_push\_token](https://github.com/instructure/canvas-lms/blob/master/app/controllers/communication_channels_controller.rb)

#### `DELETE /api/v1/users/self/communication_channels/push`

**Scope:** `url:DELETE|/api/v1/users/self/communication_channels/push`

#### Example Request:

```bash
curl https://<canvas>/api/v1/users/self/communication_channels/push
     -H 'Authorization: Bearer <token>
     -X DELETE
     -d 'push_token=<push_token>'
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Conferences

API for accessing information on conferences.

#### A ConferenceRecording object looks like: <a href="#conferencerecording" id="conferencerecording"></a>

```js
{
  "duration_minutes": 0,
  "title": "course2: Test conference 3 [170]_0",
  "updated_at": "2013-12-12T16:09:33.903-07:00",
  "created_at": "2013-12-12T16:09:09.960-07:00",
  "playback_url": "http://example.com/recording_url"
}
```

#### A Conference object looks like: <a href="#conference" id="conference"></a>

```js
{
  // The id of the conference
  "id": 170,
  // The type of conference
  "conference_type": "AdobeConnect",
  // The 3rd party's ID for the conference
  "conference_key": "abcdjoelisgreatxyz",
  // The description for the conference
  "description": "Conference Description",
  // The expected duration the conference is supposed to last
  "duration": 60,
  // The date that the conference ended at, null if it hasn't ended
  "ended_at": "2013-12-13T17:23:26Z",
  // The date the conference started at, null if it hasn't started
  "started_at": "2013-12-12T23:02:17Z",
  // The title of the conference
  "title": "Test conference",
  // Array of user ids that are participants in the conference
  "users": [1, 7, 8, 9, 10],
  // Array of user ids that are invitees in the conference
  "invitees": [1, 7, 8, 9, 10],
  // Array of user ids that are attendees in the conference
  "attendees": [1, 7, 8, 9, 10],
  // True if the conference type has advanced settings.
  "has_advanced_settings": false,
  // If true the conference is long running and has no expected end time
  "long_running": false,
  // A collection of settings specific to the conference type
  "user_settings": {"record":true},
  // A List of recordings for the conference
  "recordings": null,
  // URL for the conference, may be null if the conference type doesn't set it
  "url": null,
  // URL to join the conference, may be null if the conference type doesn't set it
  "join_url": null,
  // The type of this conference's context, typically 'Course' or 'Group'.
  "context_type": null,
  // The ID of this conference's context.
  "context_id": null
}
```

## [List conferences](#method.conferences.index) <a href="#method.conferences.index" id="method.conferences.index"></a>

[ConferencesController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conferences_controller.rb)

#### `GET /api/v1/courses/:course_id/conferences`

**Scope:** `url:GET|/api/v1/courses/:course_id/conferences`

#### `GET /api/v1/groups/:group_id/conferences`

**Scope:** `url:GET|/api/v1/groups/:group_id/conferences`

Retrieve the paginated list of conferences for this context

This API returns a JSON object containing the list of conferences, the key for the list of conferences is "conferences"

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/conferences' \
    -H "Authorization: Bearer <token>"

curl 'https://<canvas>/api/v1/groups/<group_id>/conferences' \
    -H "Authorization: Bearer <token>"
```

Returns a list of [Conference](#conference) objects.

## [List conferences for the current user](#method.conferences.for_user) <a href="#method.conferences.for_user" id="method.conferences.for_user"></a>

[ConferencesController#for\_user](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conferences_controller.rb)

#### `GET /api/v1/conferences`

**Scope:** `url:GET|/api/v1/conferences`

Retrieve the paginated list of conferences for all courses and groups the current user belongs to

This API returns a JSON object containing the list of conferences. The key for the list of conferences is "conferences".

#### Request Parameters:

| Parameter | Type     | Description                                                                                                                                                                              |
| --------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `state`   | `string` | <p>If set to "live", returns only conferences that are live (i.e., have<br>started and not finished yet). If omitted, returns all conferences for<br>this user's groups and courses.</p> |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/conferences' \
    -H "Authorization: Bearer <token>"
```

Returns a list of [Conference](#conference) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Content Exports

API for exporting courses and course content

#### A ContentExport object looks like: <a href="#contentexport" id="contentexport"></a>

```js
{
  // the unique identifier for the export
  "id": 101,
  // the date and time this export was requested
  "created_at": "2014-01-01T00:00:00Z",
  // the type of content migration: 'common_cartridge' or 'qti'
  "export_type": "common_cartridge",
  // attachment api object for the export package (not present before the export
  // completes or after it becomes unavailable for download.)
  "attachment": {"url":"https:\/\/example.com\/api\/v1\/attachments\/789?download_frd=1"},
  // The api endpoint for polling the current progress
  "progress_url": "https://example.com/api/v1/progress/4",
  // The ID of the user who started the export
  "user_id": 4,
  // Current state of the content migration: created exporting exported failed
  "workflow_state": "exported"
}
```

## [List content exports](#method.content_exports_api.index) <a href="#method.content_exports_api.index" id="method.content_exports_api.index"></a>

[ContentExportsApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_exports_api_controller.rb)

#### `GET /api/v1/courses/:course_id/content_exports`

**Scope:** `url:GET|/api/v1/courses/:course_id/content_exports`

#### `GET /api/v1/groups/:group_id/content_exports`

**Scope:** `url:GET|/api/v1/groups/:group_id/content_exports`

#### `GET /api/v1/users/:user_id/content_exports`

**Scope:** `url:GET|/api/v1/users/:user_id/content_exports`

A paginated list of the past and pending content export jobs for a course, group, or user. Exports are returned newest first.

Returns a list of [ContentExport](#contentexport) objects.

## [Show content export](#method.content_exports_api.show) <a href="#method.content_exports_api.show" id="method.content_exports_api.show"></a>

[ContentExportsApiController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_exports_api_controller.rb)

#### `GET /api/v1/courses/:course_id/content_exports/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/content_exports/:id`

#### `GET /api/v1/groups/:group_id/content_exports/:id`

**Scope:** `url:GET|/api/v1/groups/:group_id/content_exports/:id`

#### `GET /api/v1/users/:user_id/content_exports/:id`

**Scope:** `url:GET|/api/v1/users/:user_id/content_exports/:id`

Get information about a single content export.

Returns a [ContentExport](#contentexport) object.

## [Export content](#method.content_exports_api.create) <a href="#method.content_exports_api.create" id="method.content_exports_api.create"></a>

[ContentExportsApiController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_exports_api_controller.rb)

#### `POST /api/v1/courses/:course_id/content_exports`

**Scope:** `url:POST|/api/v1/courses/:course_id/content_exports`

#### `POST /api/v1/groups/:group_id/content_exports`

**Scope:** `url:POST|/api/v1/groups/:group_id/content_exports`

#### `POST /api/v1/users/:user_id/content_exports`

**Scope:** `url:POST|/api/v1/users/:user_id/content_exports`

Begin a content export job for a course, group, or user.

You can use the [Progress API](https://developerdocs.instructure.com/services/canvas/resources/pages/3xnEhMZQuJstdXB8KHiv#method.progress.show) to track the progress of the export. The migration's progress is linked to with the *progress\_url* value.

When the export completes, use the [Show content export](#method.content_exports_api.show) endpoint to retrieve a download URL for the exported content.

#### Request Parameters:

| Parameter            | Type              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| -------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `export_type`        | Required `string` | <p>"common\_cartridge":: Export the contents of the course in the Common Cartridge (.imscc) format<br>"qti":: Export quizzes from a course in the QTI format<br>"zip":: Export files from a course, group, or user in a zip file Allowed values: <code>common\_cartridge</code>, <code>qti</code>, <code>zip</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `skip_notifications` | `boolean`         | Don't send the notifications about the export to the user. Default: false                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `select`             | `Hash`            | <p>The select parameter allows exporting specific data. The keys are object types like 'files',<br>'folders', 'pages', etc. The value for each key is a list of object ids. An id can be an<br>integer or a string.<br>Multiple object types can be selected in the same call. However, not all object types are<br>valid for every export\_type. Common Cartridge supports all object types. Zip and QTI only<br>support the object types as described below.<br>"folders":: Also supported for zip export\_type.<br>"files":: Also supported for zip export\_type.<br>"quizzes":: Also supported for qti export\_type. Allowed values: <code>folders</code>, <code>files</code>, <code>attachments</code>, <code>quizzes</code>, <code>assignments</code>, <code>announcements</code>, <code>calendar\_events</code>, <code>discussion\_topics</code>, <code>modules</code>, <code>module\_items</code>, <code>pages</code>, <code>rubrics</code></p> |

Returns a [ContentExport](#contentexport) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Content Migrations

API for accessing content migrations and migration issues

#### A MigrationIssue object looks like: <a href="#migrationissue" id="migrationissue"></a>

```js
{
  // the unique identifier for the issue
  "id": 370663,
  // API url to the content migration
  "content_migration_url": "https://example.com/api/v1/courses/1/content_migrations/1",
  // Description of the issue for the end-user
  "description": "Questions in this quiz couldn't be converted",
  // Current state of the issue: active, resolved
  "workflow_state": "active",
  // HTML Url to the Canvas page to investigate the issue
  "fix_issue_html_url": "https://example.com/courses/1/quizzes/2",
  // Severity of the issue: todo, warning, error
  "issue_type": "warning",
  // Link to a Canvas error report if present (If the requesting user has
  // permissions)
  "error_report_html_url": "https://example.com/error_reports/3",
  // Site administrator error message (If the requesting user has permissions)
  "error_message": "admin only message",
  // timestamp
  "created_at": "2012-06-01T00:00:00-06:00",
  // timestamp
  "updated_at": "2012-06-01T00:00:00-06:00"
}
```

#### A ContentMigration object looks like: <a href="#contentmigration" id="contentmigration"></a>

```js
{
  // the unique identifier for the migration
  "id": 370663,
  // the type of content migration
  "migration_type": "common_cartridge_importer",
  // the name of the content migration type
  "migration_type_title": "Canvas Cartridge Importer",
  // API url to the content migration's issues
  "migration_issues_url": "https://example.com/api/v1/courses/1/content_migrations/1/migration_issues",
  // attachment api object for the uploaded file may not be present for all
  // migrations
  "attachment": "{"url"=>"https://example.com/api/v1/courses/1/content_migrations/1/download_archive"}",
  // The api endpoint for polling the current progress
  "progress_url": "https://example.com/api/v1/progress/4",
  // The user who started the migration
  "user_id": 4,
  // Current state of the content migration: pre_processing, pre_processed,
  // running, waiting_for_select, completed, failed
  "workflow_state": "running",
  // timestamp
  "started_at": "2012-06-01T00:00:00-06:00",
  // timestamp
  "finished_at": "2012-06-01T00:00:00-06:00",
  // file uploading data, see {file:file.file_uploads.html File Upload
  // Documentation} for file upload workflow This works a little differently in
  // that all the file data is in the pre_attachment hash if there is no
  // upload_url then there was an attachment pre-processing error, the error
  // message will be in the message key This data will only be here after a create
  // or update call
  "pre_attachment": "{"upload_url"=>"", "message"=>"file exceeded quota", "upload_params"=>{}}"
}
```

#### A Migrator object looks like: <a href="#migrator" id="migrator"></a>

```js
{
  // The value to pass to the create endpoint
  "type": "common_cartridge_importer",
  // Whether this endpoint requires a file upload
  "requires_file_upload": true,
  // Description of the package type expected
  "name": "Common Cartridge 1.0/1.1/1.2 Package",
  // A list of fields this system requires
  "required_settings": ["source_course_id"]
}
```

## [List migration issues](#method.migration_issues.index) <a href="#method.migration_issues.index" id="method.migration_issues.index"></a>

[MigrationIssuesController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/migration_issues_controller.rb)

#### `GET /api/v1/accounts/:account_id/content_migrations/:content_migration_id/migration_issues`

**Scope:** `url:GET|/api/v1/accounts/:account_id/content_migrations/:content_migration_id/migration_issues`

#### `GET /api/v1/courses/:course_id/content_migrations/:content_migration_id/migration_issues`

**Scope:** `url:GET|/api/v1/courses/:course_id/content_migrations/:content_migration_id/migration_issues`

#### `GET /api/v1/groups/:group_id/content_migrations/:content_migration_id/migration_issues`

**Scope:** `url:GET|/api/v1/groups/:group_id/content_migrations/:content_migration_id/migration_issues`

#### `GET /api/v1/users/:user_id/content_migrations/:content_migration_id/migration_issues`

**Scope:** `url:GET|/api/v1/users/:user_id/content_migrations/:content_migration_id/migration_issues`

Returns paginated migration issues

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/content_migrations/<content_migration_id>/migration_issues \
    -H 'Authorization: Bearer <token>'
```

Returns a list of [MigrationIssue](#migrationissue) objects.

## [Get a migration issue](#method.migration_issues.show) <a href="#method.migration_issues.show" id="method.migration_issues.show"></a>

[MigrationIssuesController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/migration_issues_controller.rb)

#### `GET /api/v1/accounts/:account_id/content_migrations/:content_migration_id/migration_issues/:id`

**Scope:** `url:GET|/api/v1/accounts/:account_id/content_migrations/:content_migration_id/migration_issues/:id`

#### `GET /api/v1/courses/:course_id/content_migrations/:content_migration_id/migration_issues/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/content_migrations/:content_migration_id/migration_issues/:id`

#### `GET /api/v1/groups/:group_id/content_migrations/:content_migration_id/migration_issues/:id`

**Scope:** `url:GET|/api/v1/groups/:group_id/content_migrations/:content_migration_id/migration_issues/:id`

#### `GET /api/v1/users/:user_id/content_migrations/:content_migration_id/migration_issues/:id`

**Scope:** `url:GET|/api/v1/users/:user_id/content_migrations/:content_migration_id/migration_issues/:id`

Returns data on an individual migration issue

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/content_migrations/<content_migration_id>/migration_issues/<id> \
    -H 'Authorization: Bearer <token>'
```

Returns a [MigrationIssue](#migrationissue) object.

## [Update a migration issue](#method.migration_issues.update) <a href="#method.migration_issues.update" id="method.migration_issues.update"></a>

[MigrationIssuesController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/migration_issues_controller.rb)

#### `PUT /api/v1/accounts/:account_id/content_migrations/:content_migration_id/migration_issues/:id`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/content_migrations/:content_migration_id/migration_issues/:id`

#### `PUT /api/v1/courses/:course_id/content_migrations/:content_migration_id/migration_issues/:id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/content_migrations/:content_migration_id/migration_issues/:id`

#### `PUT /api/v1/groups/:group_id/content_migrations/:content_migration_id/migration_issues/:id`

**Scope:** `url:PUT|/api/v1/groups/:group_id/content_migrations/:content_migration_id/migration_issues/:id`

#### `PUT /api/v1/users/:user_id/content_migrations/:content_migration_id/migration_issues/:id`

**Scope:** `url:PUT|/api/v1/users/:user_id/content_migrations/:content_migration_id/migration_issues/:id`

Update the workflow\_state of a migration issue

#### Request Parameters:

| Parameter        | Type              | Description                                                                |
| ---------------- | ----------------- | -------------------------------------------------------------------------- |
| `workflow_state` | Required `string` | Set the workflow\_state of the issue. Allowed values: `active`, `resolved` |

#### Example Request:

```bash
curl -X PUT https://<canvas>/api/v1/courses/<course_id>/content_migrations/<content_migration_id>/migration_issues/<id> \
     -H 'Authorization: Bearer <token>' \
     -F 'workflow_state=resolved'
```

Returns a [MigrationIssue](#migrationissue) object.

## [List content migrations](#method.content_migrations.index) <a href="#method.content_migrations.index" id="method.content_migrations.index"></a>

[ContentMigrationsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_migrations_controller.rb)

#### `GET /api/v1/accounts/:account_id/content_migrations`

**Scope:** `url:GET|/api/v1/accounts/:account_id/content_migrations`

#### `GET /api/v1/courses/:course_id/content_migrations`

**Scope:** `url:GET|/api/v1/courses/:course_id/content_migrations`

#### `GET /api/v1/groups/:group_id/content_migrations`

**Scope:** `url:GET|/api/v1/groups/:group_id/content_migrations`

#### `GET /api/v1/users/:user_id/content_migrations`

**Scope:** `url:GET|/api/v1/users/:user_id/content_migrations`

Returns paginated content migrations

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/content_migrations \
    -H 'Authorization: Bearer <token>'
```

Returns a list of [ContentMigration](#contentmigration) objects.

## [Get a content migration](#method.content_migrations.show) <a href="#method.content_migrations.show" id="method.content_migrations.show"></a>

[ContentMigrationsController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_migrations_controller.rb)

#### `GET /api/v1/accounts/:account_id/content_migrations/:id`

**Scope:** `url:GET|/api/v1/accounts/:account_id/content_migrations/:id`

#### `GET /api/v1/courses/:course_id/content_migrations/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/content_migrations/:id`

#### `GET /api/v1/groups/:group_id/content_migrations/:id`

**Scope:** `url:GET|/api/v1/groups/:group_id/content_migrations/:id`

#### `GET /api/v1/users/:user_id/content_migrations/:id`

**Scope:** `url:GET|/api/v1/users/:user_id/content_migrations/:id`

Returns data on an individual content migration

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/content_migrations/<id> \
    -H 'Authorization: Bearer <token>'
```

Returns a [ContentMigration](#contentmigration) object.

## [Create a content migration](#method.content_migrations.create) <a href="#method.content_migrations.create" id="method.content_migrations.create"></a>

[ContentMigrationsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_migrations_controller.rb)

#### `POST /api/v1/accounts/:account_id/content_migrations`

**Scope:** `url:POST|/api/v1/accounts/:account_id/content_migrations`

#### `POST /api/v1/courses/:course_id/content_migrations`

**Scope:** `url:POST|/api/v1/courses/:course_id/content_migrations`

#### `POST /api/v1/groups/:group_id/content_migrations`

**Scope:** `url:POST|/api/v1/groups/:group_id/content_migrations`

#### `POST /api/v1/users/:user_id/content_migrations`

**Scope:** `url:POST|/api/v1/users/:user_id/content_migrations`

Create a content migration. If the migration requires a file to be uploaded the actual processing of the file will start once the file upload process is completed. File uploading works as described in the [File Upload Documentation](/services/canvas/basics/file.file_uploads) except that the values are set on a *pre\_attachment* sub-hash.

For migrations that don't require a file to be uploaded, like course copy, the processing will begin as soon as the migration is created.

You can use the [Progress API](https://developerdocs.instructure.com/services/canvas/resources/pages/3xnEhMZQuJstdXB8KHiv#method.progress.show) to track the progress of the migration. The migration's progress is linked to with the *progress\_url* value.

The two general workflows are:

If no file upload is needed:

1. POST to create
2. Use the [Progress](https://developerdocs.instructure.com/services/canvas/resources/pages/3xnEhMZQuJstdXB8KHiv#method.progress.show) specified in *progress\_url* to monitor progress

For file uploading:

1. POST to create with file info in *pre\_attachment*
2. Do [file upload processing](/services/canvas/basics/file.file_uploads) using the data in the *pre\_attachment* data
3. [GET](#method.content_migrations.show) the ContentMigration
4. Use the [Progress](https://developerdocs.instructure.com/services/canvas/resources/pages/3xnEhMZQuJstdXB8KHiv#method.progress.show) specified in *progress\_url* to monitor progress

(required if doing .zip file upload)

#### Request Parameters:

| Parameter                                  | Type              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ------------------------------------------ | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `migration_type`                           | Required `string` | <p>The type of the migration. Use the<br><a href="#method.content_migrations.available_migrators">Migrator</a> endpoint to<br>see all available migrators. Default allowed values:<br>canvas\_cartridge\_importer, common\_cartridge\_importer,<br>course\_copy\_importer, zip\_file\_importer, qti\_converter, moodle\_converter</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `pre_attachment[name]`                     | `string`          | <p>Required if uploading a file. This is the first step in uploading a file<br>to the content migration. See the <a href="/pages/80fPGlzKAer00smpJWTq">File Upload Documentation</a> for details on the file upload workflow.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `pre_attachment[*]`                        | `string`          | Other file upload properties, See [File Upload Documentation](/services/canvas/basics/file.file_uploads)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `settings[file_url]`                       | `string`          | A URL to download the file from. Must not require authentication.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `settings[content_export_id]`              | `string`          | <p>The id of a ContentExport to import. This allows you to import content previously exported from Canvas<br>without needing to download and re-upload it.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `settings[source_course_id]`               | `string`          | <p>The course to copy from for a course copy migration. (required if doing<br>course copy)</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `settings[folder_id]`                      | `string`          | The folder to unzip the .zip file into for a zip\_file\_import.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `settings[overwrite_quizzes]`              | `boolean`         | <p>Whether to overwrite quizzes with the same identifiers between content<br>packages.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `settings[question_bank_id]`               | `integer`         | <p>The existing question bank ID to import questions into if not specified in<br>the content package.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `settings[question_bank_name]`             | `string`          | <p>The question bank to import questions into if not specified in the content<br>package, if both bank id and name are set, id will take precedence.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `settings[insert_into_module_id]`          | `integer`         | <p>The id of a module in the target course. This will add all imported items<br>(that can be added to a module) to the given module.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `settings[insert_into_module_type]`        | `string`          | <p>If provided (and +insert\_into\_module\_id+ is supplied),<br>only add objects of the specified type to the module. Allowed values: <code>assignment</code>, <code>discussion\_topic</code>, <code>file</code>, <code>page</code>, <code>quiz</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `settings[insert_into_module_position]`    | `integer`         | <p>The (1-based) position to insert the imported items into the course<br>(if +insert\_into\_module\_id+ is supplied). If this parameter<br>is omitted, items will be added to the end of the module.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `settings[move_to_assignment_group_id]`    | `integer`         | <p>The id of an assignment group in the target course. If provided, all<br>imported assignments will be moved to the given assignment group.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `settings[importer_skips]`                 | `Array`           | Set of importers to skip, even if otherwise selected by migration settings. Allowed values: `all_course_settings`, `visibility_settings`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `settings[import_blueprint_settings]`      | `boolean`         | <p>Import the "use as blueprint course" setting as well as the list of locked items<br>from the source course or package. The destination course must not be associated<br>with an existing blueprint course and cannot have any student or observer enrollments.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `date_shift_options[shift_dates]`          | `boolean`         | Whether to shift dates in the copied course                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `date_shift_options[old_start_date]`       | `Date`            | The original start date of the source content/course                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `date_shift_options[old_end_date]`         | `Date`            | The original end date of the source content/course                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `date_shift_options[new_start_date]`       | `Date`            | The new start date for the content/course                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `date_shift_options[new_end_date]`         | `Date`            | The new end date for the source content/course                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `date_shift_options[day_substitutions][X]` | `integer`         | <p>Move anything scheduled for day 'X' to the specified day. (0-Sunday,<br>1-Monday, 2-Tuesday, 3-Wednesday, 4-Thursday, 5-Friday, 6-Saturday)</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `date_shift_options[remove_dates]`         | `boolean`         | <p>Whether to remove dates in the copied course. Cannot be used<br>in conjunction with <em>shift\_dates</em>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `selective_import`                         | `boolean`         | <p>If set, perform a selective import instead of importing all content.<br>The migration will identify the contents of the package and then stop<br>in the +waiting\_for\_select+ workflow state. At this point, use the<br><a href="#method.content_migrations.content_list">List items endpoint</a><br>to enumerate the contents of the package, identifying the copy<br>parameters for the desired content. Then call the<br><a href="#method.content_migrations.update">Update endpoint</a> and provide these<br>copy parameters to start the import.</p>                                                                                                                                                                                                                                                                                               |
| `select`                                   | `Hash`            | <p>For +course\_copy\_importer+ migrations, this parameter allows you to select<br>the objects to copy without using the +selective\_import+ argument and<br>+waiting\_for\_select+ state as is required for uploaded imports (though that<br>workflow is also supported for course copy migrations).<br>The keys are object types like 'files', 'folders', 'pages', etc. The value<br>for each key is a list of object ids. An id can be an integer or a string.<br>Multiple object types can be selected in the same call. Allowed values: <code>folders</code>, <code>files</code>, <code>attachments</code>, <code>quizzes</code>, <code>assignments</code>, <code>announcements</code>, <code>calendar\_events</code>, <code>discussion\_topics</code>, <code>modules</code>, <code>module\_items</code>, <code>pages</code>, <code>rubrics</code></p> |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/content_migrations' \
     -F 'migration_type=common_cartridge_importer' \
     -F 'settings[question_bank_name]=importquestions' \
     -F 'date_shift_options[old_start_date]=1999-01-01' \
     -F 'date_shift_options[new_start_date]=2013-09-01' \
     -F 'date_shift_options[old_end_date]=1999-04-15' \
     -F 'date_shift_options[new_end_date]=2013-12-15' \
     -F 'date_shift_options[day_substitutions][1]=2' \
     -F 'date_shift_options[day_substitutions][2]=3' \
     -F 'date_shift_options[shift_dates]=true' \
     -F 'pre_attachment[name]=mycourse.imscc' \
     -F 'pre_attachment[size]=12345' \
     -H 'Authorization: Bearer <token>'
```

Returns a [ContentMigration](#contentmigration) object.

## [Update a content migration](#method.content_migrations.update) <a href="#method.content_migrations.update" id="method.content_migrations.update"></a>

[ContentMigrationsController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_migrations_controller.rb)

#### `PUT /api/v1/accounts/:account_id/content_migrations/:id`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/content_migrations/:id`

#### `PUT /api/v1/courses/:course_id/content_migrations/:id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/content_migrations/:id`

#### `PUT /api/v1/groups/:group_id/content_migrations/:id`

**Scope:** `url:PUT|/api/v1/groups/:group_id/content_migrations/:id`

#### `PUT /api/v1/users/:user_id/content_migrations/:id`

**Scope:** `url:PUT|/api/v1/users/:user_id/content_migrations/:id`

Update a content migration. Takes same arguments as [create](#method.content_migrations.create) except that you can't change the migration type. However, changing most settings after the migration process has started will not do anything. Generally updating the content migration will be used when there is a file upload problem, or when importing content selectively. If the first upload has a problem you can supply new *pre\_attachment* values to start the process again.

Returns a [ContentMigration](#contentmigration) object.

## [List Migration Systems](#method.content_migrations.available_migrators) <a href="#method.content_migrations.available_migrators" id="method.content_migrations.available_migrators"></a>

[ContentMigrationsController#available\_migrators](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_migrations_controller.rb)

#### `GET /api/v1/accounts/:account_id/content_migrations/migrators`

**Scope:** `url:GET|/api/v1/accounts/:account_id/content_migrations/migrators`

#### `GET /api/v1/courses/:course_id/content_migrations/migrators`

**Scope:** `url:GET|/api/v1/courses/:course_id/content_migrations/migrators`

#### `GET /api/v1/groups/:group_id/content_migrations/migrators`

**Scope:** `url:GET|/api/v1/groups/:group_id/content_migrations/migrators`

#### `GET /api/v1/users/:user_id/content_migrations/migrators`

**Scope:** `url:GET|/api/v1/users/:user_id/content_migrations/migrators`

Lists the currently available migration types. These values may change.

Returns a list of [Migrator](#migrator) objects.

## [List items for selective import](#method.content_migrations.content_list) <a href="#method.content_migrations.content_list" id="method.content_migrations.content_list"></a>

[ContentMigrationsController#content\_list](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_migrations_controller.rb)

#### `GET /api/v1/accounts/:account_id/content_migrations/:id/selective_data`

**Scope:** `url:GET|/api/v1/accounts/:account_id/content_migrations/:id/selective_data`

#### `GET /api/v1/courses/:course_id/content_migrations/:id/selective_data`

**Scope:** `url:GET|/api/v1/courses/:course_id/content_migrations/:id/selective_data`

#### `GET /api/v1/groups/:group_id/content_migrations/:id/selective_data`

**Scope:** `url:GET|/api/v1/groups/:group_id/content_migrations/:id/selective_data`

#### `GET /api/v1/users/:user_id/content_migrations/:id/selective_data`

**Scope:** `url:GET|/api/v1/users/:user_id/content_migrations/:id/selective_data`

Enumerates the content available for selective import in a tree structure. Each node provides a +property+ copy argument that can be supplied to the [Update endpoint](#method.content_migrations.update) to selectively copy the content associated with that tree node and its children. Each node may also provide a +sub\_items\_url+ or an array of +sub\_items+ which you can use to obtain copy parameters for a subset of the resources in a given node.

If no +type+ is sent you will get a list of the top-level sections in the content. It will look something like this:

\[{ "type": "course\_settings", "property": "copy\[all\_course\_settings]", "title": "Course Settings" }, { "type": "context\_modules", "property": "copy\[all\_context\_modules]", "title": "Modules", "count": 5, "sub\_items\_url": "<http://example.com/api/v1/courses/22/content\\_migrations/77/selective\\_data?type=context\\_modules>" }, { "type": "assignments", "property": "copy\[all\_assignments]", "title": "Assignments", "count": 2, "sub\_items\_url": "<http://localhost:3000/api/v1/courses/22/content\\_migrations/77/selective\\_data?type=assignments>" }]

When a +type+ is provided, nodes may be further divided via +sub\_items+. For example, using +type=assignments+ results in a node for each assignment group and a sub\_item for each assignment, like this:

\[{ "type": "assignment\_groups", "title": "An Assignment Group", "property": "copy\[assignment\_groups]\[id\_i855cf145e5acc7435e1bf1c6e2126e5f]", "sub\_items": \[{ "type": "assignments", "title": "Assignment 1", "property": "copy\[assignments]\[id\_i2102a7fa93b29226774949298626719d]" }, { "type": "assignments", "title": "Assignment 2", "property": "copy\[assignments]\[id\_i310cba275dc3f4aa8a3306bbbe380979]" }] }]

To import the items corresponding to a particular tree node, use the +property+ as a parameter to the [Update endpoint](#method.content_migrations.update) and assign a value of 1, for example:

copy\[assignments]\[id\_i310cba275dc3f4aa8a3306bbbe380979]=1

You can include multiple copy parameters to selectively import multiple items or groups of items.

#### Request Parameters:

| Parameter | Type     | Description                                                                                                                                                                                                                                                                                           |
| --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`    | `string` | The type of content to enumerate. Allowed values: `context_modules`, `assignments`, `quizzes`, `assessment_question_banks`, `discussion_topics`, `wiki_pages`, `context_external_tools`, `tool_profiles`, `announcements`, `calendar_events`, `rubrics`, `groups`, `learning_outcomes`, `attachments` |

## [Get asset id mapping](#method.content_migrations.asset_id_mapping) <a href="#method.content_migrations.asset_id_mapping" id="method.content_migrations.asset_id_mapping"></a>

[ContentMigrationsController#asset\_id\_mapping](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_migrations_controller.rb)

#### `GET /api/v1/courses/:course_id/content_migrations/:id/asset_id_mapping`

**Scope:** `url:GET|/api/v1/courses/:course_id/content_migrations/:id/asset_id_mapping`

Given a complete course copy or blueprint import content migration, return a mapping of asset ids from the source course to the destination course that were copied in this migration or an earlier one with the same course pair and migration\_type (course copy or blueprint).

The returned object's keys are asset types as they appear in API URLs (+announcements+, +assignments+, +discussion\_topics+, +files+, +module\_items+, +modules+, +pages+, and +quizzes+). The values are a mapping from id in source course to id in destination course for objects of this type.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/content_migrations/<id>/asset_id_mapping \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "assignments": {"13": "740", "14": "741"},
  "discussion_topics": {"15": "743", "16": "744"}
}
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Content Security Policy Settings

{% hint style="warning" %}
BETA: This API resource is not finalized, and there could be breaking changes before its final release.
{% endhint %}

API for enabling/disabling the use of Content Security Policy headers and configuring allowed domains

## [Get current settings for account or course](#method.csp_settings.get_csp_settings) <a href="#method.csp_settings.get_csp_settings" id="method.csp_settings.get_csp_settings"></a>

[CspSettingsController#get\_csp\_settings](https://github.com/instructure/canvas-lms/blob/master/app/controllers/csp_settings_controller.rb)

{% hint style="warning" %}
BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.
{% endhint %}

#### `GET /api/v1/courses/:course_id/csp_settings`

**Scope:** `url:GET|/api/v1/courses/:course_id/csp_settings`

#### `GET /api/v1/accounts/:account_id/csp_settings`

**Scope:** `url:GET|/api/v1/accounts/:account_id/csp_settings`

Update multiple modules in an account.

#### API response field:

* enabled

Whether CSP is enabled.

* inherited

Whether the current CSP settings are inherited from a parent account.

* settings\_locked

Whether current CSP settings can be overridden by sub-accounts and courses.

* effective\_whitelist

If enabled, lists the currently allowed domains (includes domains automatically allowed through external tools).

* tools\_whitelist

(Account-only) Lists the automatically allowed domains with their respective external tools

* current\_account\_whitelist

(Account-only) Lists the current list of domains explicitly allowed by this account. (Note: this list will not take effect unless CSP is explicitly enabled on this account)

## [Enable, disable, or clear explicit CSP setting](#method.csp_settings.set_csp_setting) <a href="#method.csp_settings.set_csp_setting" id="method.csp_settings.set_csp_setting"></a>

[CspSettingsController#set\_csp\_setting](https://github.com/instructure/canvas-lms/blob/master/app/controllers/csp_settings_controller.rb)

{% hint style="warning" %}
BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.
{% endhint %}

#### `PUT /api/v1/courses/:course_id/csp_settings`

**Scope:** `url:PUT|/api/v1/courses/:course_id/csp_settings`

#### `PUT /api/v1/accounts/:account_id/csp_settings`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/csp_settings`

Either explicitly sets CSP to be on or off for courses and sub-accounts, or clear the explicit settings to default to those set by a parent account

Note: If "inherited" and "settings\_locked" are both true for this account or course, then the CSP setting cannot be modified.

#### Request Parameters:

| Parameter | Type              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| --------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `status`  | Required `string` | <p>If set to "enabled" for an account, CSP will be enabled for all its courses and sub-accounts (that<br>have not explicitly enabled or disabled it), using the allowed domains set on this account.<br>If set to "disabled", CSP will be disabled for this account or course and for all sub-accounts<br>that have not explicitly re-enabled it.<br>If set to "inherited", this account or course will reset to the default state where CSP settings<br>are inherited from the first parent account to have them explicitly set. Allowed values: <code>enabled</code>, <code>disabled</code>, <code>inherited</code></p> |

## [Lock or unlock current CSP settings for sub-accounts and courses](#method.csp_settings.set_csp_lock) <a href="#method.csp_settings.set_csp_lock" id="method.csp_settings.set_csp_lock"></a>

[CspSettingsController#set\_csp\_lock](https://github.com/instructure/canvas-lms/blob/master/app/controllers/csp_settings_controller.rb)

{% hint style="warning" %}
BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.
{% endhint %}

#### `PUT /api/v1/accounts/:account_id/csp_settings/lock`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/csp_settings/lock`

Can only be set if CSP is explicitly enabled or disabled on this account (i.e. "inherited" is false).

#### Request Parameters:

| Parameter         | Type               | Description                                                                                              |
| ----------------- | ------------------ | -------------------------------------------------------------------------------------------------------- |
| `settings_locked` | Required `boolean` | Whether sub-accounts and courses will be prevented from overriding settings inherited from this account. |

## [Add an allowed domain to account](#method.csp_settings.add_domain) <a href="#method.csp_settings.add_domain" id="method.csp_settings.add_domain"></a>

[CspSettingsController#add\_domain](https://github.com/instructure/canvas-lms/blob/master/app/controllers/csp_settings_controller.rb)

{% hint style="warning" %}
BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.
{% endhint %}

#### `POST /api/v1/accounts/:account_id/csp_settings/domains`

**Scope:** `url:POST|/api/v1/accounts/:account_id/csp_settings/domains`

Adds an allowed domain for the current account. Note: this will not take effect unless CSP is explicitly enabled on this account.

#### Request Parameters:

| Parameter | Type              | Description    |
| --------- | ----------------- | -------------- |
| `domain`  | Required `string` | no description |

## [Add multiple allowed domains to an account](#method.csp_settings.add_multiple_domains) <a href="#method.csp_settings.add_multiple_domains" id="method.csp_settings.add_multiple_domains"></a>

[CspSettingsController#add\_multiple\_domains](https://github.com/instructure/canvas-lms/blob/master/app/controllers/csp_settings_controller.rb)

{% hint style="warning" %}
BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.
{% endhint %}

#### `POST /api/v1/accounts/:account_id/csp_settings/domains/batch_create`

**Scope:** `url:POST|/api/v1/accounts/:account_id/csp_settings/domains/batch_create`

Adds multiple allowed domains for the current account. Note: this will not take effect unless CSP is explicitly enabled on this account.

#### Request Parameters:

| Parameter | Type             | Description    |
| --------- | ---------------- | -------------- |
| `domains` | Required `Array` | no description |

## [Remove a domain from account](#method.csp_settings.remove_domain) <a href="#method.csp_settings.remove_domain" id="method.csp_settings.remove_domain"></a>

[CspSettingsController#remove\_domain](https://github.com/instructure/canvas-lms/blob/master/app/controllers/csp_settings_controller.rb)

{% hint style="warning" %}
BETA: This API endpoint is not finalized, and there could be breaking changes before its final release.
{% endhint %}

#### `DELETE /api/v1/accounts/:account_id/csp_settings/domains`

**Scope:** `url:DELETE|/api/v1/accounts/:account_id/csp_settings/domains`

Removes an allowed domain from the current account.

#### Request Parameters:

| Parameter | Type              | Description    |
| --------- | ----------------- | -------------- |
| `domain`  | Required `string` | no description |

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Content Shares

API for creating, accessing and updating Content Sharing. Content shares are used to share content directly between users.

#### A ContentShare object looks like: <a href="#contentshare" id="contentshare"></a>

```js
// Content shared between users
{
  // The id of the content share for the current user
  "id": 1,
  // The name of the shared content
  "name": "War of 1812 homework",
  // The type of content that was shared. Can be assignment, discussion_topic,
  // page, quiz, module, or module_item.
  "content_type": "assignment",
  // The datetime the content was shared with this user.
  "created_at": "2017-05-09T10:12:00Z",
  // The datetime the content was updated.
  "updated_at": "2017-05-09T10:12:00Z",
  // The id of the user who sent or received the content share.
  "user_id": 1578941,
  // The user who shared the content. This field is provided only to receivers; it
  // is not populated in the sender's list of sent content shares.
  "sender": {"id":1,"display_name":"Matilda Vargas","avatar_image_url":"http:\/\/localhost:3000\/image_url","html_url":"http:\/\/localhost:3000\/users\/1"},
  // An Array of users the content is shared with.  This field is provided only to
  // senders; an empty array will be returned for the receiving users.
  "receivers": [{"id":1,"display_name":"Jon Snow","avatar_image_url":"http:\/\/localhost:3000\/image_url2","html_url":"http:\/\/localhost:3000\/users\/2"}],
  // The course the content was originally shared from.
  "source_course": {"id":787,"name":"History 105"},
  // Whether the recipient has viewed the content share.
  "read_state": "read",
  // The content export record associated with this content share
  "content_export": {"id":42}
}
```

## [Create a content share](#method.content_shares.create) <a href="#method.content_shares.create" id="method.content_shares.create"></a>

[ContentSharesController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_shares_controller.rb)

#### `POST /api/v1/users/:user_id/content_shares`

**Scope:** `url:POST|/api/v1/users/:user_id/content_shares`

Share content directly between two or more users

#### Request Parameters:

| Parameter      | Type               | Description                                                                                                                |
| -------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| `receiver_ids` | Required `Array`   | IDs of users to share the content with.                                                                                    |
| `content_type` | Required `string`  | Type of content you are sharing. Allowed values: `assignment`, `discussion_topic`, `page`, `quiz`, `module`, `module_item` |
| `content_id`   | Required `integer` | The id of the content that you are sharing                                                                                 |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/users/self/content_shares \
      -d 'content_type=assignment' \
      -d 'content_id=1' \
      -H 'Authorization: Bearer <token>' \
      -X POST
```

Returns a [ContentShare](#contentshare) object.

## [List content shares](#method.content_shares.index) <a href="#method.content_shares.index" id="method.content_shares.index"></a>

[ContentSharesController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_shares_controller.rb)

#### `GET /api/v1/users/:user_id/content_shares/sent`

**Scope:** `url:GET|/api/v1/users/:user_id/content_shares/sent`

#### `GET /api/v1/users/:user_id/content_shares/received`

**Scope:** `url:GET|/api/v1/users/:user_id/content_shares/received`

Return a paginated list of content shares a user has sent or received. Use +self+ as the user\_id to retrieve your own content shares. Only linked observers and administrators may view other users' content shares.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/users/self/content_shares/received'
```

Returns a list of [ContentShare](#contentshare) objects.

## [Get unread shares count](#method.content_shares.unread_count) <a href="#method.content_shares.unread_count" id="method.content_shares.unread_count"></a>

[ContentSharesController#unread\_count](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_shares_controller.rb)

#### `GET /api/v1/users/:user_id/content_shares/unread_count`

**Scope:** `url:GET|/api/v1/users/:user_id/content_shares/unread_count`

Return the number of content shares a user has received that have not yet been read. Use +self+ as the user\_id to retrieve your own content shares. Only linked observers and administrators may view other users' content shares.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/users/self/content_shares/unread_count'
```

## [Get content share](#method.content_shares.show) <a href="#method.content_shares.show" id="method.content_shares.show"></a>

[ContentSharesController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_shares_controller.rb)

#### `GET /api/v1/users/:user_id/content_shares/:id`

**Scope:** `url:GET|/api/v1/users/:user_id/content_shares/:id`

Return information about a single content share. You may use +self+ as the user\_id to retrieve your own content share.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/users/self/content_shares/123'
```

Returns a [ContentShare](#contentshare) object.

## [Remove content share](#method.content_shares.destroy) <a href="#method.content_shares.destroy" id="method.content_shares.destroy"></a>

[ContentSharesController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_shares_controller.rb)

#### `DELETE /api/v1/users/:user_id/content_shares/:id`

**Scope:** `url:DELETE|/api/v1/users/:user_id/content_shares/:id`

Remove a content share from your list. Use +self+ as the user\_id. Note that this endpoint does not delete other users' copies of the content share.

#### Example Request:

```bash
curl -X DELETE 'https://<canvas>/api/v1/users/self/content_shares/123'
```

## [Add users to content share](#method.content_shares.add_users) <a href="#method.content_shares.add_users" id="method.content_shares.add_users"></a>

[ContentSharesController#add\_users](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_shares_controller.rb)

#### `POST /api/v1/users/:user_id/content_shares/:id/add_users`

**Scope:** `url:POST|/api/v1/users/:user_id/content_shares/:id/add_users`

Send a previously created content share to additional users

#### Request Parameters:

| Parameter      | Type    | Description                             |
| -------------- | ------- | --------------------------------------- |
| `receiver_ids` | `Array` | IDs of users to share the content with. |

#### Example Request:

```bash
curl -X POST 'https://<canvas>/api/v1/users/self/content_shares/123/add_users?receiver_ids[]=789'
```

Returns a [ContentShare](#contentshare) object.

## [Update a content share](#method.content_shares.update) <a href="#method.content_shares.update" id="method.content_shares.update"></a>

[ContentSharesController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_shares_controller.rb)

#### `PUT /api/v1/users/:user_id/content_shares/:id`

**Scope:** `url:PUT|/api/v1/users/:user_id/content_shares/:id`

Mark a content share read or unread

#### Request Parameters:

| Parameter    | Type     | Description                                                       |
| ------------ | -------- | ----------------------------------------------------------------- |
| `read_state` | `string` | Read state for the content share Allowed values: `read`, `unread` |

#### Example Request:

```bash
curl -X PUT 'https://<canvas>/api/v1/users/self/content_shares/123?read_state=read'
```

Returns a [ContentShare](#contentshare) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Conversations

API for creating, accessing and updating user conversations.

#### A Conversation object looks like: <a href="#conversation" id="conversation"></a>

```js
{
  // the unique identifier for the conversation.
  "id": 2,
  // the subject of the conversation.
  "subject": "2",
  // The current state of the conversation (read, unread or archived).
  "workflow_state": "unread",
  // A <=100 character preview from the most recent message.
  "last_message": "sure thing, here's the file",
  // the date and time at which the last message was sent.
  "start_at": "2011-09-02T12:00:00Z",
  // the number of messages in the conversation.
  "message_count": 2,
  // whether the current user is subscribed to the conversation.
  "subscribed": true,
  // whether the conversation is private.
  "private": true,
  // whether the conversation is starred.
  "starred": true,
  // Additional conversation flags (last_author, attachments, media_objects). Each
  // listed property means the flag is set to true (i.e. the current user is the
  // most recent author, there are attachments, or there are media objects)
  "properties": null,
  // Array of user ids who are involved in the conversation, ordered by
  // participation level, then alphabetical. Excludes current user, unless this is
  // a monologue.
  "audience": null,
  // Most relevant shared contexts (courses and groups) between current user and
  // other participants. If there is only one participant, it will also include
  // that user's enrollment(s)/ membership type(s) in each course/group.
  "audience_contexts": null,
  // URL to appropriate icon for this conversation (custom, individual or group
  // avatar, depending on audience).
  "avatar_url": "https://canvas.instructure.com/images/messages/avatar-group-50.png",
  // Array of users participating in the conversation. Includes current user.
  "participants": null,
  // indicates whether the conversation is visible under the current scope and
  // filter. This attribute is always true in the index API response, and is
  // primarily useful in create/update responses so that you can know if the
  // record should be displayed in the UI. The default scope is assumed, unless a
  // scope or filter is passed to the create/update API call.
  "visible": true,
  // Name of the course or group in which the conversation is occurring.
  "context_name": "Canvas 101"
}
```

#### A ConversationParticipant object looks like: <a href="#conversationparticipant" id="conversationparticipant"></a>

```js
{
  // The user ID for the participant.
  "id": 2,
  // A short name the user has selected, for use in conversations or other less
  // formal places through the site.
  "name": "Shelly",
  // The full name of the user.
  "full_name": "Sheldon Cooper",
  // If requested, this field will be included and contain a url to retrieve the
  // user's avatar.
  "avatar_url": "https://canvas.instructure.com/images/messages/avatar-50.png",
  // The Canvas UUID for the participant.
  "uuid": "W9GQIcdoDTqwX8mxIunDQQVL6WZTaGmpa5xovmCB"
}
```

## [List conversations](#method.conversations.index) <a href="#method.conversations.index" id="method.conversations.index"></a>

[ConversationsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `GET /api/v1/conversations`

**Scope:** `url:GET|/api/v1/conversations`

Returns the paginated list of conversations for the current user, most recent ones first.

"uuid:W9GQIcdoDTqwX8mxIunDQQVL6WZTaGmpa5xovmCB", or "course\_456". For users, you can use either their numeric ID or UUID prefixed with "uuid:". Can be an array (by setting "filter\[]") or single value (by setting "filter")

#### Request Parameters:

| Parameter                      | Type      | Description                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `scope`                        | `string`  | <p>When set, only return conversations of the specified type. For example,<br>set to "unread" to return only conversations that haven't been read.<br>The default behavior is to return all non-archived conversations (i.e.<br>read and unread). Allowed values: <code>unread</code>, <code>starred</code>, <code>archived</code>, <code>sent</code></p> |
| `filter[]`                     | `string`  | <p>When set, only return conversations for the specified courses, groups<br>or users. The id should be prefixed with its type, e.g. "user\_123",</p>                                                                                                                                                                                                      |
| `filter_mode`                  | `string`  | <p>When filter\[] contains multiple filters, combine them with this mode,<br>filtering conversations that at have at least all of the contexts ("and")<br>or at least one of the contexts ("or") Allowed values: <code>and</code>, <code>or</code>, <code>default or</code></p>                                                                           |
| `interleave_submissions`       | `boolean` | <p>(Obsolete) Submissions are no<br>longer linked to conversations. This parameter is ignored.</p>                                                                                                                                                                                                                                                        |
| `include_all_conversation_ids` | `boolean` | <p>Default is false. If true,<br>the top-level element of the response will be an object rather than<br>an array, and will have the keys "conversations" which will contain the<br>paged conversation data, and "conversation\_ids" which will contain the<br>ids of all conversations under this scope/filter in the same order.</p>                     |
| `include[]`                    | `string`  | <p>"participant\_avatars":: Optionally include an "avatar\_url" key for each user participating in the conversation<br>"uuid":: Optionally include an "uuid" key for each user participating in the conversation Allowed values: <code>participant\_avatars</code>, <code>uuid</code></p>                                                                 |

#### API response field:

* id

The unique identifier for the conversation.

* subject

The subject of the conversation.

* workflow\_state

The current state of the conversation (read, unread or archived)

* last\_message

A <=100 character preview from the most recent message

* last\_message\_at

The timestamp of the latest message

* message\_count

The number of messages in this conversation

* subscribed

Indicates whether the user is actively subscribed to the conversation

* private

Indicates whether this is a private conversation (i.e. audience of one)

* starred

Whether the conversation is starred

* properties

Additional conversation flags (last\_author, attachments, media\_objects). Each listed property means the flag is set to true (i.e. the current user is the most recent author, there are attachments, or there are media objects)

* audience

Array of user ids who are involved in the conversation, ordered by participation level, then alphabetical. Excludes current user, unless this is a monologue.

* audience\_contexts

Most relevant shared contexts (courses and groups) between current user and other participants. If there is only one participant, it will also include that user's enrollment(s)/ membership type(s) in each course/group

* avatar\_url

URL to appropriate icon for this conversation (custom, individual or group avatar, depending on audience)

* participants

Array of users (id, name, full\_name) participating in the conversation. Includes current user. If `include[]=participant_avatars` was passed as an argument, each user in the array will also have an "avatar\_url" field. If `include[]=uuid` was passed as an argument, each user in the array will also have an "uuid" field

* visible

Boolean, indicates whether the conversation is visible under the current scope and filter. This attribute is always true in the index API response, and is primarily useful in create/update responses so that you can know if the record should be displayed in the UI. The default scope is assumed, unless a scope or filter is passed to the create/update API call.

#### Example Response:

```js
[
  {
    "id": 2,
    "subject": "conversations api example",
    "workflow_state": "unread",
    "last_message": "sure thing, here's the file",
    "last_message_at": "2011-09-02T12:00:00Z",
    "message_count": 2,
    "subscribed": true,
    "private": true,
    "starred": false,
    "properties": ["attachments"],
    "audience": [2],
    "audience_contexts": {"courses": {"1": ["StudentEnrollment"]}, "groups": {}},
    "avatar_url": "https://canvas.instructure.com/images/messages/avatar-group-50.png",
    "participants": [
      {"id": 1, "name": "Joe", "full_name": "Joe TA"},
      {"id": 2, "name": "Jane", "full_name": "Jane Teacher"}
    ],
    "visible": true,
    "context_name": "Canvas 101"
  }
]
```

Returns a list of [Conversation](#conversation) objects.

## [Create a conversation](#method.conversations.create) <a href="#method.conversations.create" id="method.conversations.create"></a>

[ConversationsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `POST /api/v1/conversations`

**Scope:** `url:POST|/api/v1/conversations`

Create a new conversation with one or more recipients. If there is already an existing private conversation with the given recipients, it will be reused.

(either numeric IDs or UUIDs prefixed with "uuid:"), or course/group ids prefixed with "course\_" or "group\_" respectively, e.g. recipients\[]=1\&recipients\[]=uuid:W9GQIcdoDTqwX8mxIunDQQVL6WZTaGmpa5xovmCBx\&recipients\[]=course\_3. If the course/group has over 100 enrollments, 'bulk\_message' and 'group\_conversation' must be set to true.

#### Request Parameters:

| Parameter            | Type              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| -------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `recipients[]`       | Required `string` | An array of recipient ids. These may be user ids                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `subject`            | `string`          | <p>The subject of the conversation. This is ignored when reusing a<br>conversation. Maximum length is 255 characters.</p>                                                                                                                                                                                                                                                                                                                                               |
| `body`               | Required `string` | The message to be sent                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `force_new`          | `boolean`         | Forces a new message to be created, even if there is an existing private conversation.                                                                                                                                                                                                                                                                                                                                                                                  |
| `group_conversation` | `boolean`         | <p>Defaults to false. When false, individual private conversations will be<br>created with each recipient. If true, this will be a group conversation<br>(i.e. all recipients may see all messages and replies). Must be set true if<br>the number of recipients is over the set maximum (default is 100).</p>                                                                                                                                                          |
| `attachment_ids[]`   | `string`          | <p>An array of attachments ids. These must be files that have been previously<br>uploaded to the sender's "conversation attachments" folder.</p>                                                                                                                                                                                                                                                                                                                        |
| `media_comment_id`   | `string`          | <p>Media comment id of an audio or video file to be associated with this<br>message.</p>                                                                                                                                                                                                                                                                                                                                                                                |
| `media_comment_type` | `string`          | Type of the associated media file Allowed values: `audio`, `video`                                                                                                                                                                                                                                                                                                                                                                                                      |
| `mode`               | `string`          | <p>Determines whether the messages will be created/sent synchronously or<br>asynchronously. Defaults to sync, and this option is ignored if this is a<br>group conversation or there is just one recipient (i.e. it must be a bulk<br>private message). When sent async, the response will be an empty array<br>(batch status can be queried via the <a href="#method.conversations.batches">batches API</a>) Allowed values: <code>sync</code>, <code>async</code></p> |
| `scope`              | `string`          | <p>Used when generating "visible" in the API response. See the explanation<br>under the <a href="#method.conversations.index">index API action</a> Allowed values: <code>unread</code>, <code>starred</code>, <code>archived</code></p>                                                                                                                                                                                                                                 |
| `filter[]`           | `string`          | <p>Used when generating "visible" in the API response. See the explanation<br>under the <a href="#method.conversations.index">index API action</a></p>                                                                                                                                                                                                                                                                                                                  |
| `filter_mode`        | `string`          | <p>Used when generating "visible" in the API response. See the explanation<br>under the <a href="#method.conversations.index">index API action</a> Allowed values: <code>and</code>, <code>or</code>, <code>default or</code></p>                                                                                                                                                                                                                                       |
| `context_code`       | `string`          | <p>The course or group that is the context for this conversation. Same format<br>as courses or groups in the recipients argument.</p>                                                                                                                                                                                                                                                                                                                                   |
| `display_from`       | `string`          | <p>Display name to show as the message sender instead of the<br>authenticated user's name. Only honored when the request is<br>authenticated with a site admin service user token.</p>                                                                                                                                                                                                                                                                                  |
| `include[]`          | `string`          | "uuid":: Optionally include an "uuid" key for each user participating in the conversation Allowed values: `uuid`                                                                                                                                                                                                                                                                                                                                                        |

## [Get running batches](#method.conversations.batches) <a href="#method.conversations.batches" id="method.conversations.batches"></a>

[ConversationsController#batches](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `GET /api/v1/conversations/batches`

**Scope:** `url:GET|/api/v1/conversations/batches`

Returns any currently running conversation batches for the current user. Conversation batches are created when a bulk private message is sent asynchronously (see the mode argument to the [create API action](#method.conversations.create)).

#### Example Response:

```js
[
  {
    "id": 1,
    "subject": "conversations api example",
    "workflow_state": "created",
    "completion": 0.1234,
    "tags": [],
    "message":
    {
      "id": 1,
      "created_at": "2011-09-02T10:00:00Z",
      "body": "quick reminder, no class tomorrow",
      "author_id": 1,
      "generated": false,
      "media_comment": null,
      "forwarded_messages": [],
      "attachments": []
    }
  }
]
```

## [Get a single conversation](#method.conversations.show) <a href="#method.conversations.show" id="method.conversations.show"></a>

[ConversationsController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `GET /api/v1/conversations/:id`

**Scope:** `url:GET|/api/v1/conversations/:id`

Returns information for a single conversation for the current user. Response includes all fields that are present in the list/index action as well as messages and extended participant information.

#### Request Parameters:

| Parameter                | Type      | Description                                                                                                                                                                                                                             |
| ------------------------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `interleave_submissions` | `boolean` | <p>(Obsolete) Submissions are no<br>longer linked to conversations. This parameter is ignored.</p>                                                                                                                                      |
| `scope`                  | `string`  | <p>Used when generating "visible" in the API response. See the explanation<br>under the <a href="#method.conversations.index">index API action</a> Allowed values: <code>unread</code>, <code>starred</code>, <code>archived</code></p> |
| `filter[]`               | `string`  | <p>Used when generating "visible" in the API response. See the explanation<br>under the <a href="#method.conversations.index">index API action</a></p>                                                                                  |
| `filter_mode`            | `string`  | <p>Used when generating "visible" in the API response. See the explanation<br>under the <a href="#method.conversations.index">index API action</a> Allowed values: <code>and</code>, <code>or</code>, <code>default or</code></p>       |
| `auto_mark_as_read`      | `boolean` | <p>Default true. If true, unread<br>conversations will be automatically marked as read. This will default<br>to false in a future API release, so clients should explicitly send<br>true if that is the desired behavior.</p>           |

#### API response field:

* participants

Array of relevant users. Includes current user. If there are forwarded messages in this conversation, the authors of those messages will also be included, even if they are not participating in this conversation. Fields include:

* messages

Array of messages, newest first. Fields include: id:: The unique identifier for the message created\_at:: The timestamp of the message body:: The actual message body author\_id:: The id of the user who sent the message (see audience, participants) generated:: If true, indicates this is a system-generated message (e.g. "Bob added Alice to the conversation") media\_comment:: Audio/video comment data for this message (if applicable). Fields include: display\_name, content-type, media\_id, media\_type, url forwarded\_messages:: If this message contains forwarded messages, they will be included here (same format as this list). Note that those messages may have forwarded messages of their own, etc. attachments:: Array of attachments for this message. Fields include: display\_name, content-type, filename, url

* submissions

(Obsolete) Array of assignment submissions having comments relevant to this conversation. Submissions are no longer linked to conversations. This field will always be nil or empty.

#### Example Response:

```js
{
  "id": 2,
  "subject": "conversations api example",
  "workflow_state": "unread",
  "last_message": "sure thing, here's the file",
  "last_message_at": "2011-09-02T12:00:00-06:00",
  "message_count": 2,
  "subscribed": true,
  "private": true,
  "starred": false,
  "properties": ["attachments"],
  "audience": [2],
  "audience_contexts": {"courses": {"1": []}, "groups": {}},
  "avatar_url": "https://canvas.instructure.com/images/messages/avatar-50.png",
  "participants": [
    {"id": 1, "name": "Joe", "full_name": "Joe TA"},
    {"id": 2, "name": "Jane", "full_name": "Jane Teacher"},
    {"id": 3, "name": "Bob", "full_name": "Bob Student"}
  ],
  "messages":
    [
      {
        "id": 3,
        "created_at": "2011-09-02T12:00:00Z",
        "body": "sure thing, here's the file",
        "author_id": 2,
        "generated": false,
        "media_comment": null,
        "forwarded_messages": [],
        "attachments": [{"id": 1, "display_name": "notes.doc", "uuid": "abcdefabcdefabcdefabcdefabcdef"}]
      },
      {
        "id": 2,
        "created_at": "2011-09-02T11:00:00Z",
        "body": "hey, bob didn't get the notes. do you have a copy i can give him?",
        "author_id": 2,
        "generated": false,
        "media_comment": null,
        "forwarded_messages":
          [
            {
              "id": 1,
              "created_at": "2011-09-02T10:00:00Z",
              "body": "can i get a copy of the notes? i was out",
              "author_id": 3,
              "generated": false,
              "media_comment": null,
              "forwarded_messages": [],
              "attachments": []
            }
          ],
        "attachments": []
      }
    ],
  "submissions": []
}
```

## [Edit a conversation](#method.conversations.update) <a href="#method.conversations.update" id="method.conversations.update"></a>

[ConversationsController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `PUT /api/v1/conversations/:id`

**Scope:** `url:PUT|/api/v1/conversations/:id`

Updates attributes for a single conversation.

#### Request Parameters:

| Parameter                      | Type      | Description                                                                                                                                                                                                                                                                                        |
| ------------------------------ | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `conversation[workflow_state]` | `string`  | Change the state of this conversation Allowed values: `read`, `unread`, `archived`                                                                                                                                                                                                                 |
| `conversation[subscribed]`     | `boolean` | <p>Toggle the current user's subscription to the conversation (only valid for<br>group conversations). If unsubscribed, the user will still have access to<br>the latest messages, but the conversation won't be automatically flagged<br>as unread, nor will it jump to the top of the inbox.</p> |
| `conversation[starred]`        | `boolean` | Toggle the starred state of the current user's view of the conversation.                                                                                                                                                                                                                           |
| `scope`                        | `string`  | <p>Used when generating "visible" in the API response. See the explanation<br>under the <a href="#method.conversations.index">index API action</a> Allowed values: <code>unread</code>, <code>starred</code>, <code>archived</code></p>                                                            |
| `filter[]`                     | `string`  | <p>Used when generating "visible" in the API response. See the explanation<br>under the <a href="#method.conversations.index">index API action</a></p>                                                                                                                                             |
| `filter_mode`                  | `string`  | <p>Used when generating "visible" in the API response. See the explanation<br>under the <a href="#method.conversations.index">index API action</a> Allowed values: <code>and</code>, <code>or</code>, <code>default or</code></p>                                                                  |

#### Example Response:

```js
{
  "id": 2,
  "subject": "conversations api example",
  "workflow_state": "read",
  "last_message": "sure thing, here's the file",
  "last_message_at": "2011-09-02T12:00:00-06:00",
  "message_count": 2,
  "subscribed": true,
  "private": true,
  "starred": false,
  "properties": ["attachments"],
  "audience": [2],
  "audience_contexts": {"courses": {"1": []}, "groups": {}},
  "avatar_url": "https://canvas.instructure.com/images/messages/avatar-50.png",
  "participants": [{"id": 1, "name": "Joe", "full_name": "Joe TA"}]
}
```

## [Mark all as read](#method.conversations.mark_all_as_read) <a href="#method.conversations.mark_all_as_read" id="method.conversations.mark_all_as_read"></a>

[ConversationsController#mark\_all\_as\_read](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `POST /api/v1/conversations/mark_all_as_read`

**Scope:** `url:POST|/api/v1/conversations/mark_all_as_read`

Mark all conversations as read.

## [Delete a conversation](#method.conversations.destroy) <a href="#method.conversations.destroy" id="method.conversations.destroy"></a>

[ConversationsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `DELETE /api/v1/conversations/:id`

**Scope:** `url:DELETE|/api/v1/conversations/:id`

Delete this conversation and its messages. Note that this only deletes this user's view of the conversation.

Response includes same fields as UPDATE action

#### Example Response:

```js
{
  "id": 2,
  "subject": "conversations api example",
  "workflow_state": "read",
  "last_message": null,
  "last_message_at": null,
  "message_count": 0,
  "subscribed": true,
  "private": true,
  "starred": false,
  "properties": []
}
```

## [Add recipients](#method.conversations.add_recipients) <a href="#method.conversations.add_recipients" id="method.conversations.add_recipients"></a>

[ConversationsController#add\_recipients](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `POST /api/v1/conversations/:id/add_recipients`

**Scope:** `url:POST|/api/v1/conversations/:id/add_recipients`

Add recipients to an existing group conversation. Response is similar to the GET/show action, except that only includes the latest message (e.g. "joe was added to the conversation by bob")

#### Request Parameters:

| Parameter      | Type              | Description                                                                                                                                                                                          |
| -------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `recipients[]` | Required `string` | <p>An array of recipient ids. These may be user ids or course/group ids<br>prefixed with "course\_" or "group\_" respectively, e.g.<br>recipients\[]=1\&recipients\[]=2\&recipients\[]=course\_3</p> |

#### Example Response:

```js
{
  "id": 2,
  "subject": "conversations api example",
  "workflow_state": "read",
  "last_message": "let's talk this over with jim",
  "last_message_at": "2011-09-02T12:00:00-06:00",
  "message_count": 2,
  "subscribed": true,
  "private": false,
  "starred": null,
  "properties": [],
  "audience": [2, 3, 4],
  "audience_contexts": {"courses": {"1": []}, "groups": {}},
  "avatar_url": "https://canvas.instructure.com/images/messages/avatar-group-50.png",
  "participants": [
    {"id": 1, "name": "Joe", "full_name": "Joe TA"},
    {"id": 2, "name": "Jane", "full_name": "Jane Teacher"},
    {"id": 3, "name": "Bob", "full_name": "Bob Student"},
    {"id": 4, "name": "Jim", "full_name": "Jim Admin"}
  ],
  "messages":
    [
      {
        "id": 4,
        "created_at": "2011-09-02T12:10:00Z",
        "body": "Jim was added to the conversation by Joe TA",
        "author_id": 1,
        "generated": true,
        "media_comment": null,
        "forwarded_messages": [],
        "attachments": []
      }
    ]
}
```

## [Add a message](#method.conversations.add_message) <a href="#method.conversations.add_message" id="method.conversations.add_message"></a>

[ConversationsController#add\_message](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `POST /api/v1/conversations/:id/add_message`

**Scope:** `url:POST|/api/v1/conversations/:id/add_message`

Add a message to an existing conversation. Response is similar to the GET/show action, except that only includes the latest message (i.e. what we just sent)

An array of user ids. Defaults to all of the current conversation recipients. To explicitly send a message to no other recipients, this array should consist of the logged-in user id.

An array of message ids from this conversation to send to recipients of the new message. Recipients who already had a copy of included messages will not be affected.

#### Request Parameters:

| Parameter             | Type              | Description                                                                                                                                      |
| --------------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `body`                | Required `string` | The message to be sent.                                                                                                                          |
| `attachment_ids[]`    | `string`          | <p>An array of attachments ids. These must be files that have been previously<br>uploaded to the sender's "conversation attachments" folder.</p> |
| `media_comment_id`    | `string`          | <p>Media comment id of an audio of video file to be associated with this<br>message.</p>                                                         |
| `media_comment_type`  | `string`          | Type of the associated media file. Allowed values: `audio`, `video`                                                                              |
| `recipients[]`        | `string`          | no description                                                                                                                                   |
| `included_messages[]` | `string`          | no description                                                                                                                                   |

#### Example Response:

```js
{
  "id": 2,
  "subject": "conversations api example",
  "workflow_state": "unread",
  "last_message": "let's talk this over with jim",
  "last_message_at": "2011-09-02T12:00:00-06:00",
  "message_count": 2,
  "subscribed": true,
  "private": false,
  "starred": null,
  "properties": [],
  "audience": [2, 3],
  "audience_contexts": {"courses": {"1": []}, "groups": {}},
  "avatar_url": "https://canvas.instructure.com/images/messages/avatar-group-50.png",
  "participants": [
    {"id": 1, "name": "Joe", "full_name": "Joe TA"},
    {"id": 2, "name": "Jane", "full_name": "Jane Teacher"},
    {"id": 3, "name": "Bob", "full_name": "Bob Student"}
  ],
  "messages":
    [
      {
        "id": 3,
        "created_at": "2011-09-02T12:00:00Z",
        "body": "let's talk this over with jim",
        "author_id": 2,
        "generated": false,
        "media_comment": null,
        "forwarded_messages": [],
        "attachments": []
      }
    ]
}
```

## [Delete a message](#method.conversations.remove_messages) <a href="#method.conversations.remove_messages" id="method.conversations.remove_messages"></a>

[ConversationsController#remove\_messages](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `POST /api/v1/conversations/:id/remove_messages`

**Scope:** `url:POST|/api/v1/conversations/:id/remove_messages`

Delete messages from this conversation. Note that this only affects this user's view of the conversation. If all messages are deleted, the conversation will be as well (equivalent to DELETE)

#### Request Parameters:

| Parameter  | Type              | Description                        |
| ---------- | ----------------- | ---------------------------------- |
| `remove[]` | Required `string` | Array of message ids to be deleted |

#### Example Response:

```js
{
  "id": 2,
  "subject": "conversations api example",
  "workflow_state": "read",
  "last_message": "sure thing, here's the file",
  "last_message_at": "2011-09-02T12:00:00-06:00",
  "message_count": 1,
  "subscribed": true,
  "private": true,
  "starred": null,
  "properties": ["attachments"]
}
```

## [Batch update conversations](#method.conversations.batch_update) <a href="#method.conversations.batch_update" id="method.conversations.batch_update"></a>

[ConversationsController#batch\_update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `PUT /api/v1/conversations`

**Scope:** `url:PUT|/api/v1/conversations`

Perform a change on a set of conversations. Operates asynchronously; use the [progress endpoint](https://developerdocs.instructure.com/services/canvas/resources/pages/3xnEhMZQuJstdXB8KHiv#method.progress.show) to query the status of an operation.

#### Request Parameters:

| Parameter            | Type              | Description                                                                                                                       |
| -------------------- | ----------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `conversation_ids[]` | Required `string` | List of conversations to update. Limited to 500 conversations.                                                                    |
| `event`              | Required `string` | The action to take on each conversation. Allowed values: `mark_as_read`, `mark_as_unread`, `star`, `unstar`, `archive`, `destroy` |

#### Example Request:

```bash
curl https://<canvas>/api/v1/conversations \
  -X PUT \
  -H 'Authorization: Bearer <token>' \
  -d 'event=mark_as_read' \
  -d 'conversation_ids[]=1' \
  -d 'conversation_ids[]=2'
```

Returns a [Progress](/services/canvas/resources/progress#progress) object.

## [Find recipients](#method.conversations.find_recipients) <a href="#method.conversations.find_recipients" id="method.conversations.find_recipients"></a>

[ConversationsController#find\_recipients](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `GET /api/v1/conversations/find_recipients`

**Scope:** `url:GET|/api/v1/conversations/find_recipients`

Deprecated, see the [Find recipients endpoint](https://developerdocs.instructure.com/services/canvas/resources/pages/CRK51PG2WI7tJjHeGsAE#method.search.recipients) in the Search API

## [Unread count](#method.conversations.unread_count) <a href="#method.conversations.unread_count" id="method.conversations.unread_count"></a>

[ConversationsController#unread\_count](https://github.com/instructure/canvas-lms/blob/master/app/controllers/conversations_controller.rb)

#### `GET /api/v1/conversations/unread_count`

**Scope:** `url:GET|/api/v1/conversations/unread_count`

Get the number of unread conversations for the current user

#### Example Response:

```js
{'unread_count': '7'}
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Course Audit log

Query audit log of course events.

For each endpoint, a compound document is returned. The primary collection of event objects is paginated, ordered by date descending. Secondary collections of courses, users and page\_views related to the returned events are also included.

The event data for `ConcludedEventData`, `UnconcludedEventData`, `PublishedEventData`, `UnpublishedEventData`, `DeletedEventData`, `RestoredEventData`, `ResetFromEventData`, `ResetToEventData`, `CopiedFromEventData`, and `CopiedToEventData` objects will return a empty objects as these do not have any additional log data associated.

#### A CourseEventLink object looks like: <a href="#courseeventlink" id="courseeventlink"></a>

```js
{
  // ID of the course for the event.
  "course": 12345,
  // ID of the user for the event (who made the change).
  "user": 12345,
  // ID of the page view during the event if it exists.
  "page_view": "e2b76430-27a5-0131-3ca1-48e0eb13f29b",
  // ID of the course that this course was copied from. This is only included if
  // the event_type is copied_from.
  "copied_from": 12345,
  // ID of the course that this course was copied to. This is only included if the
  // event_type is copied_to.
  "copied_to": 12345,
  // ID of the SIS batch that triggered the event.
  "sis_batch": 12345
}
```

#### A CourseEvent object looks like: <a href="#courseevent" id="courseevent"></a>

```js
{
  // ID of the event.
  "id": "e2b76430-27a5-0131-3ca1-48e0eb13f29b",
  // timestamp of the event
  "created_at": "2012-07-19T15:00:00-06:00",
  // Course event type The event type defines the type and schema of the
  // event_data object.
  "event_type": "updated",
  // Course event data depending on the event type.  This will return an object
  // containing the relevant event data.  An updated event type will return an
  // UpdatedEventData object.
  "event_data": "{}",
  // Course event source depending on the event type.  This will return a string
  // containing the source of the event.
  "event_source": "manual|sis|api",
  // Jsonapi.org links
  "links": {"course":"12345","user":"12345","page_view":"e2b76430-27a5-0131-3ca1-48e0eb13f29b"}
}
```

#### A CreatedEventData object looks like: <a href="#createdeventdata" id="createdeventdata"></a>

```js
// The created event data object returns all the fields that were set in the
// format of the following example.  If a field does not exist it was not set.
// The value of each field changed is in the format of [:old_value, :new_value].
// The created event type also includes a created_source field to specify what
// triggered the creation of the course.
{
  "name": [null, "Course 1"],
  "start_at": [null, "2012-01-19T15:00:00-06:00"],
  "conclude_at": [null, "2012-01-19T15:00:00-08:00"],
  "is_public": [null, false],
  // The type of action that triggered the creation of the course.
  "created_source": "manual|sis|api"
}
```

#### An UpdatedEventData object looks like: <a href="#updatedeventdata" id="updatedeventdata"></a>

```js
// The updated event data object returns all the fields that have changed in the
// format of the following example.  If a field does not exist it was not
// changed.  The value is an array that contains the before and after values for
// the change as in [:old_value, :new_value].
{
  "name": ["Course 1", "Course 2"],
  "start_at": ["2012-01-19T15:00:00-06:00", "2012-07-19T15:00:00-06:00"],
  "conclude_at": ["2012-01-19T15:00:00-08:00", "2012-07-19T15:00:00-08:00"],
  "is_public": [true, false]
}
```

## [Query by course.](#method.course_audit_api.for_course) <a href="#method.course_audit_api.for_course" id="method.course_audit_api.for_course"></a>

[CourseAuditApiController#for\_course](https://github.com/instructure/canvas-lms/blob/master/app/controllers/course_audit_api_controller.rb)

#### `GET /api/v1/audit/course/courses/:course_id`

**Scope:** `url:GET|/api/v1/audit/course/courses/:course_id`

List course change events for a given course.

#### Request Parameters:

| Parameter    | Type       | Description                                                 |
| ------------ | ---------- | ----------------------------------------------------------- |
| `start_time` | `DateTime` | The beginning of the time range from which you want events. |
| `end_time`   | `DateTime` | The end of the time range from which you want events.       |

Returns a list of [CourseEvent](#courseevent) objects.

## [Query by account.](#method.course_audit_api.for_account) <a href="#method.course_audit_api.for_account" id="method.course_audit_api.for_account"></a>

[CourseAuditApiController#for\_account](https://github.com/instructure/canvas-lms/blob/master/app/controllers/course_audit_api_controller.rb)

#### `GET /api/v1/audit/course/accounts/:account_id`

**Scope:** `url:GET|/api/v1/audit/course/accounts/:account_id`

List course change events for a given account.

#### Request Parameters:

| Parameter    | Type       | Description                                                 |
| ------------ | ---------- | ----------------------------------------------------------- |
| `start_time` | `DateTime` | The beginning of the time range from which you want events. |
| `end_time`   | `DateTime` | The end of the time range from which you want events.       |

Returns a list of [CourseEvent](#courseevent) objects.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Course Pace

API for accessing and building Course Paces.

#### A CoursePace object looks like: <a href="#coursepace" id="coursepace"></a>

```js
{
  // the ID of the course pace
  "id": 5,
  // the ID of the course
  "course_id": 5,
  // the ID of the user for this course pace
  "user_id": 10,
  // the state of the course pace
  "workflow_state": "active",
  // boolean value depending on exclude weekends setting
  "exclude_weekends": true,
  // array of strings representing the days of the work week
  "selected_days_to_skip": [fri, sat],
  // set if the end date is set from course
  "hard_end_dates": true,
  // date when course pace is created
  "created_at": "2013-01-23T23:59:00-07:00",
  // course end date
  "end_date": "2013-01-23T23:59:00-07:00",
  // date when course pace is updated
  "updated_at": "2013-01-23T23:59:00-07:00",
  // date when course pace is published
  "published_at": "2013-01-23T23:59:00-07:00",
  // the root account ID for this course pace
  "root_account_id": 10,
  // course start date
  "start_date": "2013-01-23T23:59:00-07:00",
  // list of modules and items for this course pace
  "modules": null,
  // progress of pace publishing
  "progress": null
}
```

#### A Module object looks like: <a href="#module" id="module"></a>

```js
{
  // the ID of the module
  "id": 5,
  // the name of the module
  "name": "Module 1",
  // the position of the module
  "position": 5,
  // list of module items
  "items": null,
  // the ID of the context for this course pace
  "context_id": 10,
  // The given context for the course pace
  "context_type": "Course"
}
```

#### A ModuleItem object looks like: <a href="#moduleitem" id="moduleitem"></a>

```js
{
  // the ID of the module item
  "id": 5,
  // the duration of the module item
  "duration": 5,
  // the course pace id of the module item
  "course_pace_id": 5,
  // the root account id of the module item
  "root_account_id": 5,
  // the module item id of the module item
  "module_item_id": 5,
  // The title of the item assignment
  "assignment_title": "Assignment 9",
  // The points of the item
  "points_possible": 10.0,
  // The link of the item assignment
  "assignment_link": "/courses/105/modules/items/264",
  // the current position of the module item
  "position": 5,
  // The module item type of the item assignment
  "module_item_type": "Assignment",
  // published boolean value for course pace
  "published": true
}
```

#### A Progress object looks like: <a href="#progress" id="progress"></a>

```js
{
  // the ID of the Progress object
  "id": 1,
  // the context owning the job.
  "context_id": 1,
  "context_type": "Account",
  // the id of the user who started the job
  "user_id": 123,
  // the type of operation
  "tag": "course_batch_update",
  // percent completed
  "completion": 100,
  // the state of the job one of 'queued', 'running', 'completed', 'failed'
  "workflow_state": "completed",
  // the time the job was created
  "created_at": "2013-01-15T15:00:00Z",
  // the time the job was last updated
  "updated_at": "2013-01-15T15:04:00Z",
  // optional details about the job
  "message": "17 courses processed",
  // optional results of the job. omitted when job is still pending
  "results": {"id":"123"},
  // url where a progress update can be retrieved
  "url": "https://canvas.example.edu/api/v1/progress/1"
}
```

## [Show a Course pace](#method.course_paces.api_show) <a href="#method.course_paces.api_show" id="method.course_paces.api_show"></a>

[CoursePacesController#api\_show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/course_paces_controller.rb)

#### `GET /api/v1/courses/:course_id/course_pacing/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/course_pacing/:id`

Returns a course pace for the course and pace id provided

#### Request Parameters:

| Parameter        | Type               | Description                |
| ---------------- | ------------------ | -------------------------- |
| `course_id`      | Required `integer` | The id of the course       |
| `course_pace_id` | Required `integer` | The id of the course\_pace |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/course_pacing/1 \
  -H 'Authorization: Bearer <token>'
```

Returns a [CoursePace](#coursepace) object.

## [Create a Course pace](#method.course_paces.create) <a href="#method.course_paces.create" id="method.course_paces.create"></a>

[CoursePacesController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/course_paces_controller.rb)

#### `POST /api/v1/courses/:course_id/course_pacing`

**Scope:** `url:POST|/api/v1/courses/:course_id/course_pacing`

Creates a new course pace with specified parameters.

#### Request Parameters:

| Parameter                              | Type               | Description                                                             |
| -------------------------------------- | ------------------ | ----------------------------------------------------------------------- |
| `course_id`                            | Required `integer` | The id of the course                                                    |
| `end_date`                             | `Datetime`         | End date of the course pace                                             |
| `end_date_context`                     | `string`           | End date context (course, section, hupothetical)                        |
| `start_date`                           | `Datetime`         | Start date of the course pace                                           |
| `start_date_context`                   | `string`           | Start date context (course, section, hupothetical)                      |
| `exclude_weekends`                     | `boolean`          | Course pace dates excludes weekends if true                             |
| `selected_days_to_skip`                | `string`           | <p>\[Array\<String>]<br>Course pace dates excludes weekends if true</p> |
| `hard_end_dates`                       | `boolean`          | Course pace uess hard end dates if true                                 |
| `workflow_state`                       | `string`           | The state of the course pace                                            |
| `course_pace_module_item_attributes[]` | `string`           | Module Items attributes                                                 |
| `context_id`                           | `integer`          | Pace Context ID                                                         |
| `context_type`                         | `string`           | Pace Context Type (Course, Section, User)                               |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/course_pacing \
  -X POST \
  -H 'Authorization: Bearer <token>'
```

Returns a [CoursePace](#coursepace) object.

## [Update a Course pace](#method.course_paces.update) <a href="#method.course_paces.update" id="method.course_paces.update"></a>

[CoursePacesController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/course_paces_controller.rb)

#### `PUT /api/v1/courses/:course_id/course_pacing/:id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/course_pacing/:id`

Returns the updated course pace

#### Request Parameters:

| Parameter                              | Type               | Description                                                             |
| -------------------------------------- | ------------------ | ----------------------------------------------------------------------- |
| `course_id`                            | Required `integer` | The id of the course                                                    |
| `course_pace_id`                       | Required `integer` | The id of the course pace                                               |
| `end_date`                             | `Datetime`         | End date of the course pace                                             |
| `exclude_weekends`                     | `boolean`          | Course pace dates excludes weekends if true                             |
| `selected_days_to_skip`                | `string`           | <p>\[Array\<String>]<br>Course pace dates excludes weekends if true</p> |
| `hard_end_dates`                       | `boolean`          | Course pace uess hard end dates if true                                 |
| `workflow_state`                       | `string`           | The state of the course pace                                            |
| `course_pace_module_item_attributes[]` | `string`           | Module Items attributes                                                 |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/course_pacing/1 \
  -X PUT \
  -H 'Authorization: Bearer <token>'
```

Returns a [CoursePace](#coursepace) object.

## [Delete a Course pace](#method.course_paces.destroy) <a href="#method.course_paces.destroy" id="method.course_paces.destroy"></a>

[CoursePacesController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/course_paces_controller.rb)

#### `DELETE /api/v1/courses/:course_id/course_pacing/:id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/course_pacing/:id`

Returns the updated course pace

#### Request Parameters:

| Parameter        | Type               | Description                |
| ---------------- | ------------------ | -------------------------- |
| `course_id`      | Required `integer` | The id of the course       |
| `course_pace_id` | Required `integer` | The id of the course\_pace |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/1/course_pacing/1 \
  -X DELETE \
  -H 'Authorization: Bearer <token>'
```

Returns a [CoursePace](#coursepace) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Course Quiz Extensions

API for setting extensions on student quiz submissions at the course level

#### A CourseQuizExtension object looks like: <a href="#coursequizextension" id="coursequizextension"></a>

```js
{
  // The ID of the Student that needs the quiz extension.
  "user_id": 3,
  // Number of times the student is allowed to re-take the quiz over the
  // multiple-attempt limit.
  "extra_attempts": 1,
  // Amount of extra time allowed for the quiz submission, in minutes.
  "extra_time": 60,
  // The student can take the quiz even if it's locked for everyone else
  "manually_unlocked": true,
  // The time at which the quiz submission will be overdue, and be flagged as a
  // late submission.
  "end_at": "2013-11-07T13:16:18Z"
}
```

## [Set extensions for student quiz submissions](#method.quizzes/course_quiz_extensions.create) <a href="#method.quizzes-course_quiz_extensions.create" id="method.quizzes-course_quiz_extensions.create"></a>

[Quizzes::CourseQuizExtensionsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/quizzes/course_quiz_extensions_controller.rb)

#### `POST /api/v1/courses/:course_id/quiz_extensions`

**Scope:** `url:POST|/api/v1/courses/:course_id/quiz_extensions`

\<b>Responses\</b>

* \<b>200 OK\</b> if the request was successful
* \<b>403 Forbidden\</b> if you are not allowed to extend quizzes for this course

#### Request Parameters:

| Parameter            | Type               | Description                                                                                                                                                                              |
| -------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `user_id`            | Required `integer` | The ID of the user we want to add quiz extensions for.                                                                                                                                   |
| `extra_attempts`     | `integer`          | <p>Number of times the student is allowed to re-take the quiz over the<br>multiple-attempt limit. This is limited to 1000 attempts or less.</p>                                          |
| `extra_time`         | `integer`          | <p>The number of extra minutes to allow for all attempts. This will<br>add to the existing time limit on the submission. This is limited to<br>10080 minutes (1 week)</p>                |
| `manually_unlocked`  | `boolean`          | <p>Allow the student to take the quiz even if it's locked for<br>everyone else.</p>                                                                                                      |
| `extend_from_now`    | `integer`          | <p>The number of minutes to extend the quiz from the current time. This is<br>mutually exclusive to extend\_from\_end\_at. This is limited to 1440<br>minutes (24 hours)</p>             |
| `extend_from_end_at` | `integer`          | <p>The number of minutes to extend the quiz beyond the quiz's current<br>ending time. This is mutually exclusive to extend\_from\_now. This is<br>limited to 1440 minutes (24 hours)</p> |

#### Example Request:

```bash
{
  "quiz_extensions": [{
    "user_id": 3,
    "extra_attempts": 2,
    "extra_time": 20,
    "manually_unlocked": true
  },{
    "user_id": 2,
    "extra_attempts": 2,
    "extra_time": 20,
    "manually_unlocked": false
  }]
}
```

```bash
{
  "quiz_extensions": [{
    "user_id": 3,
    "extend_from_now": 20
  }]
}
```

#### Example Response:

```js
{
  "quiz_extensions": [QuizExtension]
}
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Course Reports

API for accessing course reports.

#### A Report object looks like: <a href="#report" id="report"></a>

```js
{
  // The unique identifier for the report.
  "id": 1,
  // The url to the report download.
  "file_url": "https://example.com/some/path",
  // The attachment api object of the report. Only available after the report has
  // completed.
  "attachment": null,
  // The status of the report
  "status": "complete",
  // The date and time the report was created.
  "created_at": "2013-12-01T23:59:00-06:00",
  // The date and time the report started processing.
  "started_at": "2013-12-02T00:03:21-06:00",
  // The date and time the report finished processing.
  "ended_at": "2013-12-02T00:03:21-06:00",
  // The report parameters
  "parameters": {"course_id":2,"start_at":"2012-07-13T10:55:20-06:00","end_at":"2012-07-13T10:55:20-06:00"},
  // The progress of the report
  "progress": 100
}
```

#### A ReportParameters object looks like: <a href="#reportparameters" id="reportparameters"></a>

```js
// The parameters returned will vary for each report.
{
  
}
```

## [Status of a Report](#method.course_reports.show) <a href="#method.course_reports.show" id="method.course_reports.show"></a>

[CourseReportsController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/course_reports_controller.rb)

#### `GET /api/v1/courses/:course_id/reports/:report_type/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/reports/:report_type/:id`

Returns the status of a report.

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
     https://<canvas>/api/v1/courses/<course_id>/reports/<report_type>/<report_id>
```

Returns a [Report](#report) object.

## [Start a Report](#method.course_reports.create) <a href="#method.course_reports.create" id="method.course_reports.create"></a>

[CourseReportsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/course_reports_controller.rb)

#### `POST /api/v1/courses/:course_id/reports/:report_type`

**Scope:** `url:POST|/api/v1/courses/:course_id/reports/:report_type`

Generates a report instance for the account. Note that "report" in the request must match one of the available report names.

#### Request Parameters:

| Parameter                   | Type      | Description                                                                                                                                                                              |
| --------------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `course_id`                 | `integer` | The id of the course to report on.                                                                                                                                                       |
| `report_type`               | `string`  | The type of report to generate.                                                                                                                                                          |
| `parameters[]`              | `Hash`    | <p>The parameters will vary for each report.<br>A few example parameters have been provided below.<br>Note: the example parameters provided below may not be valid for every report.</p> |
| `parameters[section_ids[]]` | `integer` | <p>The sections of the course to report on.<br>Note: this parameter has been listed to serve as an example and may not be<br>valid for every report.</p>                                 |

Returns a [Report](#report) object.

## [Status of last Report](#method.course_reports.last) <a href="#method.course_reports.last" id="method.course_reports.last"></a>

[CourseReportsController#last](https://github.com/instructure/canvas-lms/blob/master/app/controllers/course_reports_controller.rb)

#### `GET /api/v1/courses/:course_id/reports/:report_type`

**Scope:** `url:GET|/api/v1/courses/:course_id/reports/:report_type`

Returns the status of the last report initiated by the current user.

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
     https://<canvas>/api/v1/courses/<course_id>/reports/<report_type>
```

Returns a [Report](#report) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Courses

API for accessing course information.

#### A Term object looks like: <a href="#term" id="term"></a>

```js
{
  "id": 1,
  "name": "Default Term",
  "start_at": "2012-06-01T00:00:00-06:00",
  "end_at": null
}
```

#### A CourseProgress object looks like: <a href="#courseprogress" id="courseprogress"></a>

```js
{
  // total number of requirements from all modules
  "requirement_count": 10,
  // total number of requirements the user has completed from all modules
  "requirement_completed_count": 1,
  // url to next module item that has an unmet requirement. null if the user has
  // completed the course or the current module does not require sequential
  // progress
  "next_requirement_url": "http://localhost/courses/1/modules/items/2",
  // date the course was completed. null if the course has not been completed by
  // this user
  "completed_at": "2013-06-01T00:00:00-06:00"
}
```

#### A Course object looks like: <a href="#course" id="course"></a>

```js
{
  // the unique identifier for the course
  "id": 370663,
  // the SIS identifier for the course, if defined. This field is only included if
  // the user has permission to view SIS information.
  "sis_course_id": null,
  // the UUID of the course
  "uuid": "WvAHhY5FINzq5IyRIJybGeiXyFkG3SqHUPb7jZY5",
  // the integration identifier for the course, if defined. This field is only
  // included if the user has permission to view SIS information.
  "integration_id": null,
  // the unique identifier for the SIS import. This field is only included if the
  // user has permission to manage SIS information.
  "sis_import_id": 34,
  // the full name of the course. If the requesting user has set a nickname for
  // the course, the nickname will be shown here.
  "name": "InstructureCon 2012",
  // the course code
  "course_code": "INSTCON12",
  // the actual course name. This field is returned only if the requesting user
  // has set a nickname for the course.
  "original_name": "InstructureCon-2012-01",
  // the current state of the course, also known as ‘status’.  The value will be
  // one of the following values: 'unpublished', 'available', 'completed', or
  // 'deleted'.  NOTE: When fetching a singular course that has a 'deleted'
  // workflow state value, an error will be returned with a message of 'The
  // specified resource does not exist.'
  "workflow_state": "available",
  // the account associated with the course
  "account_id": 81259,
  // the root account associated with the course
  "root_account_id": 81259,
  // the enrollment term associated with the course
  "enrollment_term_id": 34,
  // A list of grading periods associated with the course
  "grading_periods": null,
  // the grading standard associated with the course
  "grading_standard_id": 25,
  // the grade_passback_setting set on the course
  "grade_passback_setting": "nightly_sync",
  // the date the course was created.
  "created_at": "2012-05-01T00:00:00-06:00",
  // the start date for the course, if applicable
  "start_at": "2012-06-01T00:00:00-06:00",
  // the end date for the course, if applicable
  "end_at": "2012-09-01T00:00:00-06:00",
  // the course-set locale, if applicable
  "locale": "en",
  // A list of enrollments linking the current user to the course. for student
  // enrollments, grading information may be included if include[]=total_scores
  "enrollments": null,
  // optional: the total number of active and invited students in the course
  "total_students": 32,
  // course calendar
  "calendar": null,
  // the type of page that users will see when they first visit the course -
  // 'feed': Recent Activity Dashboard - 'wiki': Wiki Front Page - 'modules':
  // Course Modules/Sections Page - 'assignments': Course Assignments List -
  // 'syllabus': Course Syllabus Page other types may be added in the future
  "default_view": "feed",
  // optional: user-generated HTML for the course syllabus
  "syllabus_body": "<p>syllabus html goes here</p>",
  // optional: the number of submissions needing grading returned only if the
  // current user has grading rights and include[]=needs_grading_count
  "needs_grading_count": 17,
  // optional: the enrollment term object for the course returned only if
  // include[]=term
  "term": null,
  // optional: information on progress through the course returned only if
  // include[]=course_progress
  "course_progress": null,
  // weight final grade based on assignment group percentages
  "apply_assignment_group_weights": true,
  // optional: the permissions the user has for the course. returned only for a
  // single course and include[]=permissions
  "permissions": {"create_discussion_topic":true,"create_announcement":true},
  "is_public": true,
  "is_public_to_auth_users": true,
  "public_syllabus": true,
  "public_syllabus_to_auth": true,
  // optional: the public description of the course
  "public_description": "Come one, come all to InstructureCon 2012!",
  "storage_quota_mb": 5,
  "storage_quota_used_mb": 5,
  "hide_final_grades": false,
  "license": "Creative Commons",
  "allow_student_assignment_edits": false,
  "allow_wiki_comments": false,
  "allow_student_forum_attachments": false,
  "open_enrollment": true,
  "self_enrollment": false,
  "restrict_enrollments_to_course_dates": false,
  "course_format": "online",
  // optional: this will be true if this user is currently prevented from viewing
  // the course because of date restriction settings
  "access_restricted_by_date": false,
  // The course's IANA time zone name.
  "time_zone": "America/Denver",
  // optional: whether the course is set as a Blueprint Course (blueprint fields
  // require the Blueprint Courses feature)
  "blueprint": true,
  // optional: Set of restrictions applied to all locked course objects
  "blueprint_restrictions": {"content":true,"points":true,"due_dates":false,"availability_dates":false},
  // optional: Sets of restrictions differentiated by object type applied to
  // locked course objects
  "blueprint_restrictions_by_object_type": {"assignment":{"content":true,"points":true},"wiki_page":{"content":true}},
  // optional: whether the course is set as a template (requires the Course
  // Templates feature)
  "template": true
}
```

#### A CalendarLink object looks like: <a href="#calendarlink" id="calendarlink"></a>

```js
{
  // The URL of the calendar in ICS format
  "ics": "https://canvas.instructure.com/feeds/calendars/course_abcdef.ics"
}
```

## [List your courses](#method.courses.index) <a href="#method.courses.index" id="method.courses.index"></a>

[CoursesController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses`

**Scope:** `url:GET|/api/v1/courses`

Returns the paginated list of active courses for the current user.

#### Request Parameters:

| Parameter                   | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| --------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `enrollment_type`           | `string`  | <p>When set, only return courses where the user is enrolled as this type. For<br>example, set to "teacher" to return only courses where the user is<br>enrolled as a Teacher. This argument is ignored if enrollment\_role is given. Allowed values: <code>teacher</code>, <code>student</code>, <code>ta</code>, <code>observer</code>, <code>designer</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `enrollment_role`           | `string`  | <p>Deprecated<br>When set, only return courses where the user is enrolled with the specified<br>course-level role. This can be a role created with the<br><a href="/pages/f7Drit9p3HR5ij8XDF4s#method.role_overrides.add_role">Add Role API</a> or a base role type of<br>'StudentEnrollment', 'TeacherEnrollment', 'TaEnrollment', 'ObserverEnrollment',<br>or 'DesignerEnrollment'.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `enrollment_role_id`        | `integer` | <p>When set, only return courses where the user is enrolled with the specified<br>course-level role. This can be a role created with the<br><a href="/pages/f7Drit9p3HR5ij8XDF4s#method.role_overrides.add_role">Add Role API</a> or a built\_in role type of<br>'StudentEnrollment', 'TeacherEnrollment', 'TaEnrollment', 'ObserverEnrollment',<br>or 'DesignerEnrollment'.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `enrollment_state`          | `string`  | <p>When set, only return courses where the user has an enrollment with the given state.<br>This will respect section/course/term date overrides. Allowed values: <code>active</code>, <code>invited\_or\_pending</code>, <code>completed</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `exclude_blueprint_courses` | `boolean` | When set, only return courses that are not configured as blueprint courses.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `include[]`                 | `string`  | <p>- "needs\_grading\_count": Optional information to include with each Course.<br>When needs\_grading\_count is given, and the current user has grading<br>rights, the total number of submissions needing grading for all<br>assignments is returned.<br>- "syllabus\_body": Optional information to include with each Course.<br>When syllabus\_body is given the user-generated html for the course<br>syllabus is returned.<br>- "public\_description": Optional information to include with each Course.<br>When public\_description is given the user-generated text for the course<br>public description is returned.<br>- "total\_scores": Optional information to include with each Course.<br>When total\_scores is given, any student enrollments will also<br>include the fields 'computed\_current\_score', 'computed\_final\_score',<br>'computed\_current\_grade', and 'computed\_final\_grade', as well as (if<br>the user has permission) 'unposted\_current\_score',<br>'unposted\_final\_score', 'unposted\_current\_grade', and<br>'unposted\_final\_grade' (see Enrollment documentation for more<br>information on these fields). This argument is ignored if the course is<br>configured to hide final grades.<br>- "current\_grading\_period\_scores": Optional information to include with<br>each Course. When current\_grading\_period\_scores is given and total\_scores<br>is given, any student enrollments will also include the fields<br>'has\_grading\_periods',<br>'totals\_for\_all\_grading\_periods\_option', 'current\_grading\_period\_title',<br>'current\_grading\_period\_id', current\_period\_computed\_current\_score',<br>'current\_period\_computed\_final\_score',<br>'current\_period\_computed\_current\_grade', and<br>'current\_period\_computed\_final\_grade', as well as (if the user has permission)<br>'current\_period\_unposted\_current\_score',<br>'current\_period\_unposted\_final\_score',<br>'current\_period\_unposted\_current\_grade', and<br>'current\_period\_unposted\_final\_grade' (see Enrollment documentation for<br>more information on these fields). In addition, when this argument is<br>passed, the course will have a 'has\_grading\_periods' attribute<br>on it. This argument is ignored if the total\_scores argument is not<br>included. If the course is configured to hide final grades, the<br>following fields are not returned:<br>'totals\_for\_all\_grading\_periods\_option',<br>'current\_period\_computed\_current\_score',<br>'current\_period\_computed\_final\_score',<br>'current\_period\_computed\_current\_grade',<br>'current\_period\_computed\_final\_grade',<br>'current\_period\_unposted\_current\_score',<br>'current\_period\_unposted\_final\_score',<br>'current\_period\_unposted\_current\_grade', and<br>'current\_period\_unposted\_final\_grade'<br>- "grading\_periods": Optional information to include with each Course. When<br>grading\_periods is given, a list of the grading periods associated with<br>each course is returned.<br>- "term": Optional information to include with each Course. When<br>term is given, the information for the enrollment term for each course<br>is returned.<br>- "account": Optional information to include with each Course. When<br>account is given, the account json for each course is returned.<br>- "course\_progress": Optional information to include with each Course.<br>When course\_progress is given, each course will include a<br>'course\_progress' object with the fields: 'requirement\_count', an integer<br>specifying the total number of requirements in the course,<br>'requirement\_completed\_count', an integer specifying the total number of<br>requirements in this course that have been completed, and<br>'next\_requirement\_url', a string url to the next requirement item, and<br>'completed\_at', the date the course was completed (null if incomplete).<br>'next\_requirement\_url' will be null if all requirements have been<br>completed or the current module does not require sequential progress.<br>"course\_progress" will return an error message if the course is not<br>module based or the user is not enrolled as a student in the course.<br>- "sections": Section enrollment information to include with each Course.<br>Returns an array of hashes containing the section ID (id), section name<br>(name), start and end dates (start\_at, end\_at), as well as the enrollment<br>type (enrollment\_role, e.g. 'StudentEnrollment').<br>- "storage\_quota\_used\_mb": The amount of storage space used by the files in this course<br>- "total\_students": Optional information to include with each Course.<br>Returns an integer for the total amount of active and invited students.<br>- "passback\_status": Include the grade passback\_status<br>- "favorites": Optional information to include with each Course.<br>Indicates if the user has marked the course as a favorite course.<br>- "teachers": Teacher information to include with each Course.<br>Returns an array of hashes containing the <a href="/pages/MdP5ietTKYXvENCpwUFT#UserDisplay">UserDisplay</a> information<br>for each teacher in the course.<br>- "observed\_users": Optional information to include with each Course.<br>Will include data for observed users if the current user has an<br>observer enrollment.<br>- "tabs": Optional information to include with each Course.<br>Will include the list of tabs configured for each course. See the<br><a href="/pages/it0n0xczFvyI0IHWy5v5#method.tabs.index">List available tabs API</a> for more information.<br>- "course\_image": Optional information to include with each Course. Returns course<br>image url if a course image has been set.<br>- "banner\_image": Optional information to include with each Course. Returns course<br>banner image url if the course is a Canvas for Elementary subject and a banner<br>image has been set.<br>- "concluded": Optional information to include with each Course. Indicates whether<br>the course has been concluded, taking course and term dates into account.<br>- "post\_manually": Optional information to include with each Course. Returns true if<br>the course post policy is set to Manually post grades. Returns false if the the course<br>post policy is set to Automatically post grades.<br>- "syllabus\_versions": Optional information to include with each Course.<br>Returns recent saved versions of the syllabus body. Requires the<br>syllabus\_versioning feature flag and permission to manage course<br>content. Version numbers can be passed to the Restore course<br>syllabus version API. Allowed values: <code>needs\_grading\_count</code>, <code>syllabus\_body</code>, <code>syllabus\_versions</code>, <code>public\_description</code>, <code>total\_scores</code>, <code>current\_grading\_period\_scores</code>, <code>grading\_periods</code>, <code>term</code>, <code>account</code>, <code>course\_progress</code>, <code>sections</code>, <code>storage\_quota\_used\_mb</code>, <code>total\_students</code>, <code>passback\_status</code>, <code>favorites</code>, <code>teachers</code>, <code>observed\_users</code>, <code>course\_image</code>, <code>banner\_image</code>, <code>concluded</code>, <code>post\_manually</code></p> |
| `state[]`                   | `string`  | <p>If set, only return courses that are in the given state(s).<br>By default, "available" is returned for students and observers, and<br>anything except "deleted", for all other enrollment types Allowed values: <code>unpublished</code>, <code>available</code>, <code>completed</code>, <code>deleted</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

Returns a list of [Course](#course) objects.

## [List courses for a user](#method.courses.user_index) <a href="#method.courses.user_index" id="method.courses.user_index"></a>

[CoursesController#user\_index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/users/:user_id/courses`

**Scope:** `url:GET|/api/v1/users/:user_id/courses`

Returns a paginated list of active courses for this user. To view the course list for a user other than yourself, you must be either an observer of that user or an administrator.

#### Request Parameters:

| Parameter          | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------------ | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]`        | `string`  | <p>- "needs\_grading\_count": Optional information to include with each Course.<br>When needs\_grading\_count is given, and the current user has grading<br>rights, the total number of submissions needing grading for all<br>assignments is returned.<br>- "syllabus\_body": Optional information to include with each Course.<br>When syllabus\_body is given the user-generated html for the course<br>syllabus is returned.<br>- "public\_description": Optional information to include with each Course.<br>When public\_description is given the user-generated text for the course<br>public description is returned.<br>- "total\_scores": Optional information to include with each Course.<br>When total\_scores is given, any student enrollments will also<br>include the fields 'computed\_current\_score', 'computed\_final\_score',<br>'computed\_current\_grade', and 'computed\_final\_grade' (see Enrollment<br>documentation for more information on these fields). This argument<br>is ignored if the course is configured to hide final grades.<br>- "current\_grading\_period\_scores": Optional information to include with<br>each Course. When current\_grading\_period\_scores is given and total\_scores<br>is given, any student enrollments will also include the fields<br>'has\_grading\_periods',<br>'totals\_for\_all\_grading\_periods\_option', 'current\_grading\_period\_title',<br>'current\_grading\_period\_id', current\_period\_computed\_current\_score',<br>'current\_period\_computed\_final\_score',<br>'current\_period\_computed\_current\_grade', and<br>'current\_period\_computed\_final\_grade', as well as (if the user has permission)<br>'current\_period\_unposted\_current\_score',<br>'current\_period\_unposted\_final\_score',<br>'current\_period\_unposted\_current\_grade', and<br>'current\_period\_unposted\_final\_grade' (see Enrollment documentation for<br>more information on these fields). In addition, when this argument is<br>passed, the course will have a 'has\_grading\_periods' attribute<br>on it. This argument is ignored if the course is configured to hide final<br>grades or if the total\_scores argument is not included.<br>- "grading\_periods": Optional information to include with each Course. When<br>grading\_periods is given, a list of the grading periods associated with<br>each course is returned.<br>- "term": Optional information to include with each Course. When<br>term is given, the information for the enrollment term for each course<br>is returned.<br>- "account": Optional information to include with each Course. When<br>account is given, the account json for each course is returned.<br>- "course\_progress": Optional information to include with each Course.<br>When course\_progress is given, each course will include a<br>'course\_progress' object with the fields: 'requirement\_count', an integer<br>specifying the total number of requirements in the course,<br>'requirement\_completed\_count', an integer specifying the total number of<br>requirements in this course that have been completed, and<br>'next\_requirement\_url', a string url to the next requirement item, and<br>'completed\_at', the date the course was completed (null if incomplete).<br>'next\_requirement\_url' will be null if all requirements have been<br>completed or the current module does not require sequential progress.<br>"course\_progress" will return an error message if the course is not<br>module based or the user is not enrolled as a student in the course.<br>- "sections": Section enrollment information to include with each Course.<br>Returns an array of hashes containing the section ID (id), section name<br>(name), start and end dates (start\_at, end\_at), as well as the enrollment<br>type (enrollment\_role, e.g. 'StudentEnrollment').<br>- "storage\_quota\_used\_mb": The amount of storage space used by the files in this course<br>- "total\_students": Optional information to include with each Course.<br>Returns an integer for the total amount of active and invited students.<br>- "passback\_status": Include the grade passback\_status<br>- "favorites": Optional information to include with each Course.<br>Indicates if the user has marked the course as a favorite course.<br>- "teachers": Teacher information to include with each Course.<br>Returns an array of hashes containing the <a href="/pages/MdP5ietTKYXvENCpwUFT#UserDisplay">UserDisplay</a> information<br>for each teacher in the course.<br>- "observed\_users": Optional information to include with each Course.<br>Will include data for observed users if the current user has an<br>observer enrollment.<br>- "tabs": Optional information to include with each Course.<br>Will include the list of tabs configured for each course. See the<br><a href="/pages/it0n0xczFvyI0IHWy5v5#method.tabs.index">List available tabs API</a> for more information.<br>- "course\_image": Optional information to include with each Course. Returns course<br>image url if a course image has been set.<br>- "banner\_image": Optional information to include with each Course. Returns course<br>banner image url if the course is a Canvas for Elementary subject and a banner<br>image has been set.<br>- "concluded": Optional information to include with each Course. Indicates whether<br>the course has been concluded, taking course and term dates into account.<br>- "post\_manually": Optional information to include with each Course. Returns true if<br>the course post policy is set to "Manually". Returns false if the the course post<br>policy is set to "Automatically".<br>- "syllabus\_versions": Optional information to include with each Course.<br>Returns recent saved versions of the syllabus body. Requires the<br>syllabus\_versioning feature flag and permission to manage course<br>content. Version numbers can be passed to the Restore course<br>syllabus version API. Allowed values: <code>needs\_grading\_count</code>, <code>syllabus\_body</code>, <code>syllabus\_versions</code>, <code>public\_description</code>, <code>total\_scores</code>, <code>current\_grading\_period\_scores</code>, <code>grading\_periods</code>, <code>term</code>, <code>account</code>, <code>course\_progress</code>, <code>sections</code>, <code>storage\_quota\_used\_mb</code>, <code>total\_students</code>, <code>passback\_status</code>, <code>favorites</code>, <code>teachers</code>, <code>observed\_users</code>, <code>course\_image</code>, <code>banner\_image</code>, <code>concluded</code>, <code>post\_manually</code></p> |
| `state[]`          | `string`  | <p>If set, only return courses that are in the given state(s).<br>By default, "available" is returned for students and observers, and<br>anything except "deleted", for all other enrollment types Allowed values: <code>unpublished</code>, <code>available</code>, <code>completed</code>, <code>deleted</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `enrollment_state` | `string`  | <p>When set, only return courses where the user has an enrollment with the given state.<br>This will respect section/course/term date overrides. Allowed values: <code>active</code>, <code>invited\_or\_pending</code>, <code>completed</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `homeroom`         | `boolean` | If set, only return homeroom courses.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `account_id`       | `string`  | If set, only include courses associated with this account                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

Returns a list of [Course](#course) objects.

## [Get user progress](#method.courses.user_progress) <a href="#method.courses.user_progress" id="method.courses.user_progress"></a>

[CoursesController#user\_progress](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/users/:user_id/progress`

**Scope:** `url:GET|/api/v1/courses/:course_id/users/:user_id/progress`

Return progress information for the user and course

You can supply +self+ as the user\_id to query your own progress in a course. To query another user's progress, you must be a teacher in the course, an administrator, or a linked observer of the user.

Returns a [CourseProgress](#courseprogress) object.

## [Create a new course](#method.courses.create) <a href="#method.courses.create" id="method.courses.create"></a>

[CoursesController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `POST /api/v1/accounts/:account_id/courses`

**Scope:** `url:POST|/api/v1/accounts/:account_id/courses`

Create a new course

#### Request Parameters:

| Parameter                                      | Type       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ---------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `course[name]`                                 | `string`   | <p>The name of the course. If omitted, the course will be named "Unnamed<br>Course."</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `course[course_code]`                          | `string`   | The course code for the course.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `course[start_at]`                             | `DateTime` | <p>Course start date in ISO8601 format, e.g. 2011-01-01T01:00Z<br>This value is ignored unless 'restrict\_enrollments\_to\_course\_dates' is set to true.</p>                                                                                                                                                                                                                                                                                                                                                                                         |
| `course[end_at]`                               | `DateTime` | <p>Course end date in ISO8601 format. e.g. 2011-01-01T01:00Z<br>This value is ignored unless 'restrict\_enrollments\_to\_course\_dates' is set to true.</p>                                                                                                                                                                                                                                                                                                                                                                                           |
| `course[license]`                              | `string`   | <p>The name of the licensing. Should be one of the following abbreviations<br>(a descriptive name is included in parenthesis for reference):<br>- 'private' (Private Copyrighted)<br>- 'cc\_by\_nc\_nd' (CC Attribution Non-Commercial No Derivatives)<br>- 'cc\_by\_nc\_sa' (CC Attribution Non-Commercial Share Alike)<br>- 'cc\_by\_nc' (CC Attribution Non-Commercial)<br>- 'cc\_by\_nd' (CC Attribution No Derivatives)<br>- 'cc\_by\_sa' (CC Attribution Share Alike)<br>- 'cc\_by' (CC Attribution)<br>- 'public\_domain' (Public Domain).</p> |
| `course[is_public]`                            | `boolean`  | Set to true if course is public to both authenticated and unauthenticated users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `course[is_public_to_auth_users]`              | `boolean`  | Set to true if course is public only to authenticated users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `course[public_syllabus]`                      | `boolean`  | Set to true to make the course syllabus public.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `course[public_syllabus_to_auth]`              | `boolean`  | Set to true to make the course syllabus public for authenticated users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `course[public_description]`                   | `string`   | A publicly visible description of the course.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `course[allow_student_wiki_edits]`             | `boolean`  | If true, students will be able to modify the course wiki.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `course[allow_wiki_comments]`                  | `boolean`  | If true, course members will be able to comment on wiki pages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `course[allow_student_forum_attachments]`      | `boolean`  | If true, students can attach files to forum posts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `course[open_enrollment]`                      | `boolean`  | Set to true if the course is open enrollment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `course[self_enrollment]`                      | `boolean`  | Set to true if the course is self enrollment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `course[restrict_enrollments_to_course_dates]` | `boolean`  | <p>Set to true to restrict user enrollments to the start and end dates of the<br>course. This value must be set to true<br>in order to specify a course start date and/or end date.</p>                                                                                                                                                                                                                                                                                                                                                               |
| `course[term_id]`                              | `string`   | The unique ID of the term to create to course in.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `course[sis_course_id]`                        | `string`   | The unique SIS identifier.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `course[integration_id]`                       | `string`   | The unique Integration identifier.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `course[hide_final_grades]`                    | `boolean`  | <p>If this option is set to true, the totals in student grades summary will<br>be hidden.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `course[apply_assignment_group_weights]`       | `boolean`  | Set to true to weight final grade based on assignment groups percentages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `course[time_zone]`                            | `string`   | <p>The time zone for the course. Allowed time zones are<br><a href="http://www.iana.org/time-zones">IANA time zones</a> or friendlier<br><a href="http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html">Ruby on Rails time zones</a>.</p>                                                                                                                                                                                                                                                                                                   |
| `offer`                                        | `boolean`  | <p>If this option is set to true, the course will be available to students<br>immediately.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `enroll_me`                                    | `boolean`  | Set to true to enroll the current user as the teacher.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `skip_course_template`                         | `boolean`  | <p>If this option is set to true, the template of the account will not be applied to this course<br>It means copy\_from\_course\_template will not be executed. This option is thought for a course copy.</p>                                                                                                                                                                                                                                                                                                                                         |
| `course[default_view]`                         | `string`   | <p>The type of page that users will see when they first visit the course<br>\* 'feed' Recent Activity Dashboard<br>\* 'modules' Course Modules/Sections Page<br>\* 'assignments' Course Assignments List<br>\* 'syllabus' Course Syllabus Page<br>other types may be added in the future Allowed values: <code>feed</code>, <code>wiki</code>, <code>modules</code>, <code>syllabus</code>, <code>assignments</code></p>                                                                                                                              |
| `course[syllabus_body]`                        | `string`   | The syllabus body for the course                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `course[grading_standard_id]`                  | `integer`  | The grading standard id to set for the course. If no value is provided for this argument the current grading\_standard will be un-set from this course.                                                                                                                                                                                                                                                                                                                                                                                               |
| `course[grade_passback_setting]`               | `string`   | Optional. The grade\_passback\_setting for the course. Only 'nightly\_sync', 'disabled', and '' are allowed                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `course[course_format]`                        | `string`   | Optional. Specifies the format of the course. (Should be 'on\_campus', 'online', or 'blended')                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `course[post_manually]`                        | `boolean`  | <p>Default is false.<br>When true, all grades in the course must be posted manually, and will not be automatically posted.<br>When false, all grades in the course will be automatically posted.</p>                                                                                                                                                                                                                                                                                                                                                  |
| `enable_sis_reactivation`                      | `boolean`  | When true, will first try to re-activate a deleted course with matching sis\_course\_id if possible.                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

Returns a [Course](#course) object.

## [Upload a file](#method.courses.create_file) <a href="#method.courses.create_file" id="method.courses.create_file"></a>

[CoursesController#create\_file](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `POST /api/v1/courses/:course_id/files`

**Scope:** `url:POST|/api/v1/courses/:course_id/files`

Upload a file to the course.

This API endpoint is the first step in uploading a file to a course. See the [File Upload Documentation](/services/canvas/basics/file.file_uploads) for details on the file upload workflow.

Only those with the "Manage Files" permission on a course can upload files to the course. By default, this is Teachers, TAs and Designers.

## [List students](#method.courses.students) <a href="#method.courses.students" id="method.courses.students"></a>

[CoursesController#students](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/students`

**Scope:** `url:GET|/api/v1/courses/:course_id/students`

Returns the paginated list of students enrolled in this course.

DEPRECATED: Please use the [course users](#method.courses.users) endpoint and pass "student" as the enrollment\_type.

Returns a list of [User](/services/canvas/resources/users#user) objects.

## [List users in course](#method.courses.users) <a href="#method.courses.users" id="method.courses.users"></a>

[CoursesController#users](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/users`

**Scope:** `url:GET|/api/v1/courses/:course_id/users`

#### `GET /api/v1/courses/:course_id/search_users`

**Scope:** `url:GET|/api/v1/courses/:course_id/search_users`

Returns the paginated list of users in this course. And optionally the user's enrollments in the course.

#### Request Parameters:

| Parameter            | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| -------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `search_term`        | `string`  | The partial name or full ID of the users to match and return in the results list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `sort`               | `string`  | When set, sort the results of the search based on the given field. Allowed values: `username`, `last_login`, `email`, `sis_id`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `enrollment_type[]`  | `string`  | <p>When set, only return users where the user is enrolled as this type.<br>"student\_view" implies include\[]=test\_student.<br>This argument is ignored if enrollment\_role is given. Allowed values: <code>teacher</code>, <code>student</code>, <code>student\_view</code>, <code>ta</code>, <code>observer</code>, <code>designer</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `enrollment_role`    | `string`  | <p>Deprecated<br>When set, only return users enrolled with the specified course-level role. This can be<br>a role created with the <a href="/pages/f7Drit9p3HR5ij8XDF4s#method.role_overrides.add_role">Add Role API</a> or a<br>base role type of 'StudentEnrollment', 'TeacherEnrollment', 'TaEnrollment',<br>'ObserverEnrollment', or 'DesignerEnrollment'.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `enrollment_role_id` | `integer` | <p>When set, only return courses where the user is enrolled with the specified<br>course-level role. This can be a role created with the<br><a href="/pages/f7Drit9p3HR5ij8XDF4s#method.role_overrides.add_role">Add Role API</a> or a built\_in role id with type<br>'StudentEnrollment', 'TeacherEnrollment', 'TaEnrollment', 'ObserverEnrollment',<br>or 'DesignerEnrollment'.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `section_ids[]`      | `integer` | When set, only return users who are enrolled in the given section(s).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `include[]`          | `string`  | <p>- "enrollments":<br>Optionally include with each Course the user's current and invited<br>enrollments. If the user is enrolled as a student, and the account has<br>permission to manage or view all grades, each enrollment will include a<br>'grades' key with 'current\_score', 'final\_score', 'current\_grade' and<br>'final\_grade' values.<br>- "locked": Optionally include whether an enrollment is locked.<br>- "avatar\_url": Optionally include avatar\_url.<br>- "bio": Optionally include each user's bio.<br>- "test\_student": Optionally include the course's Test Student,<br>if present. Default is to not include Test Student.<br>- "custom\_links": Optionally include plugin-supplied custom links for each student,<br>such as analytics information<br>- "current\_grading\_period\_scores": if enrollments is included as<br>well as this directive, the scores returned in the enrollment<br>will be for the current grading period if there is one. A<br>'grading\_period\_id' value will also be included with the<br>scores. if grading\_period\_id is nil there is no current grading<br>period and the score is a total score.<br>- "uuid": Optionally include the users uuid Allowed values: <code>enrollments</code>, <code>locked</code>, <code>avatar\_url</code>, <code>test\_student</code>, <code>bio</code>, <code>custom\_links</code>, <code>current\_grading\_period\_scores</code>, <code>uuid</code></p> |
| `user_id`            | `string`  | <p>If this parameter is given and it corresponds to a user in the course,<br>the +page+ parameter will be ignored and the page containing the specified user<br>will be returned instead.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `user_ids[]`         | `integer` | <p>If included, the course users set will only include users with IDs<br>specified by the param. Note: this will not work in conjunction<br>with the "user\_id" argument but multiple user\_ids can be included.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `enrollment_state[]` | `string`  | <p>When set, only return users where the enrollment workflow state is of one of the given types.<br>"active" and "invited" enrollments are returned by default. Allowed values: <code>active</code>, <code>invited</code>, <code>rejected</code>, <code>completed</code>, <code>inactive</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

Returns a list of [User](/services/canvas/resources/users#user) objects.

## [List recently logged in students](#method.courses.recent_students) <a href="#method.courses.recent_students" id="method.courses.recent_students"></a>

[CoursesController#recent\_students](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/recent_students`

**Scope:** `url:GET|/api/v1/courses/:course_id/recent_students`

Returns the paginated list of users in this course, ordered by how recently they have logged in. The records include the 'last\_login' field which contains a timestamp of the last time that user logged into canvas. The querying user must have the 'View usage reports' permission.

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
     https://<canvas>/api/v1/courses/<course_id>/recent_users
```

Returns a list of [User](/services/canvas/resources/users#user) objects.

## [Get single user](#method.courses.user) <a href="#method.courses.user" id="method.courses.user"></a>

[CoursesController#user](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/users/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/users/:id`

Return information on a single user.

Accepts the same include\[] parameters as the :users: action, and returns a single user with the same fields as that action.

Returns an [User](/services/canvas/resources/users#user) object.

## [Search for content share users](#method.courses.content_share_users) <a href="#method.courses.content_share_users" id="method.courses.content_share_users"></a>

[CoursesController#content\_share\_users](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/content_share_users`

**Scope:** `url:GET|/api/v1/courses/:course_id/content_share_users`

Returns a paginated list of users you can share content with. Requires the content share feature and the user must have the manage content permission for the course.

#### Request Parameters:

| Parameter     | Type              | Description                                                                                    |
| ------------- | ----------------- | ---------------------------------------------------------------------------------------------- |
| `search_term` | Required `string` | Term used to find users. Will search available share users with the search term in their name. |

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
     https://<canvas>/api/v1/courses/<course_id>/content_share_users \
     -d 'search_term=smith'
```

Returns a list of [User](/services/canvas/resources/users#user) objects.

## [Preview processed html](#method.courses.preview_html) <a href="#method.courses.preview_html" id="method.courses.preview_html"></a>

[CoursesController#preview\_html](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `POST /api/v1/courses/:course_id/preview_html`

**Scope:** `url:POST|/api/v1/courses/:course_id/preview_html`

Preview html content processed for this course

#### Request Parameters:

| Parameter | Type     | Description                 |
| --------- | -------- | --------------------------- |
| `html`    | `string` | The html content to process |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/preview_html \
     -F 'html=<p><badhtml></badhtml>processed html</p>' \
     -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "html": "<p>processed html</p>"
}
```

## [Course activity stream](#method.courses.activity_stream) <a href="#method.courses.activity_stream" id="method.courses.activity_stream"></a>

[CoursesController#activity\_stream](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/activity_stream`

**Scope:** `url:GET|/api/v1/courses/:course_id/activity_stream`

Returns the current user's course-specific activity stream, paginated.

For full documentation, see the API documentation for the user activity stream, in the user api.

## [Course activity stream summary](#method.courses.activity_stream_summary) <a href="#method.courses.activity_stream_summary" id="method.courses.activity_stream_summary"></a>

[CoursesController#activity\_stream\_summary](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/activity_stream/summary`

**Scope:** `url:GET|/api/v1/courses/:course_id/activity_stream/summary`

Returns a summary of the current user's course-specific activity stream.

For full documentation, see the API documentation for the user activity stream summary, in the user api.

## [Course TODO items](#method.courses.todo_items) <a href="#method.courses.todo_items" id="method.courses.todo_items"></a>

[CoursesController#todo\_items](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/todo`

**Scope:** `url:GET|/api/v1/courses/:course_id/todo`

Returns the current user's course-specific todo items.

For full documentation, see the API documentation for the user todo items, in the user api.

## [Delete/Conclude a course](#method.courses.destroy) <a href="#method.courses.destroy" id="method.courses.destroy"></a>

[CoursesController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `DELETE /api/v1/courses/:id`

**Scope:** `url:DELETE|/api/v1/courses/:id`

Delete or conclude an existing course

#### Request Parameters:

| Parameter | Type              | Description                                                            |
| --------- | ----------------- | ---------------------------------------------------------------------- |
| `event`   | Required `string` | The action to take on the course. Allowed values: `delete`, `conclude` |

#### Example Response:

```js
{ "delete": "true" }
```

## [Get course settings](#method.courses.api_settings) <a href="#method.courses.api_settings" id="method.courses.api_settings"></a>

[CoursesController#api\_settings](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/settings`

**Scope:** `url:GET|/api/v1/courses/:course_id/settings`

Returns some of a course's settings.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/settings \
  -X GET \
  -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "allow_student_discussion_topics": true,
  "allow_student_forum_attachments": false,
  "allow_student_discussion_editing": true,
  "grading_standard_enabled": true,
  "grading_standard_id": 137,
  "allow_student_organized_groups": true,
  "hide_final_grades": false,
  "hide_distribution_graphs": false,
  "hide_sections_on_course_users_page": false,
  "lock_all_announcements": true,
  "usage_rights_required": false,
  "homeroom_course": false,
  "default_due_time": "23:59:59",
  "conditional_release": false
}
```

## [Update course settings](#method.courses.update_settings) <a href="#method.courses.update_settings" id="method.courses.update_settings"></a>

[CoursesController#update\_settings](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `PUT /api/v1/courses/:course_id/settings`

**Scope:** `url:PUT|/api/v1/courses/:course_id/settings`

Can update the following course settings:

#### Request Parameters:

| Parameter                                   | Type      | Description                                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `allow_final_grade_override`                | `boolean` | Let student final grades for a grading period or the total grades for the course be overridden                                                                                                                                                                                                                                                            |
| `allow_student_discussion_topics`           | `boolean` | Let students create discussion topics                                                                                                                                                                                                                                                                                                                     |
| `allow_student_forum_attachments`           | `boolean` | Let students attach files to discussions                                                                                                                                                                                                                                                                                                                  |
| `allow_student_discussion_editing`          | `boolean` | Let students edit or delete their own discussion replies                                                                                                                                                                                                                                                                                                  |
| `allow_student_organized_groups`            | `boolean` | Let students organize their own groups                                                                                                                                                                                                                                                                                                                    |
| `allow_student_discussion_reporting`        | `boolean` | Let students report offensive discussion content                                                                                                                                                                                                                                                                                                          |
| `allow_student_anonymous_discussion_topics` | `boolean` | Let students create anonymous discussion topics                                                                                                                                                                                                                                                                                                           |
| `filter_speed_grader_by_student_group`      | `boolean` | Filter SpeedGrader to only the selected student group                                                                                                                                                                                                                                                                                                     |
| `hide_final_grades`                         | `boolean` | Hide totals in student grades summary                                                                                                                                                                                                                                                                                                                     |
| `hide_distribution_graphs`                  | `boolean` | Hide grade distribution graphs from students                                                                                                                                                                                                                                                                                                              |
| `hide_sections_on_course_users_page`        | `boolean` | Disallow students from viewing students in sections they do not belong to                                                                                                                                                                                                                                                                                 |
| `lock_all_announcements`                    | `boolean` | Disable comments on announcements                                                                                                                                                                                                                                                                                                                         |
| `usage_rights_required`                     | `boolean` | Copyright and license information must be provided for files before they are published.                                                                                                                                                                                                                                                                   |
| `restrict_student_past_view`                | `boolean` | Restrict students from viewing courses after end date                                                                                                                                                                                                                                                                                                     |
| `restrict_student_future_view`              | `boolean` | Restrict students from viewing courses before start date                                                                                                                                                                                                                                                                                                  |
| `show_announcements_on_home_page`           | `boolean` | <p>Show the most recent announcements on the Course home page (if a Wiki, defaults to five announcements, configurable via home\_page\_announcement\_limit).<br>Canvas for Elementary subjects ignore this setting.</p>                                                                                                                                   |
| `home_page_announcement_limit`              | `integer` | Limit the number of announcements on the home page if enabled via show\_announcements\_on\_home\_page                                                                                                                                                                                                                                                     |
| `syllabus_course_summary`                   | `boolean` | Show the course summary (list of assignments and calendar events) on the syllabus page. Default is true.                                                                                                                                                                                                                                                  |
| `default_due_time`                          | `string`  | <p>Set the default due time for assignments. This is the time that will be pre-selected in the Canvas user interface<br>when setting a due date for an assignment. It does not change when any existing assignment is due. It should be<br>given in 24-hour HH:MM:SS format. The default is "23:59:59". Use "inherit" to inherit the account setting.</p> |
| `conditional_release`                       | `boolean` | Enable or disable individual learning paths for students based on assessment                                                                                                                                                                                                                                                                              |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/settings \
  -X PUT \
  -H 'Authorization: Bearer <token>' \
  -d 'allow_student_discussion_topics=false'
```

## [Return test student for course](#method.courses.student_view_student) <a href="#method.courses.student_view_student" id="method.courses.student_view_student"></a>

[CoursesController#student\_view\_student](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/student_view_student`

**Scope:** `url:GET|/api/v1/courses/:course_id/student_view_student`

Returns information for a test student in this course. Creates a test student if one does not already exist for the course. The caller must have permission to access the course's student view.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/student_view_student \
  -X GET \
  -H 'Authorization: Bearer <token>'
```

Returns an [User](/services/canvas/resources/users#user) object.

## [Get a single course](#method.courses.show) <a href="#method.courses.show" id="method.courses.show"></a>

[CoursesController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:id`

**Scope:** `url:GET|/api/v1/courses/:id`

#### `GET /api/v1/accounts/:account_id/courses/:id`

**Scope:** `url:GET|/api/v1/accounts/:account_id/courses/:id`

Return information on a single course.

Accepts the same include\[] parameters as the list action plus:

#### Request Parameters:

| Parameter       | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| --------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]`     | `string`  | <p>- "all\_courses": Also search recently deleted courses.<br>- "permissions": Include permissions the current user has<br>for the course.<br>- "observed\_users": Include observed users in the enrollments<br>- "course\_image": Include course image url if a course image has been set<br>- "banner\_image": Include course banner image url if the course is a Canvas for<br>Elementary subject and a banner image has been set<br>- "concluded": Optional information to include with Course. Indicates whether<br>the course has been concluded, taking course and term dates into account.<br>- "lti\_context\_id": Include course LTI tool id.<br>- "post\_manually": Include course post policy. If the post policy is manually post grades,<br>the value will be true. If the post policy is automatically post grades, the value will be false.<br>- "syllabus\_versions": Optional information to include with each Course.<br>Returns recent saved versions of the syllabus body. Requires the<br>syllabus\_versioning feature flag and permission to manage course<br>content. Version numbers can be passed to the Restore course<br>syllabus version API. Allowed values: <code>needs\_grading\_count</code>, <code>syllabus\_body</code>, <code>syllabus\_versions</code>, <code>public\_description</code>, <code>total\_scores</code>, <code>current\_grading\_period\_scores</code>, <code>term</code>, <code>account</code>, <code>course\_progress</code>, <code>sections</code>, <code>storage\_quota\_used\_mb</code>, <code>total\_students</code>, <code>passback\_status</code>, <code>favorites</code>, <code>teachers</code>, <code>observed\_users</code>, <code>all\_courses</code>, <code>permissions</code>, <code>course\_image</code>, <code>banner\_image</code>, <code>concluded</code>, <code>lti\_context\_id</code>, <code>post\_manually</code></p> |
| `teacher_limit` | `integer` | <p>The maximum number of teacher enrollments to show.<br>If the course contains more teachers than this, instead of giving the teacher<br>enrollments, the count of teachers will be given under a <em>teacher\_count</em> key.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

Returns a [Course](#course) object.

## [Update a course](#method.courses.update) <a href="#method.courses.update" id="method.courses.update"></a>

[CoursesController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `PUT /api/v1/courses/:id`

**Scope:** `url:PUT|/api/v1/courses/:id`

Update an existing course.

Arguments are the same as Courses#create, with a few exceptions (enroll\_me).

If a user has content management rights, but not full course editing rights, the only attribute editable through this endpoint will be "syllabus\_body"

If an account has set prevent\_course\_availability\_editing\_by\_teachers, a teacher cannot change +course\[start\_at]+, +course\[conclude\_at]+, or +course\[restrict\_enrollments\_to\_course\_dates]+ here.

#### Request Parameters:

| Parameter                                           | Type                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| --------------------------------------------------- | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `course[account_id]`                                | `integer`                        | The unique ID of the account to move the course to.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `course[name]`                                      | `string`                         | <p>The name of the course. If omitted, the course will be named "Unnamed<br>Course."</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `course[course_code]`                               | `string`                         | The course code for the course.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `course[start_at]`                                  | `DateTime`                       | <p>Course start date in ISO8601 format, e.g. 2011-01-01T01:00Z<br>This value is ignored unless 'restrict\_enrollments\_to\_course\_dates' is set to true,<br>or the course is already published.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `course[end_at]`                                    | `DateTime`                       | <p>Course end date in ISO8601 format. e.g. 2011-01-01T01:00Z<br>This value is ignored unless 'restrict\_enrollments\_to\_course\_dates' is set to true.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `course[license]`                                   | `string`                         | <p>The name of the licensing. Should be one of the following abbreviations<br>(a descriptive name is included in parenthesis for reference):<br>- 'private' (Private Copyrighted)<br>- 'cc\_by\_nc\_nd' (CC Attribution Non-Commercial No Derivatives)<br>- 'cc\_by\_nc\_sa' (CC Attribution Non-Commercial Share Alike)<br>- 'cc\_by\_nc' (CC Attribution Non-Commercial)<br>- 'cc\_by\_nd' (CC Attribution No Derivatives)<br>- 'cc\_by\_sa' (CC Attribution Share Alike)<br>- 'cc\_by' (CC Attribution)<br>- 'public\_domain' (Public Domain).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `course[is_public]`                                 | `boolean`                        | Set to true if course is public to both authenticated and unauthenticated users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `course[is_public_to_auth_users]`                   | `boolean`                        | Set to true if course is public only to authenticated users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `course[public_syllabus]`                           | `boolean`                        | Set to true to make the course syllabus public.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `course[public_syllabus_to_auth]`                   | `boolean`                        | Set to true to make the course syllabus to public for authenticated users.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `course[public_description]`                        | `string`                         | A publicly visible description of the course.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `course[allow_student_wiki_edits]`                  | `boolean`                        | If true, students will be able to modify the course wiki.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `course[allow_wiki_comments]`                       | `boolean`                        | If true, course members will be able to comment on wiki pages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `course[allow_student_forum_attachments]`           | `boolean`                        | If true, students can attach files to forum posts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `course[open_enrollment]`                           | `boolean`                        | Set to true if the course is open enrollment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `course[self_enrollment]`                           | `boolean`                        | Set to true if the course is self enrollment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `course[restrict_enrollments_to_course_dates]`      | `boolean`                        | <p>Set to true to restrict user enrollments to the start and end dates of the<br>course. Setting this value to false will<br>remove the course end date (if it exists), as well as the course start date<br>(if the course is unpublished).</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `course[term_id]`                                   | `integer`                        | The unique ID of the term to create to course in.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `course[sis_course_id]`                             | `string`                         | The unique SIS identifier.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `course[integration_id]`                            | `string`                         | The unique Integration identifier.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `course[hide_final_grades]`                         | `boolean`                        | <p>If this option is set to true, the totals in student grades summary will<br>be hidden.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `course[time_zone]`                                 | `string`                         | <p>The time zone for the course. Allowed time zones are<br><a href="http://www.iana.org/time-zones">IANA time zones</a> or friendlier<br><a href="http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html">Ruby on Rails time zones</a>.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `course[apply_assignment_group_weights]`            | `boolean`                        | Set to true to weight final grade based on assignment groups percentages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `course[storage_quota_mb]`                          | `integer`                        | <p>Set the storage quota for the course, in megabytes. The caller must have<br>the "Manage storage quotas" account permission.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `offer`                                             | `boolean`                        | <p>If this option is set to true, the course will be available to students<br>immediately.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `course[event]`                                     | `string`                         | <p>The action to take on each course.<br>\* 'claim' makes a course no longer visible to students. This action is also called "unpublish" on the web site.<br>A course cannot be unpublished if students have received graded submissions.<br>\* 'offer' makes a course visible to students. This action is also called "publish" on the web site.<br>\* 'conclude' prevents future enrollments and makes a course read-only for all participants. The course still appears<br>in prior-enrollment lists.<br>\* 'delete' completely removes the course from the web site (including course menus and prior-enrollment lists).<br>All enrollments are deleted. Course content may be physically deleted at a future date.<br>\* 'undelete' attempts to recover a course that has been deleted. This action requires account administrative rights.<br>(Recovery is not guaranteed; please conclude rather than delete a course if there is any possibility the course<br>will be used again.) The recovered course will be unpublished. Deleted enrollments will not be recovered. Allowed values: <code>claim</code>, <code>offer</code>, <code>conclude</code>, <code>delete</code>, <code>undelete</code></p> |
| `course[default_view]`                              | `string`                         | <p>The type of page that users will see when they first visit the course<br>\* 'feed' Recent Activity Dashboard<br>\* 'wiki' Wiki Front Page<br>\* 'modules' Course Modules/Sections Page<br>\* 'assignments' Course Assignments List<br>\* 'syllabus' Course Syllabus Page<br>other types may be added in the future Allowed values: <code>feed</code>, <code>wiki</code>, <code>modules</code>, <code>syllabus</code>, <code>assignments</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `course[syllabus_body]`                             | `string`                         | The syllabus body for the course                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `course[syllabus_course_summary]`                   | `boolean`                        | Optional. Indicates whether the Course Summary (consisting of the course's assignments and calendar events) is displayed on the syllabus page. Defaults to +true+.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `course[grading_standard_id]`                       | `integer`                        | The grading standard id to set for the course. If no value is provided for this argument the current grading\_standard will be un-set from this course.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `course[grade_passback_setting]`                    | `string`                         | Optional. The grade\_passback\_setting for the course. Only 'nightly\_sync' and '' are allowed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `course[course_format]`                             | `string`                         | Optional. Specifies the format of the course. (Should be either 'on\_campus' or 'online')                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `course[image_id]`                                  | `integer`                        | <p>This is a file ID corresponding to an image file in the course that will<br>be used as the course image.<br>This will clear the course's image\_url setting if set. If you attempt<br>to provide image\_url and image\_id in a request it will fail.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `course[image_url]`                                 | `string`                         | <p>This is a URL to an image to be used as the course image.<br>This will clear the course's image\_id setting if set. If you attempt<br>to provide image\_url and image\_id in a request it will fail.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `course[remove_image]`                              | `boolean`                        | <p>If this option is set to true, the course image url and course image<br>ID are both set to nil</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `course[remove_banner_image]`                       | `boolean`                        | <p>If this option is set to true, the course banner image url and course<br>banner image ID are both set to nil</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `course[blueprint]`                                 | `boolean`                        | Sets the course as a blueprint course.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `course[blueprint_restrictions]`                    | `BlueprintRestriction`           | <p>Sets a default set to apply to blueprint course objects when restricted,<br>unless <em>use\_blueprint\_restrictions\_by\_object\_type</em> is enabled.<br>See the <a href="/pages/wmnKqnrLjdN7dJPPiPfN#BlueprintRestriction">Blueprint Restriction</a> documentation</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `course[use_blueprint_restrictions_by_object_type]` | `boolean`                        | <p>When enabled, the <em>blueprint\_restrictions</em> parameter will be ignored in favor of<br>the <em>blueprint\_restrictions\_by\_object\_type</em> parameter</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `course[blueprint_restrictions_by_object_type]`     | `multiple BlueprintRestrictions` | <p>Allows setting multiple <a href="/pages/wmnKqnrLjdN7dJPPiPfN#BlueprintRestriction">Blueprint Restriction</a><br>to apply to blueprint course objects of the matching type when restricted.<br>The possible object types are "assignment", "attachment", "discussion\_topic", "quiz" and "wiki\_page".<br>Example usage:<br>course\[blueprint\_restrictions\_by\_object\_type]\[assignment]\[content]=1</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `course[homeroom_course]`                           | `boolean`                        | <p>Sets the course as a homeroom course. The setting takes effect only when the course is associated<br>with a Canvas for Elementary-enabled account.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `course[sync_enrollments_from_homeroom]`            | `string`                         | <p>Syncs enrollments from the homeroom that is set in homeroom\_course\_id. The setting only takes effect when the<br>course is associated with a Canvas for Elementary-enabled account and sync\_enrollments\_from\_homeroom is enabled.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `course[homeroom_course_id]`                        | `string`                         | <p>Sets the Homeroom Course id to be used with sync\_enrollments\_from\_homeroom. The setting only takes effect when the<br>course is associated with a Canvas for Elementary-enabled account and sync\_enrollments\_from\_homeroom is enabled.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `course[template]`                                  | `boolean`                        | Enable or disable the course as a template that can be selected by an account                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `course[course_color]`                              | `string`                         | <p>Sets a color in hex code format to be associated with the course. The setting takes effect only when the course<br>is associated with a Canvas for Elementary-enabled account.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `course[friendly_name]`                             | `string`                         | <p>Set a friendly name for the course. If this is provided and the course is associated with a Canvas for<br>Elementary account, it will be shown instead of the course name. This setting takes priority over<br>course nicknames defined by individual users.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `course[enable_course_paces]`                       | `boolean`                        | <p>Enable or disable Course Pacing for the course. This setting only has an effect when the Course Pacing feature flag is<br>enabled for the sub-account. Otherwise, Course Pacing are always disabled.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `course[conditional_release]`                       | `boolean`                        | Enable or disable individual learning paths for students based on assessment                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `course[post_manually]`                             | `boolean`                        | <p>When true, all grades in the course will be posted manually.<br>When false, all grades in the course will be automatically posted.<br>Use with caution as this setting will override any assignment level post policy.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `override_sis_stickiness`                           | `boolean`                        | <p>Default is true. If false, any fields containing “sticky” changes will not be updated.<br>See SIS CSV Format documentation for information on which fields can have SIS stickiness</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id> \
  -X PUT \
  -H 'Authorization: Bearer <token>' \
  -d 'course[name]=New course name' \
  -d 'course[start_at]=2012-05-05T00:00:00Z'
```

#### Example Response:

```js
{
  "name": "New course name",
  "course_code": "COURSE-001",
  "start_at": "2012-05-05T00:00:00Z",
  "end_at": "2012-08-05T23:59:59Z",
  "sis_course_id": "12345"
}
```

## [Update courses](#method.courses.batch_update) <a href="#method.courses.batch_update" id="method.courses.batch_update"></a>

[CoursesController#batch\_update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `PUT /api/v1/accounts/:account_id/courses`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/courses`

Update multiple courses in an account. Operates asynchronously; use the [progress endpoint](https://developerdocs.instructure.com/services/canvas/resources/pages/3xnEhMZQuJstdXB8KHiv#method.progress.show) to query the status of an operation.

#### Request Parameters:

| Parameter      | Type              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| -------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `course_ids[]` | Required `string` | List of ids of courses to update. At most 500 courses may be updated in one call.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `event`        | Required `string` | <p>The action to take on each course. Must be one of 'offer', 'conclude', 'delete', or 'undelete'.<br>\* 'offer' makes a course visible to students. This action is also called "publish" on the web site.<br>\* 'conclude' prevents future enrollments and makes a course read-only for all participants. The course still appears<br>in prior-enrollment lists.<br>\* 'delete' completely removes the course from the web site (including course menus and prior-enrollment lists).<br>All enrollments are deleted. Course content may be physically deleted at a future date.<br>\* 'undelete' attempts to recover a course that has been deleted. (Recovery is not guaranteed; please conclude<br>rather than delete a course if there is any possibility the course will be used again.) The recovered course<br>will be unpublished. Deleted enrollments will not be recovered. Allowed values: <code>offer</code>, <code>conclude</code>, <code>delete</code>, <code>undelete</code></p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/accounts/<account_id>/courses \
  -X PUT \
  -H 'Authorization: Bearer <token>' \
  -d 'event=offer' \
  -d 'course_ids[]=1' \
  -d 'course_ids[]=2'
```

Returns a [Progress](/services/canvas/resources/progress#progress) object.

## [Reset a course](#method.courses.reset_content) <a href="#method.courses.reset_content" id="method.courses.reset_content"></a>

[CoursesController#reset\_content](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `POST /api/v1/courses/:course_id/reset_content`

**Scope:** `url:POST|/api/v1/courses/:course_id/reset_content`

Deletes the current course, and creates a new equivalent course with no content, but all sections and users moved over.

Returns a [Course](#course) object.

## [Get effective due dates](#method.courses.effective_due_dates) <a href="#method.courses.effective_due_dates" id="method.courses.effective_due_dates"></a>

[CoursesController#effective\_due\_dates](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/effective_due_dates`

**Scope:** `url:GET|/api/v1/courses/:course_id/effective_due_dates`

For each assignment in the course, returns each assigned student's ID and their corresponding due date along with some grading period data. Returns a collection with keys representing assignment IDs and values as a collection containing keys representing student IDs and values representing the student's effective due\_at, the grading\_period\_id of which the due\_at falls in, and whether or not the grading period is closed (in\_closed\_grading\_period)

The list of assignment IDs for which effective student due dates are requested. If not provided, all assignments in the course will be used.

#### Request Parameters:

| Parameter          | Type     | Description    |
| ------------------ | -------- | -------------- |
| `assignment_ids[]` | `string` | no description |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/effective_due_dates
  -X GET \
  -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "1": {
     "14": { "due_at": "2015-09-05", "grading_period_id": null, "in_closed_grading_period": false },
     "15": { due_at: null, "grading_period_id": 3, "in_closed_grading_period": true }
  },
  "2": {
     "14": { "due_at": "2015-08-05", "grading_period_id": 3, "in_closed_grading_period": true }
  }
}
```

## [Permissions](#method.courses.permissions) <a href="#method.courses.permissions" id="method.courses.permissions"></a>

[CoursesController#permissions](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/permissions`

**Scope:** `url:GET|/api/v1/courses/:course_id/permissions`

Returns permission information for the calling user in the given course. See also the [Account](https://developerdocs.instructure.com/services/canvas/resources/pages/hce5iQ0q3r606RoR4Dor#method.accounts.permissions) and [Group](https://developerdocs.instructure.com/services/canvas/resources/pages/2YyNPW0XHYoLadMGQAZY#method.groups.permissions) counterparts.

#### Request Parameters:

| Parameter       | Type     | Description                                                                                                                                                                                                                                |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `permissions[]` | `string` | <p>List of permissions to check against the authenticated user.<br>Permission names are documented in the <a href="/pages/f7Drit9p3HR5ij8XDF4s#method.role_overrides.manageable_permissions">List assignable permissions</a> endpoint.</p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/permissions \
  -H 'Authorization: Bearer <token>' \
  -d 'permissions[]=manage_grades'
  -d 'permissions[]=send_messages'
```

#### Example Response:

```js
{'manage_grades': 'false', 'send_messages': 'true'}
```

## [Get bulk user progress](#method.courses.bulk_user_progress) <a href="#method.courses.bulk_user_progress" id="method.courses.bulk_user_progress"></a>

[CoursesController#bulk\_user\_progress](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `GET /api/v1/courses/:course_id/bulk_user_progress`

**Scope:** `url:GET|/api/v1/courses/:course_id/bulk_user_progress`

Returns progress information for all users enrolled in the given course.

You must be a user who has permission to view all grades in the course (such as a teacher or administrator).

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/bulk_user_progress \
  -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
[
  {
    "id": 1,
    "display_name": "Test Student 1",
    "avatar_image_url": "https://<canvas>/images/messages/avatar-50.png",
    "html_url": "https://<canvas>/courses/1/users/1",
    "pronouns": null,
    "progress": {
      "requirement_count": 2,
      "requirement_completed_count": 1,
      "next_requirement_url": "https://<canvas>/courses/<course_id>/modules/items/<item_id>",
      "completed_at": null
    }
  },
  {
    "id": 2,
    "display_name": "Test Student 2",
    "avatar_image_url": "https://<canvas>/images/messages/avatar-50.png",
    "html_url": "https://<canvas>/courses/1/users/2",
    "pronouns": null,
    "progress": {
      "requirement_count": 2,
      "requirement_completed_count": 2,
      "next_requirement_url": null,
      "completed_at": "2021-08-10T16:26:08Z"
    }
  }
]
```

## [Remove quiz migration alert](#method.courses.dismiss_migration_limitation_msg) <a href="#method.courses.dismiss_migration_limitation_msg" id="method.courses.dismiss_migration_limitation_msg"></a>

[CoursesController#dismiss\_migration\_limitation\_msg](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `POST /api/v1/courses/:id/dismiss_migration_limitation_message`

**Scope:** `url:POST|/api/v1/courses/:id/dismiss_migration_limitation_message`

Remove alert about the limitations of quiz migrations that is displayed to a user in a course

you must be logged in to use this endpoint

#### Example Response:

```js
{ "success": "true" }
```

## [Restore course syllabus version](#method.courses.restore_version) <a href="#method.courses.restore_version" id="method.courses.restore_version"></a>

[CoursesController#restore\_version](https://github.com/instructure/canvas-lms/blob/master/app/controllers/courses_controller.rb)

#### `POST /api/v1/courses/:course_id/restore/:version_id`

**Scope:** `url:POST|/api/v1/courses/:course_id/restore/:version_id`

Restore a course's syllabus body to a previously saved version. No other course content is affected.

Requires the syllabus\_versioning feature flag to be enabled on the account, and the caller must have permission to manage course content.

#### Request Parameters:

| Parameter    | Type               | Description                                                                                                                                                        |
| ------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `version_id` | Required `integer` | <p>The version number to restore to. Available version numbers are<br>returned by the Get a single course API when include\[]=syllabus\_versions<br>is passed.</p> |

#### Example Request:

```bash
curl -X POST -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/courses/123/restore/4
```

Returns a [Course](#course) object.

## [Get course copy status](#method.content_imports.copy_course_status) <a href="#method.content_imports.copy_course_status" id="method.content_imports.copy_course_status"></a>

[ContentImportsController#copy\_course\_status](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_imports_controller.rb)

#### `GET /api/v1/courses/:course_id/course_copy/:id`

**Scope:** `url:GET|/api/v1/courses/:course_id/course_copy/:id`

DEPRECATED: Please use the [Content Migrations API](https://developerdocs.instructure.com/services/canvas/resources/pages/24PV9Z5ZRmSBcgqRNtDN#method.content_migrations.create)

Retrieve the status of a course copy

#### API response field:

* id

The unique identifier for the course copy.

* created\_at

The time that the copy was initiated.

* progress

The progress of the copy as an integer. It is null before the copying starts, and 100 when finished.

* workflow\_state

The current status of the course copy. Possible values: "created", "started", "completed", "failed"

* status\_url

The url for the course copy status API endpoint.

#### Example Response:

```js
{'progress':100, 'workflow_state':'completed', 'id':257, 'created_at':'2011-11-17T16:50:06Z', 'status_url':'/api/v1/courses/9457/course_copy/257'}
```

## [Copy course content](#method.content_imports.copy_course_content) <a href="#method.content_imports.copy_course_content" id="method.content_imports.copy_course_content"></a>

[ContentImportsController#copy\_course\_content](https://github.com/instructure/canvas-lms/blob/master/app/controllers/content_imports_controller.rb)

#### `POST /api/v1/courses/:course_id/course_copy`

**Scope:** `url:POST|/api/v1/courses/:course_id/course_copy`

DEPRECATED: Please use the [Content Migrations API](https://developerdocs.instructure.com/services/canvas/resources/pages/24PV9Z5ZRmSBcgqRNtDN#method.content_migrations.create)

Copies content from one course into another. The default is to copy all course content. You can control specific types to copy by using either the 'except' option or the 'only' option.

The response is the same as the course copy status endpoint

#### Request Parameters:

| Parameter       | Type     | Description                                                                                                                                                                                                                                                                                                                                                               |
| --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `source_course` | `string` | ID or SIS-ID of the course to copy the content from                                                                                                                                                                                                                                                                                                                       |
| `except[]`      | `string` | <p>A list of the course content types to exclude, all areas not listed will<br>be copied. Allowed values: <code>course\_settings</code>, <code>assignments</code>, <code>external\_tools</code>, <code>files</code>, <code>topics</code>, <code>calendar\_events</code>, <code>quizzes</code>, <code>wiki\_pages</code>, <code>modules</code>, <code>outcomes</code></p>  |
| `only[]`        | `string` | <p>A list of the course content types to copy, all areas not listed will not<br>be copied. Allowed values: <code>course\_settings</code>, <code>assignments</code>, <code>external\_tools</code>, <code>files</code>, <code>topics</code>, <code>calendar\_events</code>, <code>quizzes</code>, <code>wiki\_pages</code>, <code>modules</code>, <code>outcomes</code></p> |

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Custom Gradebook Columns

API for adding additional columns to the gradebook. Custom gradebook columns will be displayed with the other frozen gradebook columns.

#### A CustomColumn object looks like: <a href="#customcolumn" id="customcolumn"></a>

```js
{
  // The ID of the custom gradebook column
  "id": 2,
  // When true, this column's visibility will be toggled in the Gradebook when a
  // user selects to show or hide notes
  "teacher_notes": false,
  // header text
  "title": "Stuff",
  // column order
  "position": 1,
  // won't be displayed if hidden is true
  "hidden": false,
  // won't be editable in the gradebook UI
  "read_only": true
}
```

#### A ColumnDatum object looks like: <a href="#columndatum" id="columndatum"></a>

```js
// ColumnDatum objects contain the entry for a column for each user.
{
  "content": "Nut allergy",
  "user_id": 2
}
```

## [List custom gradebook columns](#method.custom_gradebook_columns_api.index) <a href="#method.custom_gradebook_columns_api.index" id="method.custom_gradebook_columns_api.index"></a>

[CustomGradebookColumnsApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/custom_gradebook_columns_api_controller.rb)

#### `GET /api/v1/courses/:course_id/custom_gradebook_columns`

**Scope:** `url:GET|/api/v1/courses/:course_id/custom_gradebook_columns`

A paginated list of all custom gradebook columns for a course

#### Request Parameters:

| Parameter        | Type      | Description                                   |
| ---------------- | --------- | --------------------------------------------- |
| `include_hidden` | `boolean` | Include hidden parameters (defaults to false) |

Returns a list of [CustomColumn](#customcolumn) objects.

## [Create a custom gradebook column](#method.custom_gradebook_columns_api.create) <a href="#method.custom_gradebook_columns_api.create" id="method.custom_gradebook_columns_api.create"></a>

[CustomGradebookColumnsApiController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/custom_gradebook_columns_api_controller.rb)

#### `POST /api/v1/courses/:course_id/custom_gradebook_columns`

**Scope:** `url:POST|/api/v1/courses/:course_id/custom_gradebook_columns`

Create a custom gradebook column

#### Request Parameters:

| Parameter               | Type              | Description                                                                                                      |
| ----------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------- |
| `column[title]`         | Required `string` | no description                                                                                                   |
| `column[position]`      | `integer`         | The position of the column relative to other custom columns                                                      |
| `column[hidden]`        | `boolean`         | Hidden columns are not displayed in the gradebook                                                                |
| `column[teacher_notes]` | `boolean`         | <p>Set this if the column is created by a teacher. The gradebook only<br>supports one teacher\_notes column.</p> |
| `column[read_only]`     | `boolean`         | Set this to prevent the column from being editable in the gradebook ui                                           |

Returns a [CustomColumn](#customcolumn) object.

## [Update a custom gradebook column](#method.custom_gradebook_columns_api.update) <a href="#method.custom_gradebook_columns_api.update" id="method.custom_gradebook_columns_api.update"></a>

[CustomGradebookColumnsApiController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/custom_gradebook_columns_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/custom_gradebook_columns/:id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/custom_gradebook_columns/:id`

Accepts the same parameters as custom gradebook column creation

Returns a [CustomColumn](#customcolumn) object.

## [Delete a custom gradebook column](#method.custom_gradebook_columns_api.destroy) <a href="#method.custom_gradebook_columns_api.destroy" id="method.custom_gradebook_columns_api.destroy"></a>

[CustomGradebookColumnsApiController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/custom_gradebook_columns_api_controller.rb)

#### `DELETE /api/v1/courses/:course_id/custom_gradebook_columns/:id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/custom_gradebook_columns/:id`

Permanently deletes a custom column and its associated data

Returns a [CustomColumn](#customcolumn) object.

## [Reorder custom columns](#method.custom_gradebook_columns_api.reorder) <a href="#method.custom_gradebook_columns_api.reorder" id="method.custom_gradebook_columns_api.reorder"></a>

[CustomGradebookColumnsApiController#reorder](https://github.com/instructure/canvas-lms/blob/master/app/controllers/custom_gradebook_columns_api_controller.rb)

#### `POST /api/v1/courses/:course_id/custom_gradebook_columns/reorder`

**Scope:** `url:POST|/api/v1/courses/:course_id/custom_gradebook_columns/reorder`

Puts the given columns in the specified order

\<b>200 OK\</b> is returned if successful

#### Request Parameters:

| Parameter | Type               | Description    |
| --------- | ------------------ | -------------- |
| `order[]` | Required `integer` | no description |

## [List entries for a column](#method.custom_gradebook_column_data_api.index) <a href="#method.custom_gradebook_column_data_api.index" id="method.custom_gradebook_column_data_api.index"></a>

[CustomGradebookColumnDataApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/custom_gradebook_column_data_api_controller.rb)

#### `GET /api/v1/courses/:course_id/custom_gradebook_columns/:id/data`

**Scope:** `url:GET|/api/v1/courses/:course_id/custom_gradebook_columns/:id/data`

This does not list entries for students without associated data.

#### Request Parameters:

| Parameter        | Type      | Description                                                                                                                     |
| ---------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------- |
| `include_hidden` | `boolean` | <p>If true, hidden columns will be included in the<br>result. If false or absent, only visible columns<br>will be returned.</p> |

Returns a list of [ColumnDatum](#columndatum) objects.

## [Update column data](#method.custom_gradebook_column_data_api.update) <a href="#method.custom_gradebook_column_data_api.update" id="method.custom_gradebook_column_data_api.update"></a>

[CustomGradebookColumnDataApiController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/custom_gradebook_column_data_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/custom_gradebook_columns/:id/data/:user_id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/custom_gradebook_columns/:id/data/:user_id`

Set the content of a custom column

#### Request Parameters:

| Parameter              | Type              | Description                                                         |
| ---------------------- | ----------------- | ------------------------------------------------------------------- |
| `column_data[content]` | Required `string` | Column content. Setting this to blank will delete the datum object. |

Returns a [ColumnDatum](#columndatum) object.

## [Bulk update column data](#method.custom_gradebook_column_data_api.bulk_update) <a href="#method.custom_gradebook_column_data_api.bulk_update" id="method.custom_gradebook_column_data_api.bulk_update"></a>

[CustomGradebookColumnDataApiController#bulk\_update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/custom_gradebook_column_data_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/custom_gradebook_column_data`

**Scope:** `url:PUT|/api/v1/courses/:course_id/custom_gradebook_column_data`

Set the content of custom columns

{ "column\_data": \[ { "column\_id": example\_column\_id, "user\_id": example\_student\_id, "content": example\_content }, { "column\_id": example\_column\_id, "user\_id": example\_student\_id, "content: example\_content } ] }

#### Request Parameters:

| Parameter       | Type             | Description                                                                  |
| --------------- | ---------------- | ---------------------------------------------------------------------------- |
| `column_data[]` | Required `Array` | Column content. Setting this to an empty string will delete the data object. |

#### Example Request:

```bash
```

Returns a [Progress](/services/canvas/resources/progress#progress) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Developer Key Account Bindings

Developer key account bindings API for binding a developer key to a context and specifying a workflow state for that relationship.

#### A DeveloperKeyAccountBinding object looks like: <a href="#developerkeyaccountbinding" id="developerkeyaccountbinding"></a>

```js
{
  // The Canvas ID of the binding
  "id": 1,
  // The global Canvas ID of the account in the binding
  "account_id": 10000000000001,
  // The global Canvas ID of the developer key in the binding
  "developer_key_id": 10000000000008,
  // The workflow state of the binding. Will be one of 'on', 'off', or 'allow.'
  "workflow_state": on,
  // True if the requested context owns the binding
  "account_owns_binding": true
}
```

## [Create a Developer Key Account Binding](#method.developer_key_account_bindings.create_or_update) <a href="#method.developer_key_account_bindings.create_or_update" id="method.developer_key_account_bindings.create_or_update"></a>

[DeveloperKeyAccountBindingsController#create\_or\_update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/developer_key_account_bindings_controller.rb)

#### `POST /api/v1/accounts/:account_id/developer_keys/:developer_key_id/developer_key_account_bindings`

**Scope:** `url:POST|/api/v1/accounts/:account_id/developer_keys/:developer_key_id/developer_key_account_bindings`

Create a new Developer Key Account Binding. The developer key specified in the request URL must be available in the requested account or the requested account's account chain. If the binding already exists for the specified account/key combination it will be updated.

#### Request Parameters:

| Parameter        | Type     | Description                                                                                              |
| ---------------- | -------- | -------------------------------------------------------------------------------------------------------- |
| `workflow_state` | `string` | <p>The workflow state for the binding. Must be one of "on", "off", or "allow".<br>Defaults to "off".</p> |

Returns a [DeveloperKeyAccountBinding](#developerkeyaccountbinding) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Developer Keys

Manage Canvas API Keys, used for OAuth access to this API. See [the OAuth access docs](/services/canvas/oauth2/file.oauth) for usage of these keys. Note that DeveloperKeys are also (currently) used for LTI 1.3 registration and OIDC access, but this endpoint deals with Canvas API keys. See [LTI Registration](/services/canvas/external-tools/lti/file.registration) for details.

#### A DeveloperKey object looks like: <a href="#developerkey" id="developerkey"></a>

```js
// a Canvas API key (or LTI 1.3 registration)
{
  // The Canvas ID of the DeveloperKey object
  "id": 1,
  // The display name
  "name": "Test Key",
  // Timestamp of the key's creation
  "created_at": "2025-05-30T17:09:18Z",
  // Timestamp of the key's last update
  "updated_at": "2025-05-30T17:09:18Z",
  // The state of the key
  "workflow_state": "active",
  // True if key represents an LTI 1.3 Registration. False for Canvas API keys
  "is_lti_key": false,
  // Contact email configured for key
  "email": "test@example.com",
  // URL for a small icon to display in key list
  "icon_url": "https://example.com/icon.png",
  // User-provided notes about key
  "notes": "this key is for testing",
  // User-specified code representing the vendor that uses the key
  "vendor_code": "Google",
  // The name of the account that owns the key
  "account_name": "Test Account",
  // True for all keys except Site Admin-level keys, which default to false.
  // Controls visibility in the Inherited tab.
  "visible": true,
  // List of API endpoints key is allowed to access (API keys), or LTI 1.3 scopes
  // (LTI keys)
  "scopes": ["url:GET|/api/v1/accounts"],
  // Deprecated in favor of redirect_uris. Do not use.
  "redirect_uri": "no",
  // List of URLs used during OAuth2 flow to validate given redirect URI (API
  // keys), or to redirect to after login (LTI keys)
  "redirect_uris": ["https://mytool.com/oauth2/redirect", "https://mytool.com/1_3/launch"],
  // All redirect URIs associated with the key, including any that have been
  // automatically deactivated due to inactivity, along with their last-used
  // timestamp and workflow_state (one of 'active' or 'inactive')
  "all_redirect_uris": [{"redirect_uri":"https:\/\/mytool.com\/redirect","last_used_at":"2024-01-15T12:00:00Z","workflow_state":"active"}],
  // (API keys only) The number of active access tokens associated with the key
  "access_token_count": 42,
  // (API keys only) The last time an access token for this key was used in an API
  // request
  "last_used_at": "2025-05-30T17:09:18Z",
  // (API keys only) If true, key is only usable in non-production environments
  // (test, beta). Avoids problems with beta refresh.
  "test_cluster_only": false,
  // (API keys only) If true, allows `includes` parameters in API requests that
  // match the scopes of this key
  "allow_includes": true,
  // (API keys only) If true, then token requests with this key must include
  // scopes
  "require_scopes": false,
  // (API keys only) Used in OAuth2 client credentials flow to specify the
  // audience for the access token
  "client_credentials_audience": "external",
  // (API keys only) The registered audiences this key may request tokens for.
  // Each value must appear in the environment's configured list of registered
  // audiences.
  "allowed_audiences": ["cedar-api-production.us-east-1.temp.prod.inseng.io"],
  // (API keys only) Additional OAuth2 flows this key is authorized to use.
  // Allowed values: token_exchange, service_user_client_credentials.
  "authorized_flows": ["token_exchange"],
  // (API keys only) Whether this is a confidential or public client. Public
  // clients (SPAs, mobile apps) require PKCE, cannot use client_credentials, and
  // receive short-lived rotating tokens. Allowed values: confidential, public.
  // Defaults to confidential. Immutable after creation.
  "client_type": "confidential",
  // (API keys only) The client secret used in the OAuth authorization_code flow.
  "api_key": "sd45fg64....",
  // (LTI keys only) The Canvas-style tool configuration for this key.
  "tool_configuration": {"type":"Lti::ToolConfiguration"},
  // (LTI keys only) The tool's public JWK in JSON format. Discouraged in favor of
  // a url hosting a JWK set.
  "public_jwk": {"e":"AQAB","etc":"etc"},
  // (LTI keys only) The tool-hosted URL containing its public JWK keyset. Canvas
  // may cache JWKs up to 5 minutes.
  "public_jwk_url": "https://mytool.com/1_3/jwks",
  // (LTI keys only) The LTI IMS Registration object for this key, if key was
  // created via Dynamic Registration.
  "lti_registration": {"type":"TODO Lti::IMS::Registration"},
  // (LTI keys only) Returns true if key was created via Dynamic Registration.
  "is_lti_registration": false,
  // Unused.
  "user_name": "",
  // Unused.
  "user_id": "",
  // Correlates an API key to a product configuration.
  "unified_tool_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}
```

## [List Developer Keys](#method.developer_keys.index) <a href="#method.developer_keys.index" id="method.developer_keys.index"></a>

[DeveloperKeysController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/developer_keys_controller.rb)

#### `GET /api/v1/accounts/:account_id/developer_keys`

**Scope:** `url:GET|/api/v1/accounts/:account_id/developer_keys`

List all developer keys created in the current account.

#### Request Parameters:

| Parameter   | Type      | Description                                                                                                                |
| ----------- | --------- | -------------------------------------------------------------------------------------------------------------------------- |
| `inherited` | `boolean` | <p>Defaults to false. If true, lists keys inherited from<br>Site Admin (and consortium parent account, if applicable).</p> |

Returns a list of [DeveloperKey](#developerkey) objects.

## [Create a Developer Key](#method.developer_keys.create) <a href="#method.developer_keys.create" id="method.developer_keys.create"></a>

[DeveloperKeysController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/developer_keys_controller.rb)

#### `POST /api/v1/accounts/:account_id/developer_keys`

**Scope:** `url:POST|/api/v1/accounts/:account_id/developer_keys`

Create a new Canvas API key. Creating an LTI 1.3 registration is not supported here and should be done via the LTI Registration API.

#### Request Parameters:

| Parameter                                    | Type            | Description                                                                                                                                                                                                                                                                                                                                                            |
| -------------------------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `developer_key`                              | Required `json` | no description                                                                                                                                                                                                                                                                                                                                                         |
| `developer_key[auto_expire_tokens]`          | `boolean`       | <p>Defaults to false. If true, access tokens<br>generated by this key will expire after 1 hour.</p>                                                                                                                                                                                                                                                                    |
| `developer_key[email]`                       | `string`        | Contact email for the key.                                                                                                                                                                                                                                                                                                                                             |
| `developer_key[icon_url]`                    | `string`        | URL for a small icon to display in key list.                                                                                                                                                                                                                                                                                                                           |
| `developer_key[name]`                        | `string`        | The display name.                                                                                                                                                                                                                                                                                                                                                      |
| `developer_key[notes]`                       | `string`        | User-provided notes about the key.                                                                                                                                                                                                                                                                                                                                     |
| `developer_key[redirect_uri]`                | `string`        | Deprecated in favor of redirect\_uris. Do not use.                                                                                                                                                                                                                                                                                                                     |
| `developer_key[redirect_uris]`               | `array`         | <p>List of URLs used during OAuth2 flow to validate<br>given redirect URI.</p>                                                                                                                                                                                                                                                                                         |
| `developer_key[vendor_code]`                 | `string`        | User-specified code representing the vendor that uses the key.                                                                                                                                                                                                                                                                                                         |
| `developer_key[visible]`                     | `boolean`       | Defaults to true. If false, key will not be visible in the UI.                                                                                                                                                                                                                                                                                                         |
| `developer_key[test_cluster_only]`           | `boolean`       | <p>Defaults to false. If true, key is only usable in<br>non-production environments (test, beta). Avoids problems with beta refresh.</p>                                                                                                                                                                                                                               |
| `developer_key[client_credentials_audience]` | `string`        | <p>Used in OAuth2 client credentials flow to<br>specify the audience for the access token.</p>                                                                                                                                                                                                                                                                         |
| `developer_key[allowed_audiences]`           | `array`         | <p>The registered audiences this key may request tokens<br>for. Each value must appear in the environment's configured list of registered audiences.</p>                                                                                                                                                                                                               |
| `developer_key[authorized_flows]`            | `array`         | <p>Additional OAuth2 flows this key is authorized to<br>use. Allowed values: token\_exchange, service\_user\_client\_credentials.</p>                                                                                                                                                                                                                                  |
| `developer_key[client_type]`                 | `string`        | <p>Whether this is a confidential or public client.<br>Public clients (SPAs, mobile apps) require PKCE in the authorization code flow, cannot use the<br>client\_credentials flow, and receive short-lived access tokens with rotating refresh tokens.<br>Allowed values: confidential (default), public.<br>Not applicable to LTI keys. Immutable after creation.</p> |
| `developer_key[scopes]`                      | `array`         | List of API endpoints key is allowed to access.                                                                                                                                                                                                                                                                                                                        |
| `developer_key[require_scopes]`              | `boolean`       | If true, then token requests with this key must include scopes.                                                                                                                                                                                                                                                                                                        |
| `developer_key[allow_includes]`              | `boolean`       | <p>If true, allows <code>includes</code> parameters in API requests that<br>match the scopes of this key.</p>                                                                                                                                                                                                                                                          |

Returns a [DeveloperKey](#developerkey) object.

## [Update a Developer Key](#method.developer_keys.update) <a href="#method.developer_keys.update" id="method.developer_keys.update"></a>

[DeveloperKeysController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/developer_keys_controller.rb)

#### `PUT /api/v1/developer_keys/:id`

**Scope:** `url:PUT|/api/v1/developer_keys/:id`

Update an existing Canvas API key. Updating an LTI 1.3 registration is not supported here and should be done via the LTI Registration API.

#### Request Parameters:

| Parameter                                    | Type            | Description                                                                                                                                              |
| -------------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `developer_key`                              | Required `json` | no description                                                                                                                                           |
| `developer_key[auto_expire_tokens]`          | `boolean`       | <p>Defaults to false. If true, access tokens<br>generated by this key will expire after 1 hour.</p>                                                      |
| `developer_key[email]`                       | `string`        | Contact email for the key.                                                                                                                               |
| `developer_key[icon_url]`                    | `string`        | URL for a small icon to display in key list.                                                                                                             |
| `developer_key[name]`                        | `string`        | The display name.                                                                                                                                        |
| `developer_key[notes]`                       | `string`        | User-provided notes about the key.                                                                                                                       |
| `developer_key[redirect_uri]`                | `string`        | Deprecated in favor of redirect\_uris. Do not use.                                                                                                       |
| `developer_key[redirect_uris]`               | `array`         | <p>List of URLs used during OAuth2 flow to validate<br>given redirect URI.</p>                                                                           |
| `developer_key[vendor_code]`                 | `string`        | User-specified code representing the vendor that uses the key.                                                                                           |
| `developer_key[visible]`                     | `boolean`       | Defaults to true. If false, key will not be visible in the UI.                                                                                           |
| `developer_key[test_cluster_only]`           | `boolean`       | <p>Defaults to false. If true, key is only usable in<br>non-production environments (test, beta). Avoids problems with beta refresh.</p>                 |
| `developer_key[client_credentials_audience]` | `string`        | <p>Used in OAuth2 client credentials flow to<br>specify the audience for the access token.</p>                                                           |
| `developer_key[allowed_audiences]`           | `array`         | <p>The registered audiences this key may request tokens<br>for. Each value must appear in the environment's configured list of registered audiences.</p> |
| `developer_key[authorized_flows]`            | `array`         | <p>Additional OAuth2 flows this key is authorized to<br>use. Allowed values: token\_exchange, service\_user\_client\_credentials.</p>                    |
| `developer_key[scopes]`                      | `array`         | List of API endpoints key is allowed to access.                                                                                                          |
| `developer_key[require_scopes]`              | `boolean`       | If true, then token requests with this key must include scopes.                                                                                          |
| `developer_key[allow_includes]`              | `boolean`       | <p>If true, allows <code>includes</code> parameters in API requests that<br>match the scopes of this key.</p>                                            |

Returns a [DeveloperKey](#developerkey) object.

## [Delete a Developer Key](#method.developer_keys.destroy) <a href="#method.developer_keys.destroy" id="method.developer_keys.destroy"></a>

[DeveloperKeysController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/developer_keys_controller.rb)

#### `DELETE /api/v1/developer_keys/:id`

**Scope:** `url:DELETE|/api/v1/developer_keys/:id`

Delete an existing Canvas API key. Deleting an LTI 1.3 registration should be done via the LTI Registration API.

Returns a [DeveloperKey](#developerkey) object.

## [Regenerate Developer Key Secret](#method.developer_keys.regenerate_secret) <a href="#method.developer_keys.regenerate_secret" id="method.developer_keys.regenerate_secret"></a>

[DeveloperKeysController#regenerate\_secret](https://github.com/instructure/canvas-lms/blob/master/app/controllers/developer_keys_controller.rb)

#### `POST /api/v1/developer_keys/:id/regenerate_secret`

**Scope:** `url:POST|/api/v1/developer_keys/:id/regenerate_secret`

Regenerate the secret (api\_key) for an existing Canvas API key. This invalidates the existing secret. Any applications using the old secret will stop working. Regenerating a secret for an LTI key is not supported.

This endpoint requires the developer\_key\_regenerate\_secret feature flag to be enabled. This feature flag can only be turned on by Site Admins

#### Example Request:

```bash
curl https://<canvas>/api/v1/developer_keys/<key_id>/regenerate_secret \
  -X POST \
  -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "id": "10000000000123",
  "api_key": "abc123xyz789fullsecretkey",
  "name": "My API Integration",
  "created_at": "2026-01-15T12:00:00Z",
  "workflow_state": "active",
  "redirect_uri": "https://example.com/oauth/callback",
  "access_token_count": 5,
  ...
}
```

Returns a [DeveloperKey](#developerkey) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Discovery Pages

#### A DiscoveryPage object looks like: <a href="#discoverypage" id="discoverypage"></a>

```js
// Configuration for the login discovery page
{
  // Primary authentication provider buttons displayed prominently
  "primary": null,
  // Secondary authentication provider buttons displayed less prominently
  "secondary": null,
  // Whether the discovery page is enabled
  "active": null
}
```

#### A DiscoveryPageEntry object looks like: <a href="#discoverypageentry" id="discoverypageentry"></a>

```js
// A single authentication provider entry on the discovery page
{
  // The ID of the authentication provider
  "authentication_provider_id": 1,
  // The display label for this provider button
  "label": "Students",
  // Icon key for this provider button
  "icon": "google"
}
```

## [Get Discovery Page](#method.discovery_pages_api.show) <a href="#method.discovery_pages_api.show" id="method.discovery_pages_api.show"></a>

[DiscoveryPagesApiController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discovery_pages_api_controller.rb)

#### `GET /api/v1/discovery_pages`

**Scope:** `url:GET|/api/v1/discovery_pages`

Get the discovery page configuration for the domain root account.

Returns labels exactly as stored, with no HTML-escaping applied. Callers are responsible for escaping on render (the admin React UI does this via JSX auto-escaping).

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/discovery_pages' \
  -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "discovery_page": {
    "primary": [
      {
        "authentication_provider_id": 1,
        "label": "Students",
        "icon": "google"
      }
    ],
    "secondary": [
      {
        "authentication_provider_id": 3,
        "label": "Admins"
      }
    ],
    "active": true
  }
}
```

Returns a [DiscoveryPage](#discoverypage) object.

## [Update Discovery Page](#method.discovery_pages_api.upsert) <a href="#method.discovery_pages_api.upsert" id="method.discovery_pages_api.upsert"></a>

[DiscoveryPagesApiController#upsert](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discovery_pages_api_controller.rb)

#### `PUT /api/v1/discovery_pages`

**Scope:** `url:PUT|/api/v1/discovery_pages`

Update or create the discovery page configuration for the domain root account. This is a full replacement - provide the complete configuration including primary, secondary, and active fields. Any fields omitted will be removed.

#### Request Parameters:

| Parameter                                                 | Type               | Description                                                               |
| --------------------------------------------------------- | ------------------ | ------------------------------------------------------------------------- |
| `discovery_page[primary][][authentication_provider_id]`   | Required `integer` | The ID of an active authentication provider for this account.             |
| `discovery_page[primary][][label]`                        | Required `string`  | The display label for this authentication provider button.                |
| `discovery_page[primary][][icon]`                         | `string`           | Icon key for this authentication provider button.                         |
| `discovery_page[secondary][][authentication_provider_id]` | Required `integer` | The ID of an active authentication provider for this account.             |
| `discovery_page[secondary][][label]`                      | Required `string`  | The display label for this authentication provider button.                |
| `discovery_page[secondary][][icon]`                       | `string`           | Icon key for this authentication provider button.                         |
| `discovery_page[active]`                                  | `boolean`          | Whether the discovery page is enabled. Defaults to false if not provided. |

#### Example Request:

```bash
curl -X PUT 'https://<canvas>/api/v1/discovery_pages' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "discovery_page": {
      "primary": [
        {
          "authentication_provider_id": 1,
          "label": "Students",
          "icon": "google"
        },
        {
          "authentication_provider_id": 2,
          "label": "Faculty",
          "icon": "okta"
        }
      ],
      "secondary": [
        {
          "authentication_provider_id": 3,
          "label": "Admins"
        }
      ],
      "active": true
    }
  }'
```

#### Example Response:

```js
{
  "discovery_page": {
    "primary": [
      {
        "authentication_provider_id": 1,
        "label": "Students",
        "icon": "google"
      },
      {
        "authentication_provider_id": 2,
        "label": "Faculty",
        "icon": "okta"
      }
    ],
    "secondary": [
      {
        "authentication_provider_id": 3,
        "label": "Admins"
      }
    ],
    "active": true
  }
}
```

Returns a [DiscoveryPage](#discoverypage) object.

## [Generate Discovery Page Preview Token](#method.discovery_pages_api.token) <a href="#method.discovery_pages_api.token" id="method.discovery_pages_api.token"></a>

[DiscoveryPagesApiController#token](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discovery_pages_api_controller.rb)

#### `POST /api/v1/discovery_pages/token`

**Scope:** `url:POST|/api/v1/discovery_pages/token`

Returns a short-lived RS256-signed JWT containing the discovery page button link configuration, suitable for sending to the identity service preview iframe via postMessage.

A discovery\_page configuration must be provided in the request body. Omitting it returns a 400 Bad Request.

#### Request Parameters:

| Parameter                                                 | Type               | Description                                                   |
| --------------------------------------------------------- | ------------------ | ------------------------------------------------------------- |
| `discovery_page[primary][][authentication_provider_id]`   | Required `integer` | The ID of an active authentication provider for this account. |
| `discovery_page[primary][][label]`                        | `string`           | The display label for this authentication provider button.    |
| `discovery_page[primary][][icon]`                         | `string`           | Icon key for this authentication provider button.             |
| `discovery_page[secondary][][authentication_provider_id]` | `integer`          | The ID of an active authentication provider for this account. |
| `discovery_page[secondary][][label]`                      | `string`           | The display label for this authentication provider button.    |
| `discovery_page[secondary][][icon]`                       | `string`           | Icon key for this authentication provider button.             |

#### Example Request:

```bash
curl -X POST 'https://<canvas>/api/v1/discovery_pages/token' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
    "discovery_page": {
      "primary": [
        {
          "authentication_provider_id": 1,
          "label": "Students",
          "icon": "google"
        }
      ],
      "secondary": []
    }
  }'
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Discussion Topics

API for accessing and participating in discussion topics in groups and courses.

#### A FileAttachment object looks like: <a href="#fileattachment" id="fileattachment"></a>

```js
// A file attachment
{
  "content-type": "unknown/unknown",
  "url": "http://www.example.com/courses/1/files/1/download",
  "filename": "content.txt",
  "display_name": "content.txt"
}
```

#### A DiscussionTopic object looks like: <a href="#discussiontopic" id="discussiontopic"></a>

```js
// A discussion topic
{
  // The ID of this topic.
  "id": 1,
  // The topic title.
  "title": "Topic 1",
  // The HTML content of the message body.
  "message": "<p>content here</p>",
  // The URL to the discussion topic in canvas.
  "html_url": "https://<canvas>/courses/1/discussion_topics/2",
  // The datetime the topic was posted. If it is null it hasn't been posted yet.
  // (see delayed_post_at)
  "posted_at": "2037-07-21T13:29:31Z",
  // The datetime for when the last reply was in the topic.
  "last_reply_at": "2037-07-28T19:38:31Z",
  // If true then a user may not respond to other replies until that user has made
  // an initial reply. Defaults to false.
  "require_initial_post": false,
  // Whether or not posts in this topic are visible to the user.
  "user_can_see_posts": true,
  // The count of entries in the topic.
  "discussion_subentry_count": 0,
  // The read_state of the topic for the current user, 'read' or 'unread'.
  "read_state": "read",
  // The count of unread entries of this topic for the current user.
  "unread_count": 0,
  // Whether or not the current user is subscribed to this topic.
  "subscribed": true,
  // (Optional) Why the user cannot subscribe to this topic. Only one reason will
  // be returned even if multiple apply. Can be one of: 'initial_post_required':
  // The user must post a reply first; 'not_in_group_set': The user is not in the
  // group set for this graded group discussion; 'not_in_group': The user is not
  // in this topic's group; 'topic_is_announcement': This topic is an announcement
  "subscription_hold": "not_in_group_set",
  // The unique identifier of the assignment if the topic is for grading,
  // otherwise null.
  "assignment_id": null,
  // The datetime to publish the topic (if not right away).
  "delayed_post_at": null,
  // Whether this discussion topic is published (true) or draft state (false)
  "published": true,
  // The datetime to lock the topic (if ever).
  "lock_at": null,
  // Whether or not the discussion is 'closed for comments'.
  "locked": false,
  // Whether or not the discussion has been 'pinned' by an instructor
  "pinned": false,
  // Whether or not this is locked for the user.
  "locked_for_user": true,
  // (Optional) Information for the user about the lock. Present when
  // locked_for_user is true.
  "lock_info": null,
  // (Optional) An explanation of why this is locked for the user. Present when
  // locked_for_user is true.
  "lock_explanation": "This discussion is locked until September 1 at 12:00am",
  // The username of the topic creator.
  "user_name": "User Name",
  // DEPRECATED An array of topic_ids for the group discussions the user is a part
  // of.
  "topic_children": [5, 7, 10],
  // An array of group discussions the user is a part of. Fields include: id,
  // group_id
  "group_topic_children": [{"id":5,"group_id":1}, {"id":7,"group_id":5}, {"id":10,"group_id":4}],
  // If the topic is for grading and a group assignment this will point to the
  // original topic in the course.
  "root_topic_id": null,
  // If the topic is a podcast topic this is the feed url for the current user.
  "podcast_url": "/feeds/topics/1/enrollment_1XAcepje4u228rt4mi7Z1oFbRpn3RAkTzuXIGOPe.rss",
  // The type of discussion. Values are 'side_comment' or 'not_threaded', for
  // discussions that only allow one level of nested comments, and 'threaded' for
  // fully threaded discussions.
  "discussion_type": "side_comment",
  // The unique identifier of the group category if the topic is a group
  // discussion, otherwise null.
  "group_category_id": null,
  // Array of file attachments.
  "attachments": null,
  // The current user's permissions on this topic.
  "permissions": {"attach":true},
  // Whether or not users can rate entries in this topic.
  "allow_rating": true,
  // Whether or not grade permissions are required to rate entries.
  "only_graders_can_rate": true,
  // DEPRECATED, Whether or not entries should be sorted by rating.
  "sort_by_rating": true,
  // How entries should be sorted by default.
  "sort_order": "asc",
  // Can users decide their preferred sort order.
  "sort_order_locked": true,
  // Threaded replies should be expanded by default.
  "expand": true,
  // Can users decide their preferred thread expand setting.
  "expand_locked": true
}
```

## [List discussion topics](#method.discussion_topics.index) <a href="#method.discussion_topics.index" id="method.discussion_topics.index"></a>

[DiscussionTopicsController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_controller.rb)

#### `GET /api/v1/courses/:course_id/discussion_topics`

**Scope:** `url:GET|/api/v1/courses/:course_id/discussion_topics`

#### `GET /api/v1/groups/:group_id/discussion_topics`

**Scope:** `url:GET|/api/v1/groups/:group_id/discussion_topics`

Returns the paginated list of discussion topics for this course or group.

#### Request Parameters:

| Parameter                              | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------------------------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]`                            | `string`  | <p>If "all\_dates" is passed, all dates associated with graded discussions'<br>assignments will be included.<br>if "sections" is passed, includes the course sections that are associated<br>with the topic, if the topic is specific to certain sections of the course.<br>If "sections\_user\_count" is passed, then:<br>(a) If sections were asked for <em>and</em> the topic is specific to certain<br>course sections, includes the number of users in each<br>section. (as part of the section json asked for above)<br>(b) Else, includes at the root level the total number of users in the<br>topic's context (group or course) that the topic applies to.<br>If "overrides" is passed, the overrides for the assignment will be included Allowed values: <code>all\_dates</code>, <code>sections</code>, <code>sections\_user\_count</code>, <code>overrides</code></p> |
| `order_by`                             | `string`  | Determines the order of the discussion topic list. Defaults to "position". Allowed values: `position`, `recent_activity`, `title`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `scope`                                | `string`  | <p>Only return discussion topics in the given state(s). Defaults to including<br>all topics. Filtering is done after pagination, so pages<br>may be smaller than requested if topics are filtered.<br>Can pass multiple states as comma separated string. Allowed values: <code>locked</code>, <code>unlocked</code>, <code>pinned</code>, <code>unpinned</code></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `only_announcements`                   | `boolean` | Return announcements instead of discussion topics. Defaults to false                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `filter_by`                            | `string`  | The state of the discussion topic to return. Currently only supports unread state. Allowed values: `all`, `unread`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `search_term`                          | `string`  | The partial title of the discussion topics to match and return.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `exclude_context_module_locked_topics` | `boolean` | <p>For students, exclude topics that are locked by module progression.<br>Defaults to false.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/discussion_topics \
     -H 'Authorization: Bearer <token>'
```

Returns a list of [DiscussionTopic](#discussiontopic) objects.

## [Create a new discussion topic](#method.discussion_topics.create) <a href="#method.discussion_topics.create" id="method.discussion_topics.create"></a>

[DiscussionTopicsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_controller.rb)

#### `POST /api/v1/courses/:course_id/discussion_topics`

**Scope:** `url:POST|/api/v1/courses/:course_id/discussion_topics`

#### `POST /api/v1/groups/:group_id/discussion_topics`

**Scope:** `url:POST|/api/v1/groups/:group_id/discussion_topics`

Create an new discussion topic for the course or group.

#### Request Parameters:

| Parameter                   | Type         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| --------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `title`                     | `string`     | no description                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `message`                   | `string`     | no description                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `discussion_type`           | `string`     | The type of discussion. Defaults to side\_comment or not\_threaded if not value is given. Accepted values are 'side\_comment', 'not\_threaded' for discussions that only allow one level of nested comments, and 'threaded' for fully threaded discussions. Allowed values: `side_comment`, `threaded`, `not_threaded`                                                                                                                                                 |
| `published`                 | `boolean`    | <p>Whether this topic is published (true) or draft state (false). Only<br>teachers and TAs have the ability to create draft state topics.</p>                                                                                                                                                                                                                                                                                                                          |
| `delayed_post_at`           | `DateTime`   | If a timestamp is given, the topic will not be published until that time.                                                                                                                                                                                                                                                                                                                                                                                              |
| `allow_rating`              | `boolean`    | Whether or not users can rate entries in this topic.                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `lock_at`                   | `DateTime`   | <p>If a timestamp is given, the topic will be scheduled to lock at the<br>provided timestamp. If the timestamp is in the past, the topic will be<br>locked.</p>                                                                                                                                                                                                                                                                                                        |
| `podcast_enabled`           | `boolean`    | If true, the topic will have an associated podcast feed.                                                                                                                                                                                                                                                                                                                                                                                                               |
| `podcast_has_student_posts` | `boolean`    | <p>If true, the podcast will include posts from students as well. Implies<br>podcast\_enabled.</p>                                                                                                                                                                                                                                                                                                                                                                     |
| `require_initial_post`      | `boolean`    | <p>If true then a user may not respond to other replies until that user has<br>made an initial reply. Defaults to false.</p>                                                                                                                                                                                                                                                                                                                                           |
| `assignment`                | `Assignment` | <p>To create an assignment discussion, pass the assignment parameters as a<br>sub-object. See the <a href="/pages/fmw03fjQMjjL5AFja2sQ#method.assignments_api.create">Create an Assignment API</a><br>for the available parameters. The name parameter will be ignored, as it's<br>taken from the discussion title. If you want to make a discussion that was<br>an assignment NOT an assignment, pass set\_assignment = false as part of<br>the assignment object</p> |
| `is_announcement`           | `boolean`    | <p>If true, this topic is an announcement. It will appear in the<br>announcement's section rather than the discussions section. This requires<br>announcment-posting permissions.</p>                                                                                                                                                                                                                                                                                  |
| `pinned`                    | `boolean`    | If true, this topic will be listed in the "Pinned Discussion" section                                                                                                                                                                                                                                                                                                                                                                                                  |
| `position_after`            | `string`     | <p>By default, discussions are sorted chronologically by creation date, you<br>can pass the id of another topic to have this one show up after the other<br>when they are listed.</p>                                                                                                                                                                                                                                                                                  |
| `group_category_id`         | `integer`    | <p>If present, the topic will become a group discussion assigned<br>to the group.</p>                                                                                                                                                                                                                                                                                                                                                                                  |
| `only_graders_can_rate`     | `boolean`    | If true, only graders will be allowed to rate entries.                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `sort_order`                | `string`     | Default sort order of the discussion. Accepted values are "asc", "desc". Allowed values: `asc`, `desc`                                                                                                                                                                                                                                                                                                                                                                 |
| `sort_order_locked`         | `boolean`    | If true, users cannot choose their prefered sort order                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `expanded`                  | `boolean`    | If true, thread will be expanded by default                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `expanded_locked`           | `boolean`    | If true, users cannot choose their prefered thread expansion setting                                                                                                                                                                                                                                                                                                                                                                                                   |
| `sort_by_rating`            | `boolean`    | (DEPRECATED) If true, entries will be sorted by rating.                                                                                                                                                                                                                                                                                                                                                                                                                |
| `attachment`                | `File`       | <p>A multipart/form-data form-field-style attachment.<br>Attachments larger than 1 kilobyte are subject to quota restrictions.</p>                                                                                                                                                                                                                                                                                                                                     |
| `specific_sections`         | `string`     | <p>A comma-separated list of sections ids to which the discussion topic<br>should be made specific to. If it is not desired to make the discussion<br>topic specific to sections, then this parameter may be omitted or set to<br>"all". Can only be present only on announcements and only those that are<br>for a course (as opposed to a group).</p>                                                                                                                |
| `lock_comment`              | `boolean`    | If is\_announcement and lock\_comment are true, ‘Allow Participants to Comment’ setting is disabled.                                                                                                                                                                                                                                                                                                                                                                   |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/discussion_topics \
    -F title='my topic' \
    -F message='initial message' \
    -F podcast_enabled=1 \
    -H 'Authorization: Bearer <token>'
    -F 'attachment=@<filename>' \
```

```bash
curl https://<canvas>/api/v1/courses/<course_id>/discussion_topics \
    -F title='my assignment topic' \
    -F message='initial message' \
    -F assignment[points_possible]=15 \
    -H 'Authorization: Bearer <token>'
```

## [Update a topic](#method.discussion_topics.update) <a href="#method.discussion_topics.update" id="method.discussion_topics.update"></a>

[DiscussionTopicsController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_controller.rb)

#### `PUT /api/v1/courses/:course_id/discussion_topics/:topic_id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/discussion_topics/:topic_id`

#### `PUT /api/v1/groups/:group_id/discussion_topics/:topic_id`

**Scope:** `url:PUT|/api/v1/groups/:group_id/discussion_topics/:topic_id`

Update an existing discussion topic for the course or group.

#### Request Parameters:

| Parameter                   | Type         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| --------------------------- | ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `title`                     | `string`     | no description                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `message`                   | `string`     | no description                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `discussion_type`           | `string`     | The type of discussion. Defaults to side\_comment or not\_threaded if not value is given. Accepted values are 'side\_comment', 'not\_threaded' for discussions that only allow one level of nested comments, and 'threaded' for fully threaded discussions. Allowed values: `side_comment`, `threaded`, `not_threaded`                                                                                                                                                 |
| `published`                 | `boolean`    | <p>Whether this topic is published (true) or draft state (false). Only<br>teachers and TAs have the ability to create draft state topics.</p>                                                                                                                                                                                                                                                                                                                          |
| `delayed_post_at`           | `DateTime`   | If a timestamp is given, the topic will not be published until that time.                                                                                                                                                                                                                                                                                                                                                                                              |
| `lock_at`                   | `DateTime`   | <p>If a timestamp is given, the topic will be scheduled to lock at the<br>provided timestamp. If the timestamp is in the past, the topic will be<br>locked.</p>                                                                                                                                                                                                                                                                                                        |
| `podcast_enabled`           | `boolean`    | If true, the topic will have an associated podcast feed.                                                                                                                                                                                                                                                                                                                                                                                                               |
| `podcast_has_student_posts` | `boolean`    | <p>If true, the podcast will include posts from students as well. Implies<br>podcast\_enabled.</p>                                                                                                                                                                                                                                                                                                                                                                     |
| `require_initial_post`      | `boolean`    | <p>If true then a user may not respond to other replies until that user has<br>made an initial reply. Defaults to false.</p>                                                                                                                                                                                                                                                                                                                                           |
| `assignment`                | `Assignment` | <p>To create an assignment discussion, pass the assignment parameters as a<br>sub-object. See the <a href="/pages/fmw03fjQMjjL5AFja2sQ#method.assignments_api.create">Create an Assignment API</a><br>for the available parameters. The name parameter will be ignored, as it's<br>taken from the discussion title. If you want to make a discussion that was<br>an assignment NOT an assignment, pass set\_assignment = false as part of<br>the assignment object</p> |
| `is_announcement`           | `boolean`    | <p>If true, this topic is an announcement. It will appear in the<br>announcement's section rather than the discussions section. This requires<br>announcment-posting permissions.</p>                                                                                                                                                                                                                                                                                  |
| `pinned`                    | `boolean`    | If true, this topic will be listed in the "Pinned Discussion" section                                                                                                                                                                                                                                                                                                                                                                                                  |
| `position_after`            | `string`     | <p>By default, discussions are sorted chronologically by creation date, you<br>can pass the id of another topic to have this one show up after the other<br>when they are listed.</p>                                                                                                                                                                                                                                                                                  |
| `group_category_id`         | `integer`    | <p>If present, the topic will become a group discussion assigned<br>to the group.</p>                                                                                                                                                                                                                                                                                                                                                                                  |
| `allow_rating`              | `boolean`    | If true, users will be allowed to rate entries.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `only_graders_can_rate`     | `boolean`    | If true, only graders will be allowed to rate entries.                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `sort_order`                | `string`     | Default sort order of the discussion. Accepted values are "asc", "desc". Allowed values: `asc`, `desc`                                                                                                                                                                                                                                                                                                                                                                 |
| `sort_order_locked`         | `boolean`    | If true, users cannot choose their prefered sort order                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `expanded`                  | `boolean`    | If true, thread will be expanded by default                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `expanded_locked`           | `boolean`    | If true, users cannot choose their prefered thread expansion setting                                                                                                                                                                                                                                                                                                                                                                                                   |
| `sort_by_rating`            | `boolean`    | (DEPRECATED) If true, entries will be sorted by rating.                                                                                                                                                                                                                                                                                                                                                                                                                |
| `specific_sections`         | `string`     | <p>A comma-separated list of sections ids to which the discussion topic<br>should be made specific too. If it is not desired to make the discussion<br>topic specific to sections, then this parameter may be omitted or set to<br>"all". Can only be present only on announcements and only those that are<br>for a course (as opposed to a group).</p>                                                                                                               |
| `lock_comment`              | `boolean`    | If is\_announcement and lock\_comment are true, ‘Allow Participants to Comment’ setting is disabled.                                                                                                                                                                                                                                                                                                                                                                   |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id> \
    -F title='This will be positioned after Topic #1234' \
    -F position_after=1234 \
    -H 'Authorization: Bearer <token>'
```

## [Delete a topic](#method.discussion_topics.destroy) <a href="#method.discussion_topics.destroy" id="method.discussion_topics.destroy"></a>

[DiscussionTopicsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_controller.rb)

#### `DELETE /api/v1/courses/:course_id/discussion_topics/:topic_id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/discussion_topics/:topic_id`

#### `DELETE /api/v1/groups/:group_id/discussion_topics/:topic_id`

**Scope:** `url:DELETE|/api/v1/groups/:group_id/discussion_topics/:topic_id`

Deletes the discussion topic. This will also delete the assignment, if it's an assignment discussion.

#### Example Request:

```bash
curl -X DELETE https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id> \
     -H 'Authorization: Bearer <token>'
```

## [Reorder pinned topics](#method.discussion_topics.reorder) <a href="#method.discussion_topics.reorder" id="method.discussion_topics.reorder"></a>

[DiscussionTopicsController#reorder](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_controller.rb)

#### `POST /api/v1/courses/:course_id/discussion_topics/reorder`

**Scope:** `url:POST|/api/v1/courses/:course_id/discussion_topics/reorder`

#### `POST /api/v1/groups/:group_id/discussion_topics/reorder`

**Scope:** `url:POST|/api/v1/groups/:group_id/discussion_topics/reorder`

Puts the pinned discussion topics in the specified order. All pinned topics should be included.

#### Request Parameters:

| Parameter | Type               | Description                                                                                                 |
| --------- | ------------------ | ----------------------------------------------------------------------------------------------------------- |
| `order[]` | Required `integer` | <p>The ids of the pinned discussion topics in the desired order.<br>(For example, "order=104,102,103".)</p> |

## [Update an entry](#method.discussion_entries.update) <a href="#method.discussion_entries.update" id="method.discussion_entries.update"></a>

[DiscussionEntriesController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_entries_controller.rb)

#### `PUT /api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:id`

**Scope:** `url:PUT|/api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:id`

#### `PUT /api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:id`

**Scope:** `url:PUT|/api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:id`

Update an existing discussion entry.

The entry must have been created by the current user, or the current user must have admin rights to the discussion. If the edit is not allowed, a 401 will be returned.

#### Request Parameters:

| Parameter | Type     | Description                    |
| --------- | -------- | ------------------------------ |
| `message` | `string` | The updated body of the entry. |

#### Example Request:

```bash
curl -X PUT 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/entries/<entry_id>' \
     -F 'message=<message>' \
     -H "Authorization: Bearer <token>"
```

## [Delete an entry](#method.discussion_entries.destroy) <a href="#method.discussion_entries.destroy" id="method.discussion_entries.destroy"></a>

[DiscussionEntriesController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_entries_controller.rb)

#### `DELETE /api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:id`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:id`

#### `DELETE /api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:id`

**Scope:** `url:DELETE|/api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:id`

Delete a discussion entry.

The entry must have been created by the current user, or the current user must have admin rights to the discussion. If the delete is not allowed, a 401 will be returned.

The discussion will be marked deleted, and the user\_id and message will be cleared out.

#### Example Request:

```bash
curl -X DELETE 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/entries/<entry_id>' \
     -H "Authorization: Bearer <token>"
```

## [Get a single topic](#method.discussion_topics_api.show) <a href="#method.discussion_topics_api.show" id="method.discussion_topics_api.show"></a>

[DiscussionTopicsApiController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `GET /api/v1/courses/:course_id/discussion_topics/:topic_id`

**Scope:** `url:GET|/api/v1/courses/:course_id/discussion_topics/:topic_id`

#### `GET /api/v1/groups/:group_id/discussion_topics/:topic_id`

**Scope:** `url:GET|/api/v1/groups/:group_id/discussion_topics/:topic_id`

Returns data on an individual discussion topic. See the List action for the response formatting.

#### Request Parameters:

| Parameter   | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]` | `string` | <p>If "all\_dates" is passed, all dates associated with graded discussions'<br>assignments will be included.<br>if "sections" is passed, includes the course sections that are associated<br>with the topic, if the topic is specific to certain sections of the course.<br>If "sections\_user\_count" is passed, then:<br>(a) If sections were asked for <em>and</em> the topic is specific to certain<br>course sections, includes the number of users in each<br>section. (as part of the section json asked for above)<br>(b) Else, includes at the root level the total number of users in the<br>topic's context (group or course) that the topic applies to.<br>If "overrides" is passed, the overrides for the assignment will be included Allowed values: <code>all\_dates</code>, <code>sections</code>, <code>sections\_user\_count</code>, <code>overrides</code></p> |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id> \
    -H 'Authorization: Bearer <token>'
```

## [Find Last Summary](#method.discussion_topics_api.find_summary) <a href="#method.discussion_topics_api.find_summary" id="method.discussion_topics_api.find_summary"></a>

[DiscussionTopicsApiController#find\_summary](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `GET /api/v1/courses/:course_id/discussion_topics/:topic_id/summaries`

**Scope:** `url:GET|/api/v1/courses/:course_id/discussion_topics/:topic_id/summaries`

#### `GET /api/v1/groups/:group_id/discussion_topics/:topic_id/summaries`

**Scope:** `url:GET|/api/v1/groups/:group_id/discussion_topics/:topic_id/summaries`

Returns: (1) last userInput (what current user had keyed in to produce the last discussion summary), (2) last discussion summary generated by the current user for current discussion topic, based on userInput, (3) and some usage information.

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/summaries \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "id": 1,
  "userInput": "Give me a brief summary of the discussion.",
  "text": "This is a summary of the discussion topic.",
  "usage": { "currentCount": 1, "limit": 5 }
}
```

## [Find or Create Summary](#method.discussion_topics_api.find_or_create_summary) <a href="#method.discussion_topics_api.find_or_create_summary" id="method.discussion_topics_api.find_or_create_summary"></a>

[DiscussionTopicsApiController#find\_or\_create\_summary](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `POST /api/v1/courses/:course_id/discussion_topics/:topic_id/summaries`

**Scope:** `url:POST|/api/v1/courses/:course_id/discussion_topics/:topic_id/summaries`

#### `POST /api/v1/groups/:group_id/discussion_topics/:topic_id/summaries`

**Scope:** `url:POST|/api/v1/groups/:group_id/discussion_topics/:topic_id/summaries`

Generates a summary for a discussion topic. Returns the summary text and usage information.

#### Request Parameters:

| Parameter   | Type     | Description                                  |
| ----------- | -------- | -------------------------------------------- |
| `userInput` | `string` | Areas or topics for the summary to focus on. |

#### Example Request:

```bash
curl https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/summaries \
    -X POST \
    -H 'Authorization: Bearer <token>'
```

#### Example Response:

```js
{
  "id": 1,
  "text": "This is a summary of the discussion topic.",
  "usage": { "currentCount": 1, "limit": 5 }
}
```

## [Disable summary](#method.discussion_topics_api.disable_summary) <a href="#method.discussion_topics_api.disable_summary" id="method.discussion_topics_api.disable_summary"></a>

[DiscussionTopicsApiController#disable\_summary](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/discussion_topics/:topic_id/summaries/disable`

**Scope:** `url:PUT|/api/v1/courses/:course_id/discussion_topics/:topic_id/summaries/disable`

#### `PUT /api/v1/groups/:group_id/discussion_topics/:topic_id/summaries/disable`

**Scope:** `url:PUT|/api/v1/groups/:group_id/discussion_topics/:topic_id/summaries/disable`

Deprecated, to remove after VICE-5047 gets merged Disables the summary for a discussion topic.

#### Example Request:

```bash
curl -X PUT https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/disable_summary \
```

#### Example Response:

```js
{
  "success": true
}
```

## [Summary Feedback](#method.discussion_topics_api.summary_feedback) <a href="#method.discussion_topics_api.summary_feedback" id="method.discussion_topics_api.summary_feedback"></a>

[DiscussionTopicsApiController#summary\_feedback](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `POST /api/v1/courses/:course_id/discussion_topics/:topic_id/summaries/:summary_id/feedback`

**Scope:** `url:POST|/api/v1/courses/:course_id/discussion_topics/:topic_id/summaries/:summary_id/feedback`

#### `POST /api/v1/groups/:group_id/discussion_topics/:topic_id/summaries/:summary_id/feedback`

**Scope:** `url:POST|/api/v1/groups/:group_id/discussion_topics/:topic_id/summaries/:summary_id/feedback`

Persists feedback on a discussion topic summary.

#### Request Parameters:

| Parameter | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| --------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `_action` | `string` | <p>Required<br>The action to take on the summary. Possible values are:<br>- "seen": Marks the summary as seen. This action saves the feedback if it's not already persisted.<br>- "like": Marks the summary as liked.<br>- "dislike": Marks the summary as disliked.<br>- "add\_comment": Adds a written comment to a disliked summary. Requires the "comment" parameter.<br>- "reset\_like": Resets the like status of the summary.<br>- "regenerate": Regenerates the summary feedback.<br>- "disable\_summary": Disables the summary feedback.<br>Any other value will result in an error response.</p> |
| `comment` | `string` | <p>Optional<br>A written explanation for the dislike. Only used with the "add\_comment" action. Maximum 1024 characters.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

#### Example Request:

```bash
curl -X POST https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/summaries/<summary_id>/feedback \
     -F '_action=like' \
     -H "Authorization: Bearer
```

#### Example Response:

```js
{
  "liked": true,
  "disliked": false
}
```

## [Get the full topic](#method.discussion_topics_api.view) <a href="#method.discussion_topics_api.view" id="method.discussion_topics_api.view"></a>

[DiscussionTopicsApiController#view](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `GET /api/v1/courses/:course_id/discussion_topics/:topic_id/view`

**Scope:** `url:GET|/api/v1/courses/:course_id/discussion_topics/:topic_id/view`

#### `GET /api/v1/groups/:group_id/discussion_topics/:topic_id/view`

**Scope:** `url:GET|/api/v1/groups/:group_id/discussion_topics/:topic_id/view`

Return a cached structure of the discussion topic, containing all entries, their authors, and their message bodies.

May require (depending on the topic) that the user has posted in the topic. If it is required, and the user has not posted, will respond with a 403 Forbidden status and the body 'require\_initial\_post'.

In some rare situations, this cached structure may not be available yet. In that case, the server will respond with a 503 error, and the caller should try again soon.

The response is an object containing the following keys:

* "participants": A list of summary information on users who have posted to the discussion. Each value is an object containing their id, display\_name, and avatar\_url.
* "unread\_entries": A list of entry ids that are unread by the current user. this implies that any entry not in this list is read.
* "entry\_ratings": A map of entry ids to ratings by the current user. Entries not in this list have no rating. Only populated if rating is enabled.
* "forced\_entries": A list of entry ids that have forced\_read\_state set to true. This flag is meant to indicate the entry's read\_state has been manually set to 'unread' by the user, so the entry should not be automatically marked as read.
* "view": A threaded view of all the entries in the discussion, containing the id, user\_id, and message.
* "new\_entries": Because this view is eventually consistent, it's possible that newly created or updated entries won't yet be reflected in the view. If the application wants to also get a flat list of all entries not yet reflected in the view, pass include\_new\_entries=1 to the request and this array of entries will be returned. These entries are returned in a flat array, in ascending created\_at order.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/view' \
     -H "Authorization: Bearer <token>"
```

#### Example Response:

```js
{
  "unread_entries": [1,3,4],
  "entry_ratings": {3: 1},
  "forced_entries": [1],
  "participants": [
    { "id": 10, "display_name": "user 1", "avatar_image_url": "https://...", "html_url": "https://..." },
    { "id": 11, "display_name": "user 2", "avatar_image_url": "https://...", "html_url": "https://..." }
  ],
  "view": [
    { "id": 1, "user_id": 10, "parent_id": null, "message": "...html text...", "replies": [
      { "id": 3, "user_id": 11, "parent_id": 1, "message": "...html....", "replies": [...] }
    ]},
    { "id": 2, "user_id": 11, "parent_id": null, "message": "...html..." },
    { "id": 4, "user_id": 10, "parent_id": null, "message": "...html..." }
  ]
}
```

## [Post an entry](#method.discussion_topics_api.add_entry) <a href="#method.discussion_topics_api.add_entry" id="method.discussion_topics_api.add_entry"></a>

[DiscussionTopicsApiController#add\_entry](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `POST /api/v1/courses/:course_id/discussion_topics/:topic_id/entries`

**Scope:** `url:POST|/api/v1/courses/:course_id/discussion_topics/:topic_id/entries`

#### `POST /api/v1/groups/:group_id/discussion_topics/:topic_id/entries`

**Scope:** `url:POST|/api/v1/groups/:group_id/discussion_topics/:topic_id/entries`

Create a new entry in a discussion topic. Returns a json representation of the created entry (see documentation for 'entries' method) on success.

#### Request Parameters:

| Parameter    | Type     | Description                                                                                                                           |
| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `message`    | `string` | The body of the entry.                                                                                                                |
| `attachment` | `string` | <p>a multipart/form-data form-field-style<br>attachment. Attachments larger than 1 kilobyte are subject to quota<br>restrictions.</p> |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/entries.json' \
     -F 'message=<message>' \
     -F 'attachment=@<filename>' \
     -H "Authorization: Bearer <token>"
```

## [Duplicate discussion topic](#method.discussion_topics_api.duplicate) <a href="#method.discussion_topics_api.duplicate" id="method.discussion_topics_api.duplicate"></a>

[DiscussionTopicsApiController#duplicate](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `POST /api/v1/courses/:course_id/discussion_topics/:topic_id/duplicate`

**Scope:** `url:POST|/api/v1/courses/:course_id/discussion_topics/:topic_id/duplicate`

#### `POST /api/v1/groups/:group_id/discussion_topics/:topic_id/duplicate`

**Scope:** `url:POST|/api/v1/groups/:group_id/discussion_topics/:topic_id/duplicate`

Duplicate a discussion topic according to context (Course/Group)

#### Example Request:

```bash
curl -X POST -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/courses/123/discussion_topics/123/duplicate

curl -X POST -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/group/456/discussion_topics/456/duplicate
```

Returns a [DiscussionTopic](#discussiontopic) object.

## [List topic entries](#method.discussion_topics_api.entries) <a href="#method.discussion_topics_api.entries" id="method.discussion_topics_api.entries"></a>

[DiscussionTopicsApiController#entries](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `GET /api/v1/courses/:course_id/discussion_topics/:topic_id/entries`

**Scope:** `url:GET|/api/v1/courses/:course_id/discussion_topics/:topic_id/entries`

#### `GET /api/v1/groups/:group_id/discussion_topics/:topic_id/entries`

**Scope:** `url:GET|/api/v1/groups/:group_id/discussion_topics/:topic_id/entries`

Retrieve the (paginated) top-level entries in a discussion topic.

May require (depending on the topic) that the user has posted in the topic. If it is required, and the user has not posted, will respond with a 403 Forbidden status and the body 'require\_initial\_post'.

Will include the 10 most recent replies, if any, for each entry returned.

If the topic is a root topic with children corresponding to groups of a group assignment, entries from those subtopics for which the user belongs to the corresponding group will be returned.

Ordering of returned entries is newest-first by posting timestamp (reply activity is ignored).

#### API response field:

* id

The unique identifier for the entry.

* user\_id

The unique identifier for the author of the entry.

* editor\_id

The unique user id of the person to last edit the entry, if different than user\_id.

* user\_name

The name of the author of the entry.

* message

The content of the entry.

* read\_state

The read state of the entry, "read" or "unread".

* forced\_read\_state

Whether the read\_state was forced (was set manually)

* created\_at

The creation time of the entry, in ISO8601 format.

* updated\_at

The updated time of the entry, in ISO8601 format.

* attachment

JSON representation of the attachment for the entry, if any. Present only if there is an attachment.

* attachments

*Deprecated*. Same as attachment, but returned as a one-element array. Present only if there is an attachment.

* recent\_replies

The 10 most recent replies for the entry, newest first. Present only if there is at least one reply.

* has\_more\_replies

True if there are more than 10 replies for the entry (i.e., not all were included in this response). Present only if there is at least one reply.

#### Example Response:

```js
[ {
    "id": 1019,
    "user_id": 7086,
    "user_name": "nobody@example.com",
    "message": "Newer entry",
    "read_state": "read",
    "forced_read_state": false,
    "created_at": "2011-11-03T21:33:29Z",
    "attachment": {
      "content-type": "unknown/unknown",
      "url": "http://www.example.com/files/681/download",
      "filename": "content.txt",
      "display_name": "content.txt" } },
  {
    "id": 1016,
    "user_id": 7086,
    "user_name": "nobody@example.com",
    "message": "first top-level entry",
    "read_state": "unread",
    "forced_read_state": false,
    "created_at": "2011-11-03T21:32:29Z",
    "recent_replies": [
      {
        "id": 1017,
        "user_id": 7086,
        "user_name": "nobody@example.com",
        "message": "Reply message",
        "created_at": "2011-11-03T21:32:29Z"
      } ],
    "has_more_replies": false } ]
```

## [Post a reply](#method.discussion_topics_api.add_reply) <a href="#method.discussion_topics_api.add_reply" id="method.discussion_topics_api.add_reply"></a>

[DiscussionTopicsApiController#add\_reply](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `POST /api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/replies`

**Scope:** `url:POST|/api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/replies`

#### `POST /api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:entry_id/replies`

**Scope:** `url:POST|/api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:entry_id/replies`

Add a reply to an entry in a discussion topic. Returns a json representation of the created reply (see documentation for 'replies' method) on success.

May require (depending on the topic) that the user has posted in the topic. If it is required, and the user has not posted, will respond with a 403 Forbidden status and the body 'require\_initial\_post'.

#### Request Parameters:

| Parameter    | Type     | Description                                                                                                                           |
| ------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `message`    | `string` | The body of the entry.                                                                                                                |
| `attachment` | `string` | <p>a multipart/form-data form-field-style<br>attachment. Attachments larger than 1 kilobyte are subject to quota<br>restrictions.</p> |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/entries/<entry_id>/replies.json' \
     -F 'message=<message>' \
     -F 'attachment=@<filename>' \
     -H "Authorization: Bearer <token>"
```

## [List entry replies](#method.discussion_topics_api.replies) <a href="#method.discussion_topics_api.replies" id="method.discussion_topics_api.replies"></a>

[DiscussionTopicsApiController#replies](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `GET /api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/replies`

**Scope:** `url:GET|/api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/replies`

#### `GET /api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:entry_id/replies`

**Scope:** `url:GET|/api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:entry_id/replies`

Retrieve the (paginated) replies to a top-level entry in a discussion topic.

May require (depending on the topic) that the user has posted in the topic. If it is required, and the user has not posted, will respond with a 403 Forbidden status and the body 'require\_initial\_post'.

Ordering of returned entries is newest-first by creation timestamp.

#### API response field:

* id

The unique identifier for the reply.

* user\_id

The unique identifier for the author of the reply.

* editor\_id

The unique user id of the person to last edit the entry, if different than user\_id.

* user\_name

The name of the author of the reply.

* message

The content of the reply.

* read\_state

The read state of the entry, "read" or "unread".

* forced\_read\_state

Whether the read\_state was forced (was set manually)

* created\_at

The creation time of the reply, in ISO8601 format.

#### Example Response:

```js
[ {
    "id": 1015,
    "user_id": 7084,
    "user_name": "nobody@example.com",
    "message": "Newer message",
    "read_state": "read",
    "forced_read_state": false,
    "created_at": "2011-11-03T21:27:44Z" },
  {
    "id": 1014,
    "user_id": 7084,
    "user_name": "nobody@example.com",
    "message": "Older message",
    "read_state": "unread",
    "forced_read_state": false,
    "created_at": "2011-11-03T21:26:44Z" } ]
```

## [List entries](#method.discussion_topics_api.entry_list) <a href="#method.discussion_topics_api.entry_list" id="method.discussion_topics_api.entry_list"></a>

[DiscussionTopicsApiController#entry\_list](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `GET /api/v1/courses/:course_id/discussion_topics/:topic_id/entry_list`

**Scope:** `url:GET|/api/v1/courses/:course_id/discussion_topics/:topic_id/entry_list`

#### `GET /api/v1/groups/:group_id/discussion_topics/:topic_id/entry_list`

**Scope:** `url:GET|/api/v1/groups/:group_id/discussion_topics/:topic_id/entry_list`

Retrieve a paginated list of discussion entries, given a list of ids.

May require (depending on the topic) that the user has posted in the topic. If it is required, and the user has not posted, will respond with a 403 Forbidden status and the body 'require\_initial\_post'.

#### Request Parameters:

| Parameter | Type     | Description                                                                                         |
| --------- | -------- | --------------------------------------------------------------------------------------------------- |
| `ids[]`   | `string` | <p>A list of entry ids to retrieve. Entries will be returned in id order,<br>smallest id first.</p> |

#### API response field:

* id

The unique identifier for the reply.

* user\_id

The unique identifier for the author of the reply.

* user\_name

The author's display name, or null for anonymous topics when the author is not an instructor.

* message

The content of the reply.

* read\_state

The read state of the entry, "read" or "unread".

* forced\_read\_state

Whether the read\_state was forced (was set manually)

* created\_at

The creation time of the reply, in ISO8601 format.

* deleted

If the entry has been deleted, returns true. The user\_id, user\_name, and message will not be returned for deleted entries.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/entry_list?ids[]=1&ids[]=2&ids[]=3' \
     -H "Authorization: Bearer <token>"
```

#### Example Response:

```js
[
  { ... entry 1 ... },
  { ... entry 2 ... },
  { ... entry 3 ... },
]
```

## [Mark topic as read](#method.discussion_topics_api.mark_topic_read) <a href="#method.discussion_topics_api.mark_topic_read" id="method.discussion_topics_api.mark_topic_read"></a>

[DiscussionTopicsApiController#mark\_topic\_read](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/discussion_topics/:topic_id/read`

**Scope:** `url:PUT|/api/v1/courses/:course_id/discussion_topics/:topic_id/read`

#### `PUT /api/v1/groups/:group_id/discussion_topics/:topic_id/read`

**Scope:** `url:PUT|/api/v1/groups/:group_id/discussion_topics/:topic_id/read`

Mark the initial text of the discussion topic as read.

No request fields are necessary.

On success, the response will be 204 No Content with an empty body.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/read.json' \
     -X PUT \
     -H "Authorization: Bearer <token>" \
     -H "Content-Length: 0"
```

## [Mark all topic as read](#method.discussion_topics_api.mark_all_topic_read) <a href="#method.discussion_topics_api.mark_all_topic_read" id="method.discussion_topics_api.mark_all_topic_read"></a>

[DiscussionTopicsApiController#mark\_all\_topic\_read](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/discussion_topics/read_all`

**Scope:** `url:PUT|/api/v1/courses/:course_id/discussion_topics/read_all`

#### `PUT /api/v1/groups/:group_id/discussion_topics/read_all`

**Scope:** `url:PUT|/api/v1/groups/:group_id/discussion_topics/read_all`

Mark the initial text of all the discussion topics as read in the context.

No request fields are necessary.

On success, the response will be 204 No Content with an empty body.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/read_all' \
     -X POST \
     -H "Authorization: Bearer <token>" \
     -H "Content-Length: 0"
```

## [Mark topic as unread](#method.discussion_topics_api.mark_topic_unread) <a href="#method.discussion_topics_api.mark_topic_unread" id="method.discussion_topics_api.mark_topic_unread"></a>

[DiscussionTopicsApiController#mark\_topic\_unread](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `DELETE /api/v1/courses/:course_id/discussion_topics/:topic_id/read`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/discussion_topics/:topic_id/read`

#### `DELETE /api/v1/groups/:group_id/discussion_topics/:topic_id/read`

**Scope:** `url:DELETE|/api/v1/groups/:group_id/discussion_topics/:topic_id/read`

Mark the initial text of the discussion topic as unread.

No request fields are necessary.

On success, the response will be 204 No Content with an empty body.

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/read.json' \
     -X DELETE \
     -H "Authorization: Bearer <token>"
```

## [Mark all entries as read](#method.discussion_topics_api.mark_all_read) <a href="#method.discussion_topics_api.mark_all_read" id="method.discussion_topics_api.mark_all_read"></a>

[DiscussionTopicsApiController#mark\_all\_read](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/discussion_topics/:topic_id/read_all`

**Scope:** `url:PUT|/api/v1/courses/:course_id/discussion_topics/:topic_id/read_all`

#### `PUT /api/v1/groups/:group_id/discussion_topics/:topic_id/read_all`

**Scope:** `url:PUT|/api/v1/groups/:group_id/discussion_topics/:topic_id/read_all`

Mark the discussion topic and all its entries as read.

No request fields are necessary.

On success, the response will be 204 No Content with an empty body.

#### Request Parameters:

| Parameter           | Type      | Description                                                                                                                    |
| ------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `forced_read_state` | `boolean` | <p>A boolean value to set all of the entries' forced\_read\_state. No change<br>is made if this argument is not specified.</p> |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/read_all.json' \
     -X PUT \
     -H "Authorization: Bearer <token>" \
     -H "Content-Length: 0"
```

## [Mark all entries as unread](#method.discussion_topics_api.mark_all_unread) <a href="#method.discussion_topics_api.mark_all_unread" id="method.discussion_topics_api.mark_all_unread"></a>

[DiscussionTopicsApiController#mark\_all\_unread](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `DELETE /api/v1/courses/:course_id/discussion_topics/:topic_id/read_all`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/discussion_topics/:topic_id/read_all`

#### `DELETE /api/v1/groups/:group_id/discussion_topics/:topic_id/read_all`

**Scope:** `url:DELETE|/api/v1/groups/:group_id/discussion_topics/:topic_id/read_all`

Mark the discussion topic and all its entries as unread.

No request fields are necessary.

On success, the response will be 204 No Content with an empty body.

#### Request Parameters:

| Parameter           | Type      | Description                                                                                                                    |
| ------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `forced_read_state` | `boolean` | <p>A boolean value to set all of the entries' forced\_read\_state. No change is<br>made if this argument is not specified.</p> |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/read_all.json' \
     -X DELETE \
     -H "Authorization: Bearer <token>"
```

## [Mark entry as read](#method.discussion_topics_api.mark_entry_read) <a href="#method.discussion_topics_api.mark_entry_read" id="method.discussion_topics_api.mark_entry_read"></a>

[DiscussionTopicsApiController#mark\_entry\_read](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/read`

**Scope:** `url:PUT|/api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/read`

#### `PUT /api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:entry_id/read`

**Scope:** `url:PUT|/api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:entry_id/read`

Mark a discussion entry as read.

No request fields are necessary.

On success, the response will be 204 No Content with an empty body.

#### Request Parameters:

| Parameter           | Type      | Description                                                                                                            |
| ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------- |
| `forced_read_state` | `boolean` | <p>A boolean value to set the entry's forced\_read\_state. No change is made if<br>this argument is not specified.</p> |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/entries/<entry_id>/read.json' \
     -X PUT \
     -H "Authorization: Bearer <token>"\
     -H "Content-Length: 0"
```

## [Mark entry as unread](#method.discussion_topics_api.mark_entry_unread) <a href="#method.discussion_topics_api.mark_entry_unread" id="method.discussion_topics_api.mark_entry_unread"></a>

[DiscussionTopicsApiController#mark\_entry\_unread](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `DELETE /api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/read`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/read`

#### `DELETE /api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:entry_id/read`

**Scope:** `url:DELETE|/api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:entry_id/read`

Mark a discussion entry as unread.

No request fields are necessary.

On success, the response will be 204 No Content with an empty body.

#### Request Parameters:

| Parameter           | Type      | Description                                                                                                            |
| ------------------- | --------- | ---------------------------------------------------------------------------------------------------------------------- |
| `forced_read_state` | `boolean` | <p>A boolean value to set the entry's forced\_read\_state. No change is made if<br>this argument is not specified.</p> |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/entries/<entry_id>/read.json' \
     -X DELETE \
     -H "Authorization: Bearer <token>"
```

## [Rate entry](#method.discussion_topics_api.rate_entry) <a href="#method.discussion_topics_api.rate_entry" id="method.discussion_topics_api.rate_entry"></a>

[DiscussionTopicsApiController#rate\_entry](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `POST /api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/rating`

**Scope:** `url:POST|/api/v1/courses/:course_id/discussion_topics/:topic_id/entries/:entry_id/rating`

#### `POST /api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:entry_id/rating`

**Scope:** `url:POST|/api/v1/groups/:group_id/discussion_topics/:topic_id/entries/:entry_id/rating`

Rate a discussion entry.

On success, the response will be 204 No Content with an empty body.

#### Request Parameters:

| Parameter | Type      | Description                                               |
| --------- | --------- | --------------------------------------------------------- |
| `rating`  | `integer` | A rating to set on this entry. Only 0 and 1 are accepted. |

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/entries/<entry_id>/rating.json' \
     -X POST \
     -H "Authorization: Bearer <token>"
```

## [Subscribe to a topic](#method.discussion_topics_api.subscribe_topic) <a href="#method.discussion_topics_api.subscribe_topic" id="method.discussion_topics_api.subscribe_topic"></a>

[DiscussionTopicsApiController#subscribe\_topic](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `PUT /api/v1/courses/:course_id/discussion_topics/:topic_id/subscribed`

**Scope:** `url:PUT|/api/v1/courses/:course_id/discussion_topics/:topic_id/subscribed`

#### `PUT /api/v1/groups/:group_id/discussion_topics/:topic_id/subscribed`

**Scope:** `url:PUT|/api/v1/groups/:group_id/discussion_topics/:topic_id/subscribed`

Subscribe to a topic to receive notifications about new entries

On success, the response will be 204 No Content with an empty body

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/subscribed.json' \
     -X PUT \
     -H "Authorization: Bearer <token>" \
     -H "Content-Length: 0"
```

## [Unsubscribe from a topic](#method.discussion_topics_api.unsubscribe_topic) <a href="#method.discussion_topics_api.unsubscribe_topic" id="method.discussion_topics_api.unsubscribe_topic"></a>

[DiscussionTopicsApiController#unsubscribe\_topic](https://github.com/instructure/canvas-lms/blob/master/app/controllers/discussion_topics_api_controller.rb)

#### `DELETE /api/v1/courses/:course_id/discussion_topics/:topic_id/subscribed`

**Scope:** `url:DELETE|/api/v1/courses/:course_id/discussion_topics/:topic_id/subscribed`

#### `DELETE /api/v1/groups/:group_id/discussion_topics/:topic_id/subscribed`

**Scope:** `url:DELETE|/api/v1/groups/:group_id/discussion_topics/:topic_id/subscribed`

Unsubscribe from a topic to stop receiving notifications about new entries

On success, the response will be 204 No Content with an empty body

#### Example Request:

```bash
curl 'https://<canvas>/api/v1/courses/<course_id>/discussion_topics/<topic_id>/subscribed.json' \
     -X DELETE \
     -H "Authorization: Bearer <token>"
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


# Enrollment Terms

API for viewing and managing enrollment terms. For all actions, the specified account must be a root account. To manage enrollment terms, the caller must have permission to manage the account. To view enrollment terms, the caller must have an active teacher enrollment in at least one course.

#### An EnrollmentTerm object looks like: <a href="#enrollmentterm" id="enrollmentterm"></a>

```js
{
  // The unique identifier for the enrollment term.
  "id": 1,
  // The SIS id of the term. Only included if the user has permission to view SIS
  // information.
  "sis_term_id": "Sp2014",
  // the unique identifier for the SIS import. This field is only included if the
  // user has permission to manage SIS information.
  "sis_import_id": 34,
  // The name of the term.
  "name": "Spring 2014",
  // The datetime of the start of the term.
  "start_at": "2014-01-06T08:00:00-05:00",
  // The datetime of the end of the term.
  "end_at": "2014-05-16T05:00:00-04:00",
  // The state of the term. Can be 'active' or 'deleted'.
  "workflow_state": "active",
  // Term date overrides for specific enrollment types
  "overrides": {"StudentEnrollment":{"start_at":"2014-01-07T08:00:00-05:00","end_at":"2014-05-14T05:00:00-04:0"}},
  // The number of courses in the term (available via include)
  "course_count": 80
}
```

#### An EnrollmentTermsList object looks like: <a href="#enrollmenttermslist" id="enrollmenttermslist"></a>

```js
{
  // a paginated list of all terms in the account
  "enrollment_terms": []
}
```

## [Create enrollment term](#method.terms.create) <a href="#method.terms.create" id="method.terms.create"></a>

[TermsController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/terms_controller.rb)

#### `POST /api/v1/accounts/:account_id/terms`

**Scope:** `url:POST|/api/v1/accounts/:account_id/terms`

Create a new enrollment term for the specified account.

#### Request Parameters:

| Parameter                                               | Type       | Description                                                                                                                                                                                         |
| ------------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `enrollment_term[name]`                                 | `string`   | The name of the term.                                                                                                                                                                               |
| `enrollment_term[start_at]`                             | `DateTime` | <p>The day/time the term starts.<br>Accepts times in ISO 8601 format, e.g. 2015-01-10T18:48:00Z.</p>                                                                                                |
| `enrollment_term[end_at]`                               | `DateTime` | <p>The day/time the term ends.<br>Accepts times in ISO 8601 format, e.g. 2015-01-10T18:48:00Z.</p>                                                                                                  |
| `enrollment_term[sis_term_id]`                          | `string`   | The unique SIS identifier for the term.                                                                                                                                                             |
| `enrollment_term[overrides][enrollment_type][start_at]` | `DateTime` | <p>The day/time the term starts, overridden for the given enrollment type.<br><em>enrollment\_type</em> can be one of StudentEnrollment, TeacherEnrollment, TaEnrollment, or DesignerEnrollment</p> |
| `enrollment_term[overrides][enrollment_type][end_at]`   | `DateTime` | <p>The day/time the term ends, overridden for the given enrollment type.<br><em>enrollment\_type</em> can be one of StudentEnrollment, TeacherEnrollment, TaEnrollment, or DesignerEnrollment</p>   |

Returns an [EnrollmentTerm](#enrollmentterm) object.

## [Update enrollment term](#method.terms.update) <a href="#method.terms.update" id="method.terms.update"></a>

[TermsController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/terms_controller.rb)

#### `PUT /api/v1/accounts/:account_id/terms/:id`

**Scope:** `url:PUT|/api/v1/accounts/:account_id/terms/:id`

Update an existing enrollment term for the specified account.

#### Request Parameters:

| Parameter                                               | Type       | Description                                                                                                                                                                                         |
| ------------------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `enrollment_term[name]`                                 | `string`   | The name of the term.                                                                                                                                                                               |
| `enrollment_term[start_at]`                             | `DateTime` | <p>The day/time the term starts.<br>Accepts times in ISO 8601 format, e.g. 2015-01-10T18:48:00Z.</p>                                                                                                |
| `enrollment_term[end_at]`                               | `DateTime` | <p>The day/time the term ends.<br>Accepts times in ISO 8601 format, e.g. 2015-01-10T18:48:00Z.</p>                                                                                                  |
| `enrollment_term[sis_term_id]`                          | `string`   | The unique SIS identifier for the term.                                                                                                                                                             |
| `enrollment_term[overrides][enrollment_type][start_at]` | `DateTime` | <p>The day/time the term starts, overridden for the given enrollment type.<br><em>enrollment\_type</em> can be one of StudentEnrollment, TeacherEnrollment, TaEnrollment, or DesignerEnrollment</p> |
| `enrollment_term[overrides][enrollment_type][end_at]`   | `DateTime` | <p>The day/time the term ends, overridden for the given enrollment type.<br><em>enrollment\_type</em> can be one of StudentEnrollment, TeacherEnrollment, TaEnrollment, or DesignerEnrollment</p>   |
| `override_sis_stickiness`                               | `boolean`  | <p>Default is true. If false, any fields containing “sticky” changes will not be updated.<br>See SIS CSV Format documentation for information on which fields can have SIS stickiness</p>           |

Returns an [EnrollmentTerm](#enrollmentterm) object.

## [Delete enrollment term](#method.terms.destroy) <a href="#method.terms.destroy" id="method.terms.destroy"></a>

[TermsController#destroy](https://github.com/instructure/canvas-lms/blob/master/app/controllers/terms_controller.rb)

#### `DELETE /api/v1/accounts/:account_id/terms/:id`

**Scope:** `url:DELETE|/api/v1/accounts/:account_id/terms/:id`

Delete the specified enrollment term.

Returns an [EnrollmentTerm](#enrollmentterm) object.

## [List enrollment terms](#method.terms_api.index) <a href="#method.terms_api.index" id="method.terms_api.index"></a>

[TermsApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/terms_api_controller.rb)

#### `GET /api/v1/accounts/:account_id/terms`

**Scope:** `url:GET|/api/v1/accounts/:account_id/terms`

An object with a paginated list of all of the terms in the account.

#### Request Parameters:

| Parameter          | Type     | Description                                                                                                                                                                                                                       |
| ------------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `workflow_state[]` | `string` | <p>If set, only returns terms that are in the given state.<br>Defaults to 'active'. Allowed values: <code>active</code>, <code>deleted</code>, <code>all</code></p>                                                               |
| `include[]`        | `string` | <p>Array of additional information to include.<br>"overrides":: term start/end dates overridden for different enrollment types<br>"course\_count":: the number of courses in each term Allowed values: <code>overrides</code></p> |
| `term_name`        | `string` | <p>If set, only returns terms that match the given search keyword.<br>Search keyword is matched against term name.</p>                                                                                                            |

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/accounts/1/terms?include[]=overrides
```

#### Example Response:

```js
{
  "enrollment_terms": [
    {
      "id": 1,
      "name": "Fall 20X6"
      "start_at": "2026-08-31T20:00:00Z",
      "end_at": "2026-12-20T20:00:00Z",
      "created_at": "2025-01-02T03:43:11Z",
      "workflow_state": "active",
      "grading_period_group_id": 1,
      "sis_term_id": null,
      "overrides": {
        "StudentEnrollment": {
          "start_at": "2026-09-03T20:00:00Z",
          "end_at": "2026-12-19T20:00:00Z"
        },
        "TeacherEnrollment": {
          "start_at": null,
          "end_at": "2026-12-30T20:00:00Z"
        }
      }
    }
  ]
}
```

Returns an [EnrollmentTermsList](#enrollmenttermslist) object.

## [Retrieve enrollment term](#method.terms_api.show) <a href="#method.terms_api.show" id="method.terms_api.show"></a>

[TermsApiController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/terms_api_controller.rb)

#### `GET /api/v1/accounts/:account_id/terms/:id`

**Scope:** `url:GET|/api/v1/accounts/:account_id/terms/:id`

Retrieves the details for an enrollment term in the account. Includes overrides by default.

#### Example Request:

```bash
curl -H 'Authorization: Bearer <token>' \
https://<canvas>/api/v1/accounts/1/terms/2
```

Returns an [EnrollmentTerm](#enrollmentterm) object.

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).




---

[Next Page](/llms-full.txt/1)

