The Google Drive API returns two levels of error information:
- HTTP error codes and header messages.
- A JSON object in the response body with additional details that can help you determine how to handle the error.
Google Drive apps should catch and handle all errors that might be encountered when using the REST API. This guide provides instructions about how to resolve specific Drive API errors.
HTTP status code summary
| Error code | Description |
|---|---|
200 - OK |
The request is successful (this is the standard response for successful HTTP requests). |
400 - Bad Request |
The request cannot be fulfilled due to a client error in the request. |
401 - Unauthorized |
The request contains invalid credentials. |
403 - Forbidden |
The request was received and understood, but the user doesn't have permission to perform the request. |
404 - Not Found |
The requested page couldn't be found. |
429 - Too Many Requests |
Too many requests to the API. |
500, 502, 503, 504 - Server Errors |
Unexpected error arises while processing the request. |
400 errors
These errors mean that the request was unacceptable, often due to a missing required parameter.
badRequest
This error can occur from any one of the following issues in your code:
- A required field or parameter hasn't been provided.
- The value supplied or a combination of provided fields is invalid.
- You tried to add a duplicate parent to a Drive file.
- You tried to add a parent that would create a cycle in the directory graph.
The following JSON sample is a representation of this error:
{
"error": {
"code"