The Classroom API provides a RESTful interface for you to manage courses and rosters in Google Classroom. Additionally, the Classroom share button allows developers and content owners to enable sharing their content to Classroom.
Who can use the API?
G Suite for Education domain administrators can use the API to programmatically provision courses on behalf of teachers, sync student information systems with Classroom, and get basic visibility into classes being taught in their domain.
Application developers can use the Classroom API to integrate their apps with Classroom. These apps need to use OAuth 2.0 to request permission to view classes and rosters from teachers. Admins can restrict whether teachers and students in their domain can authorize apps to access their Google Classroom data.
Website owners and content developers can use the Classroom share button to let students and teachers share content back to Classroom.
All API and Classroom share button integrations should follow the Classroom brand guidelines.
The Classroom API consists of several entity types that correspond to classes, teachers, and students in the Classroom interface. Some of these entities have additional properties specific to the API in addition to what exists in Classroom. The primary entity types are:
For detailed information on the API's resources and methods, refer to the Classroom API reference.
Course metadata and aliases
Courses represent a class, such as "M. Smith's 4th period math," and its assigned teachers, student roster, and metadata. Each course is identified by a unique ID assigned by the server. The Course resource specifically encapsulates all of the metadata about the course, such as the name, description, location, and time. Course rosters are managed through the Student, Teacher, and Invitation resources and their methods.
Aliases are alternate identifiers for a class that may be associated with a course and used in place of the unique ID. Each alias exists in a namespace that restricts who can create and view it. Two namespaces are supported:
- Domain: The domain namespace is useful for creating aliases that all users need access to, but that are not specific to any one program. For example, alternate listings for a course, such as MATH 127 and COMSCI 127, should be created in the domain namespace. Aliases in the domain namespace may only be created by domain administrators but are visible to all users in a domain.
- Developer project: The developer project namespace is useful for managing aliases specific to an application. For example, an application that uses alternate identifiers for courses can create aliases to map its identifier to Classroom courses. Aliases created in this namespace are tied to a specific Google API Console. Any user of an application can create and view aliases in the namespace for that application's developer project.
For more information about managing course metadata and aliases, see Manage Courses.
Course rosters and users
Students and Teachers are specific mappings between a user profile and a course, representing that user's role in the course. Designations of student and teacher are not global: a user can be assigned as a teacher for one course and a student in another. The designation "student" or "teacher" represents a set of permissions for a particular user in a particular course.
- A Student resource represents a user who is enrolled as a student in a specific course. Students are permitted to view the course details and teachers for that course.
- A Teacher resource represents a user who teaches a specific course. Teachers are permitted to view and change the course details, view teachers and students, and manage additional teachers and students.
Invitations and their associated methods provide a convenient way of adding students and teachers to courses. Creating invitations allows users to choose whether or not to join a course, rather than you directly adding them through the teacher and student resources.
UserProfiles represent a mappping to a user's domain profile as identified
by the unique ID or email address of the user returned by the
Google Admin SDK.
The current user may also refer to their own ID using the
For more information on managing rosters, see Manage Teachers and Students.
Coursework and student submissions
A CourseWork item represents a single task assigned to a group of students in a course. It contains details such as the description, due date, and materials as well as metadata such as creation time. Materials include a title, thumbnail, and URL, as well as an identifier that can be used with the appropriate APIs (i.e. Drive, YouTube).
CourseWork items describe one of the following types of tasks:
- An assignment that students complete by submitting worksheets or other attachments.
- A short answer question or multiple choice question.
Student work for a CourseWork item is represented by a StudentSubmission. It consists of a response and additional metadata such as a state and assigned grade.
The contents of a StudentSubmission depend on the type of the corresponding CourseWork item:
- The worksheets and attachments submitted for an assignment, including their title, thumbnail, and URL, as well as identifiers that can be used with the appropriate APIs such as Drive or YouTube.
- The response to a short answer question or multiple choice question.
For more information on managing coursework and student submissions, see Manage CourseWork.
To set up your environment and get started right away with the API, try one of the quickstarts:
You can also explore the API reference.