### Canvas LMS API Overview Source: https://canvas.instructure.com/doc/api/index General information about the Canvas LMS REST API, including its purpose, resources, and how to get started with authentication. ```APIDOC ## Welcome to the Canvas LMS API Documentation Canvas LMS includes a REST API for accessing and modifying data externally from the main application, in your own programs and scripts. This documentation describes the resources that make up the API. To get started, you'll want to review the general basics, including the information below and the page on Authentication using OAuth2. ### API Changes For API resources, such as the API Change Log for additions, changes, deprecations, and removals, view the Canvas API page in the Canvas Community. ### API Policy Please carefully review the Canvas API Policy before using the API. ### Schema Details * **Protocol**: All API access is over HTTPS. * **Response Format**: All API responses are in JSON format. * **IDs**: All integer IDs in Canvas are 64-bit integers. String IDs are also used. * To force all IDs to strings, add the request header `Accept: application/json+canvas-string-ids`. * **Boolean Parameters**: Can be passed as `true/false`, `t/f`, `yes/no`, `y/n`, `on/off`, or `1/0`. Literal `true/false` is preferred for JSON format. * **POST and PUT Requests**: Parameters are sent using standard HTML form encoding (`application/x-www-form-urlencoded`) or optionally in JSON format (set `Content-Type` to `application/json`). File uploads require `multipart/form-data`. * **Timestamps**: Sent and returned in ISO 8601 format (UTC timezone): `YYYY-MM-DDTHH:MM:SSZ`. ``` -------------------------------- ### Account Settings API Response Example (JSON) Source: https://canvas.instructure.com/doc/api/accounts An example of the JSON response when retrieving account settings. This object contains various boolean flags indicating enabled features or configurations for the account. ```json {"microsoft_sync_enabled": true, "microsoft_sync_login_attribute_suffix": false} ``` -------------------------------- ### Example User Participation Activity Response (JSON) Source: https://canvas.instructure.com/doc/api/analytics This JSON shows an example response for user-in-a-course-level participation data. It contains hourly page view data and a list of participation events with timestamps and URLs. ```json { "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", } ] } ``` -------------------------------- ### Example Course Student Summaries Response (JSON) Source: https://canvas.instructure.com/doc/api/analytics This JSON represents an example response for retrieving course-level student summary data. It includes details like page views, participations, and tardiness breakdown for each student. ```json [ { "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 } } ] ``` -------------------------------- ### Create Global Notification Response Source: https://canvas.instructure.com/doc/api/account_notifications Example JSON response when a global notification is successfully created. It returns the details of the newly created notification, including subject, start and end times, and message. ```json { "subject": "New notification", "start_at": "2014-01-01T00:00:00Z", "end_at": "2014-02-01T00:00:00Z", "message": "This is a global notification" } ``` -------------------------------- ### Get Course Student Summaries - Example Request (curl) Source: https://canvas.instructure.com/doc/api/analytics This snippet demonstrates how to retrieve a summary of per-user access information for all students in a course using curl. It requires specifying the course ID and an authorization token. ```curl curl https:///api/v1/courses//analytics/student_summaries \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Create a Global Notification (cURL) Source: https://canvas.instructure.com/doc/api/account_notifications Example cURL request to create a new global notification for an account. This requires specifying the subject, message, start and end times, and optionally an icon and target roles. ```bash curl -X POST -H 'Authorization: Bearer ' \ https:///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' ``` -------------------------------- ### Search Account Domains (cURL) Source: https://canvas.instructure.com/doc/api/account_domain_lookups Example of how to search for account domains using the Canvas Instructure API with cURL. This request uses GET to query the /api/v1/accounts/search endpoint, filtering by the 'name' parameter. It requires an Authorization header with a Bearer token. ```shell curl https:///api/v1/accounts/search \ -G -H 'Authorization: Bearer ' \ -d 'name=utah' ``` -------------------------------- ### Accounts API - Get Help Links Source: https://canvas.instructure.com/doc/api/accounts Retrieves the help links configured for an account. ```APIDOC ## GET /api/v1/accounts/:id/help_links ### Description Retrieves the help links configured for the specified account. ### Method GET ### Endpoint /api/v1/accounts/:id/help_links ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the account. ### Request Example ```json { "example": "GET /api/v1/accounts/1/help_links" } ``` ### Response #### Success Response (200) - **help_links** (array) - An array of HelpLink objects. #### Response Example ```json { "help_links": [ { "id": "instructor_question", "text": "Ask Your Instructor a Question", "subtext": "Questions are submitted to your instructor", "url": "#teacher_feedback", "type": "default", "available_to": [ "user", "student", "teacher", "admin", "observer", "unenrolled" ] } ] } ``` ``` -------------------------------- ### GET /api/v1/accounts/:account_id/help_links Source: https://canvas.instructure.com/doc/api/accounts Returns the help links configured for the specified account. ```APIDOC ## GET /api/v1/accounts/:account_id/help_links ### Description Returns the help links for that account. ### Method GET ### Endpoint `/api/v1/accounts/:account_id/help_links` ### Response #### Success Response (200) - Returns a HelpLinks object. #### Response Example ```json { "help_links": [ { "text": "Canvas Help", "url": "http://canvas.instructure.com/help" } ] } ``` ``` -------------------------------- ### Example Assignment Data Response (JSON) Source: https://canvas.instructure.com/doc/api/analytics This JSON represents an example response for user-in-a-course-level assignment data. It would typically include assignment details, grade breakdowns, and submission information for a student. ```json [ { "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 Creation Accounts Source: https://canvas.instructure.com/doc/api/accounts Retrieves a paginated list of accounts where the current user has permission to create courses. ```APIDOC ## GET /api/v1/course_creation_accounts ### Description A paginated list of accounts where the current user has permission to create courses. ### Method GET ### Endpoint /api/v1/course_creation_accounts ### Response #### Success Response (200) - Returns a list of Account objects. ``` -------------------------------- ### Show an AI Experience (GET) Source: https://canvas.instructure.com/doc/api/ai_experiences Retrieves a single AI experience by its unique ID within a specific course. ```http GET /api/v1/courses/:course_id/ai_experiences/:id ``` -------------------------------- ### Authentication using OAuth2 Source: https://canvas.instructure.com/doc/api/index Details on how to authenticate with the Canvas LMS API using OAuth2, including recommended methods and examples. ```APIDOC ## 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 in Header ```bash curl -H "Authorization: Bearer " "https://canvas.instructure.com/api/v1/courses" ``` ### OAuth2 Token in Query String ```bash curl "https://canvas.instructure.com/api/v1/courses?access_token=" ``` Read more about OAuth2 and how to get access tokens. ``` -------------------------------- ### GET /api/v1/manually_created_courses_account Source: https://canvas.instructure.com/doc/api/accounts Returns the sub-account that contains manually created courses for the domain root account. ```APIDOC ## GET /api/v1/manually_created_courses_account ### Description Returns the sub-account that contains manually created courses for the domain root account. ### Method GET ### Endpoint `/api/v1/manually_created_courses_account` ### Response #### Success Response (200) - Returns an Account object. #### Response Example ```json { "id": 2, "name": "Manually Created Courses", "workflow_state": "active" } ``` ``` -------------------------------- ### Get Manageable Accounts Source: https://canvas.instructure.com/doc/api/accounts Retrieves a paginated list of accounts where the current user has permission to create or manage courses. This list will be empty for students and teachers. ```APIDOC ## GET /api/v1/manageable_accounts ### Description 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. ### Method GET ### Endpoint /api/v1/manageable_accounts ### Response #### Success Response (200) - Returns a list of Account objects. ``` -------------------------------- ### Create an AI Experience (POST) Source: https://canvas.instructure.com/doc/api/ai_experiences Creates a new AI experience for a given course. Requires a title and learning objective, with optional description, facts, pedagogical guidance, and initial workflow state. ```http POST /api/v1/courses/:course_id/ai_experiences Request Body: { "title": "New Experience Title", "description": "Optional description", "facts": "Optional AI facts", "learning_objective": "Required learning objective", "pedagogical_guidance": "Required pedagogical guidance", "workflow_state": "published or unpublished (defaults to unpublished)" } ``` -------------------------------- ### Get Account Permissions Example Response Source: https://canvas.instructure.com/doc/api/accounts This is an example JSON response when checking account permissions. It maps permission names to boolean values indicating their status. ```json {'manage_account_memberships': 'false', 'become_user': 'true'} ``` -------------------------------- ### Create an AI Experience Source: https://canvas.instructure.com/doc/api/ai_experiences Create a new AI experience for a specified course with details like title, description, and learning objectives. ```APIDOC ## Create an AI experience ### Description Create a new AI experience for the specified course. ### Method POST ### Endpoint `/api/v1/courses/:course_id/ai_experiences` ### Parameters #### Request Body - **title** (string) - Required - The title of the AI experience. - **description** (string) - Optional - The description of the AI experience. - **facts** (string) - Optional - The AI facts for the experience. - **learning_objective** (string) - Required - The learning objectives for this experience. - **pedagogical_guidance** (string) - Required - The pedagogical guidance for the experience. - **workflow_state** (string) - Optional - The initial state of the experience. Defaults to ‘unpublished’. Allowed values: published, unpublished ### Response #### Success Response (200) - **AiExperience** (object) - The newly created AiExperience object. ``` -------------------------------- ### Show New AI Experience Form Source: https://canvas.instructure.com/doc/api/ai_experiences Display the form for creating a new AI experience. ```APIDOC ## Show new AI experience form ### Description Display the form for creating a new AI experience. ### Method GET ### Endpoint `/api/v1/courses/:course_id/ai_experiences/new` ``` -------------------------------- ### Canvas LMS API Documentation Generation Command Source: https://canvas.instructure.com/doc/api/index Provides the command to generate API documentation locally for Canvas LMS. This requires a local Canvas environment setup and is executed from the Canvas directory. ```bash bundle exec rake doc:api ``` -------------------------------- ### Environment Settings API Request Example (cURL) Source: https://canvas.instructure.com/doc/api/accounts Shows how to retrieve global environment settings for the root Canvas account using cURL. This requires an authorization token and returns a hash of settings available in the web interface. ```shell curl 'http:///api/v1/settings/environment' \ -H "Authorization: Bearer " ``` -------------------------------- ### Get Account Notifications (cURL) Source: https://canvas.instructure.com/doc/api/account_notifications Example cURL request to retrieve a list of active global notifications for the current user within a specific account. It supports parameters to include past or all notifications, and to show if a notification has been read. ```bash curl -H 'Authorization: Bearer ' \ https:///api/v1/accounts/2/users/self/account_notifications ``` -------------------------------- ### Get User Assignment Data - Example Request (curl) Source: https://canvas.instructure.com/doc/api/analytics This snippet illustrates how to retrieve a list of assignments for a course, including grade and submission details for a specific student, using curl. It requires course ID, user ID, and an authorization token. ```curl curl https:///api/v1/courses//analytics/users//assignments \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Get User Participation Activity - Example Request (curl) Source: https://canvas.instructure.com/doc/api/analytics This snippet shows how to fetch page view hits grouped by hour and participation details for a specific user within a course using curl. It requires course ID, user ID, and an authorization token. ```curl curl https:///api/v1/courses//analytics/users//activity \ -H 'Authorization: Bearer ' ``` -------------------------------- ### Generating API Documentation Source: https://canvas.instructure.com/doc/api/index Instructions on how to generate the API documentation locally if you have a Canvas LMS environment set up. ```APIDOC ## About this Documentation This documentation is generated directly from the Canvas LMS code. You can generate this documentation yourself if you've set up a local Canvas environment following the instructions on Github. Run the following command from your Canvas directory: ```bash bundle exec rake doc:api ``` ``` -------------------------------- ### AiExperience Object Structure (JSON) Source: https://canvas.instructure.com/doc/api/ai_experiences An example of the JSON object structure for an AI Experience. This object includes fields for ID, title, description, AI facts, learning objectives, pedagogical guidance, workflow state, and the associated course ID. ```json { "id": 234, "title": "Customer Service Simulation", "description": "Practice customer service skills in a simulated environment", "facts": "You are a customer service representative...", "learning_objective": "Students will practice active listening and problem-solving", "pedagogical_guidance": "A customer is calling about a billing issue", "workflow_state": "published", "course_id": 1578941 } ``` -------------------------------- ### Get a Single Account Calendar Source: https://canvas.instructure.com/doc/api/account_calendars Get details about a specific account calendar. ```APIDOC ## Get a Single Account Calendar ### Description Get details about a specific account calendar. ### Method GET ### Endpoint /api/v1/account_calendars/:account_id #### Path Parameters - **account_id** (integer) - Required - The ID of the account calendar to retrieve. ### Request Example ```bash curl https:///api/v1/account_calendars/204 \ -H 'Authorization: Bearer ' ``` ### Response #### Success Response (200) - **AccountCalendar** (object) - An AccountCalendar object with details about the specified calendar. #### Response Example ```json { "id": 204, "name": "Department of Chemistry", "parent_account_id": 1, "root_account_id": 1, "visible": true, "auto_subscribe": false, "sub_account_count": 0, "asset_string": "account_4", "type": "account", "calendar_event_url": "/accounts/2/calendar_events/%7B%7B%20id%20%7D%7D", "can_create_calendar_events": true, "create_calendar_event_url": "/accounts/2/calendar_events", "new_calendar_event_url": "/accounts/6/calendar_events/new" } ``` ``` -------------------------------- ### List AI Experiences Source: https://canvas.instructure.com/doc/api/ai_experiences Retrieve a paginated list of AI experiences for a specific course. Supports filtering by workflow state. ```APIDOC ## List AI experiences ### Description Retrieve the paginated list of AI experiences for a course. ### Method GET ### Endpoint `/api/v1/courses/:course_id/ai_experiences` ### Parameters #### Query Parameters - **workflow_state** (string) - Optional - Only return experiences with the specified workflow state. Allowed values: published, unpublished, deleted ### Response #### Success Response (200) - **AiExperience[]** (array) - A list of AiExperience objects. ``` -------------------------------- ### GET /api/v1/accounts/:account_id/analytics/completed/statistics_by_subaccount Source: https://canvas.instructure.com/doc/api/analytics Get department-level statistics, broken down by subaccount for completed terms/filters. ```APIDOC ## GET /api/v1/accounts/:account_id/analytics/completed/statistics_by_subaccount ### Description Get department-level statistics, broken down by subaccount for completed terms or filters. ### Method GET ### Endpoint /api/v1/accounts/:account_id/analytics/completed/statistics_by_subaccount ### Parameters #### Path Parameters - **account_id** (string) - Required - The ID of the account. ### Request Example ```bash curl https:///api/v1/accounts//analytics/completed/statistics_by_subaccount \ -H 'Authorization: Bearer ' ``` ### Response #### Success Response (200) - **accounts** (array) - An array of subaccount statistics. - **name** (string) - The name of the subaccount. - **id** (integer) - The ID of the subaccount. - **courses** (integer) - The number of courses in the subaccount. - **teachers** (integer) - The number of teachers in the subaccount. - **students** (integer) - The number of students in the subaccount. - **discussion_topics** (integer) - The number of discussion topics in the subaccount. - **media_objects** (integer) - The number of media objects in the subaccount. - **attachments** (integer) - The number of attachments in the subaccount. - **assignments** (integer) - The number of assignments in the subaccount. #### Response Example ```json {"accounts": [ { "name": "some string", "id": 188, "courses": 27, "teachers": 36, "students": 418, "discussion_topics": 77, "media_objects": 219, "attachments": 1268, "assignments": 290 } ]} ``` ``` -------------------------------- ### Account Settings API Request Example (cURL) Source: https://canvas.instructure.com/doc/api/accounts Demonstrates how to fetch settings for a specific Canvas account using a cURL command. Requires an account ID and an authorization token. The response is a JSON object containing account settings. ```shell curl https:///api/v1/accounts//settings \ -H 'Authorization: Bearer ' ``` -------------------------------- ### GET /api/v1/accounts/:account_id/analytics/current/statistics_by_subaccount Source: https://canvas.instructure.com/doc/api/analytics Get department-level statistics, broken down by subaccount for the current term/filter. ```APIDOC ## GET /api/v1/accounts/:account_id/analytics/current/statistics_by_subaccount ### Description Get department-level statistics, broken down by subaccount for the current term or filter. ### Method GET ### Endpoint /api/v1/accounts/:account_id/analytics/current/statistics_by_subaccount ### Parameters #### Path Parameters - **account_id** (string) - Required - The ID of the account. ### Request Example ```bash curl https:///api/v1/accounts//analytics/current/statistics_by_subaccount \ -H 'Authorization: Bearer ' ``` ### Response #### Success Response (200) - **accounts** (array) - An array of subaccount statistics. - **name** (string) - The name of the subaccount. - **id** (integer) - The ID of the subaccount. - **courses** (integer) - The number of courses in the subaccount. - **teachers** (integer) - The number of teachers in the subaccount. - **students** (integer) - The number of students in the subaccount. - **discussion_topics** (integer) - The number of discussion topics in the subaccount. - **media_objects** (integer) - The number of media objects in the subaccount. - **attachments** (integer) - The number of attachments in the subaccount. - **assignments** (integer) - The number of assignments in the subaccount. #### Response Example ```json {"accounts": [ { "name": "some string", "id": 188, "courses": 27, "teachers": 36, "students": 418, "discussion_topics": 77, "media_objects": 219, "attachments": 1268, "assignments": 290 } ]} ``` ``` -------------------------------- ### GET /api/v1/accounts/:account_id/analytics/terms/:term_id/statistics_by_subaccount Source: https://canvas.instructure.com/doc/api/analytics Get department-level statistics, broken down by subaccount for a specific term. ```APIDOC ## GET /api/v1/accounts/:account_id/analytics/terms/:term_id/statistics_by_subaccount ### Description Get department-level statistics, broken down by subaccount for a specific term. ### Method GET ### Endpoint /api/v1/accounts/:account_id/analytics/terms/:term_id/statistics_by_subaccount ### Parameters #### Path Parameters - **account_id** (string) - Required - The ID of the account. - **term_id** (string) - Required - The ID of the term. ### Request Example ```bash curl https:///api/v1/accounts//analytics/terms//statistics_by_subaccount \ -H 'Authorization: Bearer ' ``` ### Response #### Success Response (200) - **accounts** (array) - An array of subaccount statistics. - **name** (string) - The name of the subaccount. - **id** (integer) - The ID of the subaccount. - **courses** (integer) - The number of courses in the subaccount. - **teachers** (integer) - The number of teachers in the subaccount. - **students** (integer) - The number of students in the subaccount. - **discussion_topics** (integer) - The number of discussion topics in the subaccount. - **media_objects** (integer) - The number of media objects in the subaccount. - **attachments** (integer) - The number of attachments in the subaccount. - **assignments** (integer) - The number of assignments in the subaccount. #### Response Example ```json {"accounts": [ { "name": "some string", "id": 188, "courses": 27, "teachers": 36, "students": 418, "discussion_topics": 77, "media_objects": 219, "attachments": 1268, "assignments": 290 } ]} ``` ``` -------------------------------- ### GET /api/v1/courses/:course_id/analytics/assignments Source: https://canvas.instructure.com/doc/api/analytics Get course-level assignment data, including grade breakdown and submission status. ```APIDOC ## GET /api/v1/courses/:course_id/analytics/assignments ### Description 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. ### Method GET ### Endpoint /api/v1/courses/:course_id/analytics/assignments ### Parameters #### Path Parameters - **course_id** (string) - Required - The ID of the course. #### Query Parameters - **async** (boolean) - Optional - If async is true, then the course_assignments call can happen asynchronously and MAY return a response containing a progress_url key instead of an assignments array. If it does, then it is the caller’s responsibility to poll the API again to see if the progress is complete. If the data is ready (possibly even on the first async call) then it will be passed back normally, as documented in the example response. ### Request Example ```bash curl https:///api/v1/courses//analytics/assignments \ -H 'Authorization: Bearer ' ``` ### Response #### Success Response (200) - **assignments** (array) - A list of assignments. - **[Assignment Object]** - Details about each assignment including grade breakdown and submission status. #### Response Example ```json { "assignments": [ { "id": 123, "name": "Homework 1", "due_at": "2023-10-27T23:59:59Z", "grade_data": { "average_score": 85.5, "high_score": 100, "low_score": 70 }, "submission_status": { "on_time": 75, "late": 25 } } ] } ``` ``` -------------------------------- ### Create an Access Token (API) Source: https://canvas.instructure.com/doc/api/access_tokens Creates a new access token for a user through the Instructure Canvas API. Requires a 'purpose' and optionally accepts 'expires_at' and 'scopes'. Tokens created for other users may be in a 'pending' state. ```http POST /api/v1/users/:user_id/tokens ``` -------------------------------- ### Make an Account Admin Source: https://canvas.instructure.com/doc/api/admins Promotes an existing user to an administrator within the account. You can specify a role or role ID, and control whether a confirmation email is sent. ```APIDOC ## POST /api/v1/accounts/:account_id/admins ### Description Flag an existing user as an admin within the account. ### Method POST ### Endpoint /api/v1/accounts/:account_id/admins ### Parameters #### Path Parameters - **account_id** (integer) - Required - The ID of the account. #### Request Body - **user_id** (integer) - Required - The ID of the user to promote. - **role** (string) - Optional - DEPRECATED. The user’s admin relationship with the account will be created with the given role. Defaults to ‘AccountAdmin’. - **role_id** (integer) - Optional - 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) - Optional - Send a notification email to the new admin if true. Default is true. ### Response #### Success Response (200) - **admin** (object) - An Admin object representing the newly created admin. ### Request Example ```json { "user_id": 1234, "role_id": 567, "send_confirmation": true } ``` ### Response Example ```json { "id": 1024, "role": "AccountAdmin", "user": { "id": 1234, "name": "John Doe" }, "workflow_state": "active" } ``` ``` -------------------------------- ### GET /api/v1/courses/:course_id/analytics/activity Source: https://canvas.instructure.com/doc/api/analytics Get course-level participation data, including page views and participation numbers grouped by day. ```APIDOC ## GET /api/v1/courses/:course_id/analytics/activity ### Description 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”. ### Method GET ### Endpoint /api/v1/courses/:course_id/analytics/activity ### Parameters #### Path Parameters - **course_id** (string) - Required - The ID of the course. ### Request Example ```bash curl https:///api/v1/courses//analytics/activity \ -H 'Authorization: Bearer ' ``` ### Response #### Success Response (200) - **date** (string) - The date in YYYY-MM-DD format. - **participations** (integer) - The number of participations on that date. - **views** (integer) - The number of page views on that date. #### Response Example ```json [ { "date": "2012-01-24", "participations": 3, "views": 10 } ] ``` ``` -------------------------------- ### List Environment Settings Source: https://canvas.instructure.com/doc/api/accounts Returns a hash of global settings for the root account, mirroring the information supplied to the web interface as ENV.SETTINGS. ```APIDOC ## GET /api/v1/settings/environment ### Description Return a hash of global settings for the root account This is the same information supplied to the web interface as `ENV.SETTINGS`. ### Method GET ### Endpoint /api/v1/settings/environment ### Request Example ``` curl 'http:///api/v1/settings/environment' \ -H "Authorization: Bearer " ``` ### Response #### Success Response (200) - Returns a hash of global settings for the root account. ``` -------------------------------- ### List Announcements using cURL Source: https://canvas.instructure.com/doc/api/announcements Example of how to list announcements using cURL. This request requires a bearer token for authorization and specifies context codes for filtering. ```bash curl https:///api/v1/announcements?context_codes[]=course_1&context_codes[]=course_2 \ -H 'Authorization: Bearer ' ``` -------------------------------- ### List AI Experiences (GET) Source: https://canvas.instructure.com/doc/api/ai_experiences Retrieves a paginated list of AI experiences for a specific course. Supports filtering by workflow state (published, unpublished, deleted). ```http GET /api/v1/courses/:course_id/ai_experiences?workflow_state= ``` -------------------------------- ### Show an Access Token (API) Source: https://canvas.instructure.com/doc/api/access_tokens Fetches details of a specific access token for a user using either its database ID or 'token_hint'. This is part of the Instructure Canvas API. ```http GET /api/v1/users/:user_id/tokens/:id ``` -------------------------------- ### Get Account LTI API Endpoint Source: https://canvas.instructure.com/doc/api/accounts_%28lti%29 This snippet details the GET request for retrieving information on an individual account using its local or global ID via the LTI API. It requires the 'url:GET|/api/lti/accounts/:account_id' scope and returns an Account object. ```http GET /api/lti/accounts/:account_id ``` -------------------------------- ### GET /api/v1/accounts/:account_id/terms_of_service Source: https://canvas.instructure.com/doc/api/accounts Returns the terms of service for the specified account. ```APIDOC ## GET /api/v1/accounts/:account_id/terms_of_service ### Description Returns the terms of service for that account. ### Method GET ### Endpoint `/api/v1/accounts/:account_id/terms_of_service` ### Response #### Success Response (200) - Returns a TermsOfService object. #### Response Example ```json { "id": 1, "text": "Terms of service text...", "use_excerpt": false } ``` ``` -------------------------------- ### Accounts API - List settings Source: https://canvas.instructure.com/doc/api/accounts Lists account settings. ```APIDOC ## GET /api/v1/accounts/:id/settings ### Description Lists the settings for the specified account. ### Method GET ### Endpoint /api/v1/accounts/:id/settings ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the account. ### Request Example ```json { "example": "GET /api/v1/accounts/1/settings" } ``` ### Response #### Success Response (200) - **settings** (object) - An object containing account settings. #### Response Example ```json { "settings": { "default_storage_quota_mb": 500, "default_user_storage_quota_mb": 50, "default_group_storage_quota_mb": 50, "default_time_zone": "America/Denver", "sis_account_id": "123xyz", "integration_id": "123xyz", "lti_guid": "123xyz" } } ``` ``` -------------------------------- ### Show an AI Experience Source: https://canvas.instructure.com/doc/api/ai_experiences Retrieve a specific AI experience by its ID within a course. ```APIDOC ## Show an AI experience ### Description Retrieve an AI experience by ID. ### Method GET ### Endpoint `/api/v1/courses/:course_id/ai_experiences/:id` ### Response #### Success Response (200) - **AiExperience** (object) - The requested AiExperience object. ``` -------------------------------- ### Get an Assignment Group Source: https://canvas.instructure.com/doc/api/assignment_groups Returns the assignment group with the given id. ```APIDOC ## Get an Assignment Group ### Description Returns the assignment group with the given id. ### Method GET ### Endpoint /api/v1/courses/:course_id/assignment_groups/:assignment_group_id ### Query Parameters - **include[]** (string) - Optional - Associations to include with the group. “discussion_topic” and “assignment_visibility” and “submission” are only valid if ‚ssignments” is also included. “score_statistics” is only valid if “submission” and ‚ssignments” are also included. The “assignment_visibility” option additionally requires that the Differentiated Assignments course feature be turned on. Allowed values: `assignments`, `discussion_topic`, `assignment_visibility`, `submission`, `score_statistics` - **override_assignment_dates** (boolean) - Optional - Apply assignment overrides for each assignment, defaults to true. - **grading_period_id** (integer) - Optional - The id of the grading period in which assignment groups are being requested (Requires grading periods to exist on the account) ### Response #### Success Response (200) - **AssignmentGroup** (object) - An AssignmentGroup object #### Response Example { "example": "AssignmentGroup object" } ``` -------------------------------- ### Canvas Experiences Source: https://canvas.instructure.com/doc/api/index Information about how Canvas LMS experiences (e.g., Canvas Career, Canvas for Elementary) relate to API resource availability. ```APIDOC ## 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. ``` -------------------------------- ### List Announcements Source: https://canvas.instructure.com/doc/api/announcements Returns the paginated list of announcements for the given courses and date range. A `context_code` field is added to the responses to identify the course each announcement belongs to. ```APIDOC ## GET /api/v1/announcements ### Description 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. ### Method GET ### Endpoint /api/v1/announcements ### Parameters #### Query Parameters - **context_codes[]** (string) - Required - List of context_codes to retrieve announcements for (for example, `course_123`). Only courses are presently supported. The call will fail unless the caller has View Announcements permission in all listed courses. - **start_date** (Date) - Optional - Only return announcements posted since the start_date (inclusive). Defaults to 14 days ago. The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ. - **end_date** (Date) - Optional - Only return announcements posted before the end_date (inclusive). Defaults to 28 days from start_date. The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ. Announcements scheduled for future posting will only be returned to course administrators. - **available_after** (Date) - Optional - Only return announcements having locked_at nil or after available_after (exclusive). The value should be formatted as: yyyy-mm-dd or ISO 8601 YYYY-MM-DDTHH:MM:SSZ. Effective only for students (who don’t have moderate forum right). - **active_only** (boolean) - Optional - Only return active announcements that have been published. Applies only to requesting users that have permission to view unpublished items. Defaults to false for users with access to view unpublished items, otherwise true and unmodifiable. - **latest_only** (boolean) - Optional - Only return the latest announcement for each associated context. The response will include at most one announcement for each specified context in the context_codes[] parameter. Defaults to false. - **include** (array) - Optional - Optional list of resources to include with the response. May include a string of the name of the resource. Possible values are: “sections”, “sections_user_count” if “sections” is passed, includes the course sections that are associated with the topic, if the topic is specific to certain sections of the course. If “sections_user_count” is passed, then: (a) If sections were asked for *and* the topic is specific to certain course sections sections, includes the number of users in each section. (as part of the section json asked for above) (b) Else, includes at the root level the total number of users in the topic's context (group or course) that the topic applies to. ### Request Example ```curl https:///api/v1/announcements?context_codes[]=course_1&context_codes[]=course_2 \ -H 'Authorization: Bearer ' ``` ### Response #### Success Response (200) - **id** (integer) - The announcement ID. - **title** (string) - The title of the announcement. - **message** (string) - The content of the announcement. - **posted_at** (string) - The date and time the announcement was posted. - **delayed_post_at** (string) - The date and time the announcement is scheduled to be posted. - **context_code** (string) - The code of the context (e.g., course) the announcement belongs to. #### Response Example ```json [ { "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" } ] ``` ``` -------------------------------- ### Accounts API - Get Terms of Service Source: https://canvas.instructure.com/doc/api/accounts Retrieves the Terms of Service for a given account. ```APIDOC ## GET /api/v1/accounts/:id/terms_of_service ### Description Retrieves the Terms of Service for the specified account. ### Method GET ### Endpoint /api/v1/accounts/:id/terms_of_service ### Parameters #### Path Parameters - **id** (integer) - Required - The ID of the account. ### Request Example ```json { "example": "GET /api/v1/accounts/1/terms_of_service" } ``` ### Response #### Success Response (200) - **terms_of_service** (object) - The TermsOfService object. #### Response Example ```json { "terms_of_service": { "id": 1, "terms_type": "default", "passive": false, "account_id": 1, "content": "To be or not to be that is the question", "self_registration_type": "[\"none\", \"observer\", \"all\"]" } } ``` ```