Canvas LMS Users API

User accounts, profiles, and per-user resources

OpenAPI Specification

canvas-lms-users-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Canvas LMS REST Accounts Users API
  description: 'The Canvas LMS REST API exposes the full learning-management surface — accounts, courses,

    enrollments, users, assignments, submissions, grades, outcomes, quizzes, modules, pages,

    discussions, files, conversations, calendar events, planner, and more — via

    `/api/v1` on any Canvas install (Free for Teacher at canvas.instructure.com,

    Canvas Cloud, or self-hosted).


    Authentication uses OAuth2 (RFC 6749). Tokens are issued via the

    `/login/oauth2/auth` and `/login/oauth2/token` endpoints; clients must be

    registered as a Developer Key in the target Canvas account. Manual personal

    access tokens may be created from a user''s profile for testing only.


    Pagination follows RFC 5988 with `Link` response headers (`rel="next"`,

    `"prev"`, `"first"`, `"last"`). Includes can be requested via the

    `include[]` query parameter on most resources. Admin users may impersonate

    other users by appending `as_user_id={id}` (Masquerading).


    This OpenAPI document covers the most-used endpoints across Accounts,

    Courses, Enrollments, Users, Assignments, Submissions, Modules, Discussions,

    Files, and Outcomes. The full surface (190+ resource groups) is documented

    at https://canvas.instructure.com/doc/api/all_resources.html and generated

    in the canvas-lms repo via `rake doc:openapi`.

    '
  version: '1.0'
  contact:
    name: Canvas Developer Community
    url: https://community.canvaslms.com/t5/Canvas-Developers-Group/gh-p/canvas-developers
  license:
    name: AGPL-3.0
    identifier: AGPL-3.0-or-later
  x-logo:
    url: https://www.instructure.com/sites/default/files/image/2021-12/Canvas_logo_single_mark.png
servers:
- url: https://{canvas_host}/api/v1
  description: Canvas REST API on any Canvas install
  variables:
    canvas_host:
      default: canvas.instructure.com
      description: The Canvas host (canvas.instructure.com for Free for Teacher, your-school.instructure.com for Canvas Cloud, or your self-hosted Canvas)
security:
- OAuth2: []
- BearerAuth: []
tags:
- name: Users
  description: User accounts, profiles, and per-user resources
paths:
  /courses/{course_id}/users:
    get:
      summary: List Users in a Course
      operationId: listCourseUsers
      tags:
      - Users
      parameters:
      - $ref: '#/components/parameters/CourseId'
      - name: enrollment_type[]
        in: query
        schema:
          type: array
          items:
            type: string
            enum:
            - teacher
            - student
            - student_view
            - ta
            - observer
            - designer
      - name: enrollment_role
        in: query
        schema:
          type: string
      - name: include[]
        in: query
        schema:
          type: array
          items:
            type: string
            enum:
            - enrollments
            - locked
            - avatar_url
            - test_student
            - bio
            - custom_links
            - current_grading_period_scores
            - uuid
      - name: search_term
        in: query
        schema:
          type: string
      - $ref: '#/components/parameters/PerPage'
      responses:
        '200':
          description: A paginated list of users in the course
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/User'
  /users/{user_id}:
    get:
      summary: Get a Single User
      operationId: getUser
      tags:
      - Users
      parameters:
      - name: user_id
        in: path
        required: true
        schema:
          type: string
      - name: include[]
        in: query
        schema:
          type: array
          items:
            type: string
            enum:
            - uuid
            - last_login
      responses:
        '200':
          description: The user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
  /users/self:
    get:
      summary: Get the Authenticated User
      operationId: getSelf
      tags:
      - Users
      responses:
        '200':
          description: The authenticated user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/User'
  /users/self/profile:
    get:
      summary: Get the Authenticated User's Profile
      operationId: getSelfProfile
      tags:
      - Users
      responses:
        '200':
          description: The user profile
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Profile'
components:
  schemas:
    User:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        sortable_name:
          type: string
        short_name:
          type: string
        sis_user_id:
          type: string
          nullable: true
        sis_import_id:
          type: integer
          nullable: true
        integration_id:
          type: string
          nullable: true
        login_id:
          type: string
        avatar_url:
          type: string
          nullable: true
        avatar_state:
          type: string
          nullable: true
        enrollments:
          type: array
          items:
            $ref: '#/components/schemas/Enrollment'
        email:
          type: string
          nullable: true
        locale:
          type: string
          nullable: true
        last_login:
          type: string
          format: date-time
          nullable: true
        time_zone:
          type: string
        bio:
          type: string
          nullable: true
        pronouns:
          type: string
          nullable: true
    Profile:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        short_name:
          type: string
        sortable_name:
          type: string
        title:
          type: string
          nullable: true
        bio:
          type: string
          nullable: true
        primary_email:
          type: string
          nullable: true
        login_id:
          type: string
        sis_user_id:
          type: string
          nullable: true
        lti_user_id:
          type: string
          nullable: true
        avatar_url:
          type: string
          nullable: true
        calendar:
          type: object
          properties:
            ics:
              type: string
        time_zone:
          type: string
        locale:
          type: string
          nullable: true
    Enrollment:
      type: object
      properties:
        id:
          type: integer
          format: int64
        course_id:
          type: integer
        course_section_id:
          type: integer
          nullable: true
        root_account_id:
          type: integer
        type:
          type: string
          enum:
          - StudentEnrollment
          - TeacherEnrollment
          - TaEnrollment
          - DesignerEnrollment
          - ObserverEnrollment
        user_id:
          type: integer
        associated_user_id:
          type: integer
          nullable: true
        role:
          type: string
        role_id:
          type: integer
        enrollment_state:
          type: string
          enum:
          - active
          - invited
          - creation_pending
          - deleted
          - rejected
          - completed
          - inactive
        limit_privileges_to_course_section:
          type: boolean
        sis_import_id:
          type: integer
          nullable: true
        sis_account_id:
          type: string
          nullable: true
        sis_course_id:
          type: string
          nullable: true
        sis_section_id:
          type: string
          nullable: true
        sis_user_id:
          type: string
          nullable: true
        section_integration_id:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        start_at:
          type: string
          format: date-time
          nullable: true
        end_at:
          type: string
          format: date-time
          nullable: true
        last_activity_at:
          type: string
          format: date-time
          nullable: true
        last_attended_at:
          type: string
          format: date-time
          nullable: true
        total_activity_time:
          type: integer
        html_url:
          type: string
        grades:
          type: object
          properties:
            html_url:
              type: string
            current_grade:
              type: string
              nullable: true
            final_grade:
              type: string
              nullable: true
            current_score:
              type: number
              nullable: true
            final_score:
              type: number
              nullable: true
            unposted_current_grade:
              type: string
              nullable: true
            unposted_final_grade:
              type: string
              nullable: true
            unposted_current_score:
              type: number
              nullable: true
            unposted_final_score:
              type: number
              nullable: true
  parameters:
    PerPage:
      name: per_page
      in: query
      description: Items per page (default 10, max varies by endpoint and install).
      schema:
        type: integer
        minimum: 1
        maximum: 100
    CourseId:
      name: course_id
      in: path
      required: true
      description: The Canvas course ID or an SIS course ID prefixed `sis_course_id:`.
      schema:
        type: string
  securitySchemes:
    OAuth2:
      type: oauth2
      description: Canvas OAuth2 (RFC 6749) authorization code grant. Register a Developer Key in the target Canvas account to obtain a client_id and client_secret.
      flows:
        authorizationCode:
          authorizationUrl: https://canvas.instructure.com/login/oauth2/auth
          tokenUrl: https://canvas.instructure.com/login/oauth2/token
          refreshUrl: https://canvas.instructure.com/login/oauth2/token
          scopes:
            url:GET|/api/v1/accounts: Read accounts
            url:GET|/api/v1/courses: Read courses
            url:GET|/api/v1/users/{user_id}: Read a user
    BearerAuth:
      type: http
      scheme: bearer
      description: A Canvas access token. For testing only — production apps MUST use the OAuth2 flow per the Canvas API Policy.