The student and teacher roles in Google Classroom represent a user's role in a course. A user can be assigned as a teacher in 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.
- Students
- A Studentresource 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.
- Teachers
- A Teacherresource 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. Each course has a primary teacher, or course owner, who is a teacher that can manage settings like course ownership transfer.
Students and teachers are identified by the unique ID or email address of the
user, as returned by the Directory API 
.
The current user may also refer to their own ID using the "me" 
shorthand.
Direct management permissions using the Classroom API
Administrators, students, and teachers have different permissions when directly adding or removing users from courses using the Classroom API.
Administrators
Domain administrators are permitted to bypass the invitation flow and directly add students and teachers to a course if the following conditions are met:
- The user being added is part of the administrator's domain.
- The primary teacher of the course, or course owner, is part of the administrator's domain.
For users or courses outside the domain of an administrator, applications must
obtain the user's consent by sending an invitation with the  invitations.create() 
 
method.
Students
Students can add themselves to a course by calling  students.create() 
 
and specifying the enrollmentCode 
of
the course. The enrollmentCode 
is a unique identifier for the course that is
included on the Course 
resource. In the Classroom web
application, the enrollmentCode 
is available in the stream tab and the course
details page.
Teachers
Teachers can't directly add users to a course and must use the  invitations.create() 
 
method to invite students and
other teachers to the course.
The following table describes which user is permitted to make requests to the create 
and delete 
methods for the Teacher 
and Student 
resources.
| Administrator | Teacher | Student | |
|---|---|---|---|
| CreateTeacher | ✔️ | ✖️ | ✖️ | 
| DeleteTeacher | ✔️ | ✔️ | ✖️ | 
| CreateStudent | ✔️ | ✖️ | ✔️ 1 | 
| DeleteStudent | ✔️ | ✔️ | ✔️ 2 | 
1 A student can only add themselves to a course.
2 A student may only delete themselves from a course.
Manage teachers
Domain administrators can directly add teachers within their domain to courses
with  teachers.create() 
 
, as shown in the following sample:
.NET
Java
PHP
Python
Co-teachers can remove other teachers from a course with the  teachers.delete() 
 
method. This only removes the specified
teacher from the course and does not affect their assignment to other courses or
their user profile.
Manage course owners
Domain administrators can transfer ownership of courses between teachers. See the Update the course owner section for important details.
Manage students
Domain administrators can directly add students within their domain with the  students.create() 
 
method. If a student is directly adding
themselves to a course, the enrollmentCode 
is required.
.NET
Java
PHP
Python
Removing a student from a course using the  students.delete() 
 
method only removes them from the
specified course and doesn't affect their enrollment in other courses or their
user profile.
Retrieve a user's courses
To retrieve a list of courses for a student or teacher, call  courses.list() 
 
and supply the corresponding user's studentId 
or teacherId 
.
Retrieve a user's profile
To retrieve the profile for a user, including ID and name, call  userProfiles.get() 
 
with the user's ID, email, or "me" for
the requesting user. To retrieve the emailAddress 
field, you must include the classroom.profile.emails 
scope.
The id 
returned corresponds to the Directory API Users resource 
containing the matching studentId 
or teacherId 
.

