The application data folder is a special hidden folder that your app can use to store application-specific data, such as configuration files. The application data folder is automatically created when you attempt to create a file in it. Use this folder to store any files that the user shouldn't directly interact with. This folder is only accessible by your app and its contents are hidden from the user and from other Google Drive apps.
The application data folder is deleted when a user uninstalls your app from their My Drive. Users can also delete your app's data folder manually.
Application data folder scope
Before you can access the application data folder, you must request access to
the https://www.googleapis.com/auth/drive.appdata
non-sensitive scope. For
more information about scopes and how to request access to them, refer to
Choose Google Drive API scopes. For more
information about specific OAuth 2.0 scopes, see OAuth 2.0 Scopes for Google
APIs.
How the application data folder differs from Drive backup folders
The application data folder is separate from your Drive backup folder.
The application data folder is a configuration folder that's created per
third-party app and each third-party app can store data in it. Only the
application that created the data in the appDataFolder
can access it. The
folder can't be accessed using the Drive user interface (UI).
Your Drive backup folder is a reserved folder that Drive writes device backups to and it's visible in the Drive UI.
Constraints on the application data folder
The following constraints are enforced when working with the application data folder:
You can't share files or folders inside the application data folder. Attempting to do so generates a
notSupportedForAppDataFolderFiles
error with the following error message: "Method not supported for files within the Application Data folder."You can't move files in the
appDataFolder
between storage locations (spaces). Attempting to do so generates anotSupportedForAppDataFolderFiles
error with the following error message: "Method not supported for files within the Application Data folder." For more information, see File organization.You can't trash files or folders inside the application data folder. Attempting to do so generates a
notSupportedForAppDataFolderFiles
error with the following error message: "Files within the Application Data folder cannot be trashed."
Create a file in the application data folder
To create a file in the application data folder, specify appDataFolder
in the
parents
property of the file and use the
files.create
method to create the file in
the folder.
The following code sample shows how to insert a file into a folder using a client library and a curl command.
Request:
curl --request POST \
'https://content.googleapis.com/drive/v3/files' \
-H 'authorization: Bearer ACCESS_TOKEN ' \
-H 'content-type: application/json' \
-H 'x-origin: https://explorer.apis.google.com' \
--data-raw '{"name": "config.json", "parents":["appDataFolder"]}'
Replace ACCESS_TOKEN with your app's OAuth 2.0 token.
Response:
{
"kind": "drive#file",
"id": FILE_ID ,
"name": "config.json",
"mimeType": "application/json"
}
For further information on creating files in folders, refer to Create and populate folders.
Search for files in the application data folder
To search for files in the application data folder, set the spaces
field to
appDataFolder
and use the files.list
method.
The following code sample shows how to search for files in the application data folder using a client library and a curl command.
Request:
curl \
-X GET \
-H "Authorization: Bearer ACCESS_TOKEN " \
"https://www.googleapis.com/drive/v3/files?spaces=appDataFolder&fields=files(id,name,mimeType,size,modifiedTime)"
Replace ACCESS_TOKEN with your app's OAuth 2.0 token.
Response:
{
"files": [
{
"mimeType": "application/json",
"size": "256",
"id": FILE_ID ,
"name": "config.json",
"modifiedTime": "2025-04-03T23:40:05.860Z"
},
{
"mimeType": "text/plain",
"size": "128",
"id": FILE_ID ,
"name": "user_settings.txt",
"modifiedTime": "2025-04-02T17:52:29.020Z"
}
]
}
Download files from the application data folder
To download a file from the application data folder, use the files.get
method with the alt=media
URL parameter to
retrieve the file contents in the response body. For more information, and to
view code samples, go to Download blob file
content.
The following code sample shows how to download files in the application data folder using a curl command. The response body will vary depending on what's saved.
Request:
curl \
-X GET \
-H "Authorization: Bearer ACCESS_TOKEN " \
"https://www.googleapis.com/drive/v3/files/FILE_ID ?alt=media"
Replace the following:
- ACCESS_TOKEN: Your app's OAuth 2.0 token.
- FILE_ID: The ID of the file you want to download.