Google Classroom add-ons are now generally available to developers! Please see the add-ons documentation for more information.

Google Classroom API error structure

The Classroom API returns error information that can help developers debug issues and provide helpful, actionable information to end users. This guide explains how to parse error information returned from the API.

The Classroom API returns two levels of error information:

  • HTTP error code in the header.
  • An object in the response body with additional details.

Error message structure

Errors returned in the response body include the following fields:

  • code: The numerical HTTP error code. For example, 403.
  • message: Additional details about the error. When available, the error message is prepended with @ and a specific error type. For example, @ClassroomApiDisabled.
  • status: The HTTP request status. For example, PERMISSION_DENIED or NOT_FOUND.

If a request failed with a ClassroomApiDisabled error, the response would be:

{
"error":{
"code":403,
"message":"@ClassroomApiDisabled The user is not permitted to access the Classroom API.",
"status":"PERMISSION_DENIED"
}
}

You can use the response body to help you debug the cause of the error and provide helpful information to users. Include a trailing space when checking for a specific error message to avoid matching other values that start with the same string. In the provided error example, you can check if the message field begins with "@ClassroomApiDisabled " to present appropriate information to users.

Reference the Common errors page for information on some errors that can be returned by the Classroom API.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月13日 UTC.