Enable the Google Classroom API in the Google Cloud Console, configure an OAuth 2.0 credential with the appropriate scopes (e.g., https://www.googleapis.com/auth/classroom.courses.readonly, classroom.coursework.students), and obtain user or service account tokens via the OAuth 2.0 authorization flow.
List courses using GET https://classroom.googleapis.com/v1/courses with query parameters teacherId or studentId to scope results; use pageToken from the nextPageToken field to paginate through all courses.
Retrieve coursework for a course via GET /v1/courses/:courseId/courseWork; each CourseWork object includes id, title, dueDate, maxPoints, and workType (ASSIGNMENT, SHORT_ANSWER_QUESTION, MULTIPLE_CHOICE_QUESTION).
Fetch student submissions via GET /v1/courses/:courseId/courseWork/:courseWorkId/studentSubmissions?userId=me (or a specific userId for domain-wide delegation); the response includes state, assignedGrade, and submissionHistory.
To receive real-time roster or coursework changes without polling, use the Classroom Push Notifications API: register a Pub/Sub topic at GET /v1/registrations and subscribe your service to receive change events.
When writing grades back, PATCH to /v1/courses/:courseId/courseWork/:courseWorkId/studentSubmissions/:id with updateMask=assignedGrade and call the :return action to finalize the submission.
Known gotchas
Google Classroom API requires explicit per-user OAuth consent or G Suite domain-wide delegation configured in the Admin Console; a service account without domain-wide delegation cannot access classroom data and returns a 403 PERMISSION_DENIED error.
The Classroom API does not support direct roster writes for K-12 institutions — students and teachers must be added through the Google Workspace Admin console or via a provisioning mechanism like Google Workspace Admin SDK; the Classroom API enrollments endpoints are read-only in most configurations.
nextPageToken pagination tokens expire after a short period; if processing a large dataset page-by-page, complete the full pagination pass without long pauses between requests to avoid token expiry errors.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp