The Drive API helps you manage my drive, collaborative drives, and team/group folders.
To use the Drive API, you need an access token that you can get by authenticating with a user account, not a service account. Available API operations may vary depending on your pricing plan.
The API scopes are as follows:
file or file.read : All Drive API operations are available.group.folder or group.folder.read : Only the Drive API operations associated with Team/Group Folder are available.There are separate groups of Drive API operations for my drive, collaborative drives, and team/group folders, but you can use them in a similar way. Different API operations are available for each drive type: API operations to manage permission are not available for my drive, while API operations to create and delete a drive are available only for collaborative drives.
For both drive types, different API operations are available to upload files, get files, and create folders for the root folder and the rest of the folders.
To access a folder or file in a drive, you need to first get files of the root folder to get its ID and use it to make an API call based on the folder hierarchy. If you already know the parameter required to access a file or folder, such as sharedriveId and fileId, you can access it right away.
No preparation is required to use my drive.
You can check the usage of my drive using the Drive API.
A member has only one "my drive," so there are no API operations to get drives and to manage permissions.
| HTTP request | Description |
|---|---|
| GET /users/{userId}/drive | My drive - Get properties |
You can manage collaborative drives on the desktop or mobile app as well as through the following API operations.
| HTTP request | Description |
|---|---|
| POST /sharedrives | Create a collaborative drive |
| GET /sharedrives | Get collaborative drives |
| GET /sharedrives/{sharedriveId} | Get a collaborative drive |
| PATCH /sharedrives/{sharedriveId} | Update a collaborative drive |
| DELETE /sharedrives/{sharedriveId} | Delete a collaborative drive |
A team/group folder is part of the team and group features. You can enable or disable this feature using the useFolder property of the API operation that manages teams or groups.
Managing teams requires the orgunit or directory scope, and managing groups requires the group or directory scope.
| HTTP request | Description |
|---|---|
| POST /orgunits | Add a team |
| PUT /orgunits/{orgUnitId} | Update a team |
| PATCH /orgunits/{orgUnitId} | Update part of a team |
| HTTP request | Description |
|---|---|
| POST /groups | Add a group |
| PUT /groups/{groupId} | Update a group |
| PATCH /groups/{groupId} | Update part of a group |
Use the following API operation to check the usage of team/group folders.
You can access a team/group folder by specifying orgUnitId or groupId, as there is no team/group folder ID.
| HTTP request | Description |
|---|---|
| GET /groups/{groupId}/folder | Team/group - Get folder properties |
To use a team/group folder after enabling it using useFolder, you need to create a folder using the following API operation.
| HTTP request | Description |
|---|---|
| POST /groups/{groupId}/folder | Team/group folder - Create a folder |
Even if you disable the team/group folder using useFolder, the folder data will remain unchanged. To actually delete the folder data, you need to use the following API operation.
| HTTP request | Description |
|---|---|
| DELETE /groups/{groupId}/folder | Team/group - Delete a folder |
You can manage folders shared by me on the desktop or mobile app as well as through the following API operations.
| HTTP request | Description |
|---|---|
| GET /users/{userId}/drive/files/{fileId}/share | Get folder sharing |
| POST /users/{userId}/drive/files/{fileId}/share | Share a folder |
| PATCH /users/{userId}/drive/files/{fileId}/share | Update folder sharing |
| DELETE /users/{userId}/drive/files/{fileId}/share | Unshare a folder |
| GET /users/{userId}/drive/files/{fileId}/share-sub-folders | Get collaborative subfolders |
You can manage folders shared with me on the desktop or mobile app as well as through the following API operations.
| HTTP request | Description |
|---|---|
| GET /users/{userId}/drive/sharedfolders | Get shared folders |
| DELETE /users/{userId}/drive/sharedfolders/{sharedFolderId} | Delete a shared folder |
| GET /users/{userId}/drive/sharedfolders/{sharedFolderId} | Get a shared folder |
You can manage collaborative drive permissions using the following API operations.
| HTTP request | Description |
|---|---|
| GET /sharedrives/{sharedriveId}/permissions | Get collaborative drive permissions |
| POST /sharedrives/{sharedriveId}/permissions | Create a collaborative drive permission |
| GET /sharedrives/{sharedriveId}/permissions/{permissionId} | Get a collaborative drive permission |
| PATCH /sharedrives/{sharedriveId}/permissions/{permissionId} | Update a collaborative drive permission |
| DELETE /sharedrives/{sharedriveId}/permissions/{permissionId} | Remove a collaborative drive permission |
| DELETE /sharedrives/{sharedriveId}/permissions | Remove all collaborative drive permissions |
| POST /sharedrives/{sharedriveId}/permissions/enable | Collaborative drive - Enable access permission |
| POST /sharedrives/{sharedriveId}/permissions/disable | Collaborative drive - Disable access permission |
You can upload files to the root folder, get files, and create a folder using the following API operations.
You can manage the root folder of my drive using the following API operations.
| HTTP request | Description |
|---|---|
| POST /users/{userId}/drive/files | My drive - Create a file upload URL (root) |
| GET /users/{userId}/drive/files | My drive - Get root files |
| POST /users/{userId}/drive/files/createfolder | My drive - Create a folder in the root |
You can manage the root folder of a collaborative drive using the following API operations.
| HTTP request | Description |
|---|---|
| POST /sharedrives/{sharedriveId}/files | Collaborative drive - Create a file upload URL (root) |
| GET /sharedrives/{sharedriveId}/files | Collaborative drive - Get root files |
| POST /sharedrives/{sharedriveId}/files/createfolder | Collaborative drive - Create a folder in the root |
You can manage the root folder of a team/group folder using the following API operations.
| HTTP request | Description |
|---|---|
| POST /groups/{groupId}/folder/files | Team/group folder - Create a file upload URL (root) |
| GET /groups/{groupId}/folder/files | Team/group folder - Get root files |
| POST /groups/{groupId}/folder/files/createfolder | Team/group folder - Create a folder in the root |
You can manage the root folder of a folder shared with me using the following API operations.
| HTTP request | Description |
|---|---|
| POST /users/{userId}/drive/sharedfolders/{sharedFolderId}/files | Shared folder - Create a root file upload URL (root) |
| GET /users/{userId}/drive/sharedfolders/{sharedFolderId}/files | Shared folder - Get root files |
| POST /users/{userId}/drive/sharedfolders/{sharedFolderId}/files/createfolder | Shared folder - Create a folder in the root |
For how to upload or download a file, see Upload or Download Files. You can lock or unlock a file to restrict editing.
You can manage files and folders in my drive using the following API operations.
| HTTP request | Description |
|---|---|
| GET /users/{userId}/drive/files/{fileId}/children | My drive - Get files |
| GET /users/{userId}/drive/files/{fileId} | My drive - Get file properties |
| DELETE /users/{userId}/drive/files/{fileId} | My drive - Delete a file |
| POST /users/{userId}/drive/files/{fileId}/createfolder | My drive - Create a folder |
| POST /users/{userId}/drive/files/{fileId}/copy | My drive - Copy a file |
| POST /users/{userId}/drive/files/{fileId}/rename | My drive - Rename a file |
| POST /users/{userId}/drive/files/{fileId}/move | My drive - Move a file |
| POST /users/{userId}/drive/files/{fileId}/protect | My drive - Mark a file as Important |
| POST /users/{userId}/drive/files/{fileId}/unprotect | My drive - Unmark an important file |
| POST /users/{userId}/drive/files/{fileId}/lock | My drive - Lock a file |
| POST /users/{userId}/drive/files/{fileId}/unlock | My drive - Unlock a file |
| POST /users/{userId}/drive/files/{fileId} | My drive - Create a file upload URL |
| GET /users/{userId}/drive/files/{fileId}/download | My drive - Download a file |
Manage files and folders in a collaborative drive using the following API operations.
You can manage files and folders in a team/group folder using the following API operations.
You can manage files and folders in a folder shared with me using the following API operations.
For collaborative drives and team/group folder, API operations for managing folder access permissions are available.
A folder basically inherits the permissions of its parent folder, but you can use the Enable folder access permissions API operation to set different permissions than the parent folder.
You can grant a member, team, and group access permissions using the Create a folder access permission API operation. The access permissions include READ and WRITE permissions.
You can get users who can access a folder and their permissions using the Get folder access permissions API operation. The permission of a user (member, team, and group) is assigned a permissionId.
You can remove a user's permission using the Remove a folder access permission API operation with the permissionId specified, or you can change it using the Update a folder access permission API operation.
To inherit the permissions of the parent folder, use the Disable folder access permission API operation.
You can allow only the collaborative drive or team/group master to access the folder using the Remove a folder access permission API operation.
Note
- Note that you cannot manage my drive permissions using the API.
You can manage folder access permissions of a collaborative drive using the following API operations.
| HTTP request | Description |
|---|---|
| POST /sharedrives/{sharedriveId}/files/{fileId}/permissions | Collaborative drive - Create a folder access permission |
| GET /sharedrives/{sharedriveId}/files/{fileId}/permissions | Collaborative drive - Get folder access permissions |
| GET /sharedrives/{sharedriveId}/files/{fileId}/permissions/{permissionId} | Collaborative drive - Get a folder access permission |
| PATCH /sharedrives/{sharedriveId}/files/{fileId}/permissions/{permissionId} | Collaborative drive - Update a folder access permission |
| DELETE /sharedrives/{sharedriveId}/files/{fileId}/permissions/{permissionId} | Collaborative drive - Remove a folder access permission |
| DELETE /sharedrives/{sharedriveId}/files/{fileId}/permissions | Collaborative drive - Remove all folder access permissions |
| POST /sharedrives/{sharedriveId}/files/{fileId}/permissions/enable | Collaborative drive - Enable folder access permissions |
| POST /sharedrives/{sharedriveId}/files/{fileId}/permissions/disable | Collaborative drive - Disable folder access permissions |
You can manage folder access permissions of a team/group using the following API operations.
| HTTP request | Description |
|---|---|
| POST /groups/{groupId}/folder/files/{fileId}/permissions | Team/group - Create a folder access permission |
| GET /groups/{groupId}/folder/files/{fileId}/permissions | Team/group - Get folder access permissions |
| GET /groups/{groupId}/folder/files/{fileId}/permissions/{permissionId} | Team/group - Get a folder access permission |
| PATCH /groups/{groupId}/folder/files/{fileId}/permissions/{permissionId} | Team/group - Update a folder access permission |
| DELETE /groups/{groupId}/folder/files/{fileId}/permissions/{permissionId} | Team/group - Remove a folder access permission |
| DELETE /groups/{groupId}/folder/files/{fileId}/permissions | Team/group - Remove all folder access permissions |
| POST /groups/{groupId}/folder/files/{fileId}/permissions/enable | Team/group - Enable folder access permissions |
| POST /groups/{groupId}/folder/files/{fileId}/permissions/disable | Team/group - Disable folder access permissions |
You can manage access permissions of a folder shared with me using the following API operation.
| HTTP request | Description |
|---|---|
| POST /users/{userId}/drive/sharedfolders/{sharedFolderId}/members | Shared folder - Get members |
You can use file revisions to check whether a file is updated or overwritten, and restore or download a previous file revision.
You can manage file revisions in my drive using the following API operations.
| HTTP request | Description |
|---|---|
| GET /users/{userId}/drive/files/{fileId}/revisions | My drive - Get file revisions |
| GET /users/{userId}/drive/files/{fileId}/revisions/{revisionId} | My drive - Get file revision properties |
| POST /users/{userId}/drive/files/{fileId}/revisions/{revisionId}/restore | My drive - Restore to a file revision |
| GET /users/{userId}/drive/files/{fileId}/revisions/{revisionId}/download | My drive - Download a file revision |
You can manage file revisions in a collaborative drive using the following API operations.
| HTTP request | Description |
|---|---|
| GET /sharedrives/{sharedriveId}/files/{fileId}/revisions | Collaborative drive - Get file revisions |
| GET /sharedrives/{sharedriveId}/files/{fileId}/revisions/{revisionId} | Collaborative drive - Get file revision properties |
| POST /sharedrives/{sharedriveId}/files/{fileId}/revisions/{revisionId}/restore | Collaborative drive - Restore to a file revision |
| GET /sharedrives/{sharedriveId}/files/{fileId}/revisions/{revisionId}/download | Collaborative drive - Download a file revision |
You can manage file revisions in a team/group folder using the following API operations.
| HTTP request | Description |
|---|---|
| GET /groups/{groupId}/folder/files/{fileId}/revisions | Team/group - Get file revisions |
| GET /groups/{groupId}/folder/files/{fileId}/revisions/{revisionId} | Team/group - Get file revision properties |
| POST /groups/{groupId}/folder/files/{fileId}/revisions/{revisionId}/restore | Team/group - Restore to a file revision |
| GET /groups/{groupId}/folder/files/{fileId}/revisions/{revisionId}/download | Team/group - Download a file revision |
You can manage file revisions in a folder shared with me using the following API operations.
| HTTP request | Description |
|---|---|
| GET /users/{userId}/drive/sharedfolders/{sharedFolderId}/files/{fileId}/revisions | Shared folder - Get file revisions |
| GET /users/{userId}/drive/sharedfolders/{sharedFolderId}/files/{fileId}/revisions/{revisionId} | Shared folder - Get file revision properties |
| POST /users/{userId}/drive/sharedfolders/{sharedFolderId}/files/{fileId}/revisions/{revisionId}/restore | Shared folder - Restore to a file revision |
| GET /users/{userId}/drive/sharedfolders/{sharedFolderId}/files/{fileId}/revisions/{revisionId}/download | Shared folder - Download a file revision |
You can share a file or folder through a link.
| HTTP request | Description |
|---|---|
| GET /users/{userId}/drive/link-setting | My drive - Get link settings |
| GET /users/{userId}/drive/files/{fileId}/link | My drive - Get file link properties |
| POST /users/{userId}/drive/files/{fileId}/link | My drive - Create a file link |
| PATCH /users/{userId}/drive/files/{fileId}/link | My drive - Update a file link |
| DELETE /users/{userId}/drive/files/{fileId}/link | My drive - Delete a file link |
| HTTP request | Description |
|---|---|
| GET /sharedrives/{sharedriveId}/link-setting | Collaborative drive - Get link settings |
| GET /sharedrives/{sharedriveId}/files/{fileId}/link | Collaborative drive - Get file link properties |
| POST /sharedrives/{sharedriveId}/files/{fileId}/link | Collaborative drive - Create a file link |
| PATCH /sharedrives/{sharedriveId}/files/{fileId}/link | Collaborative drive - Update a file link |
| DELETE /sharedrives/{sharedriveId}/files/{fileId}/link | Collaborative drive - Delete a file link |
| HTTP request | Description |
|---|---|
| GET /groups/{groupId}/folder/link-setting | Team/group folder - Get link settings |
| GET /groups/{groupId}/folder/files/{fileId}/link | Team/group folder - Get file link properties |
| POST /groups/{groupId}/folder/files/{fileId}/link | Team/group folder - Create a file link |
| PATCH /groups/{groupId}/folder/files/{fileId}/link | Team/group folder - Update a file link |
| DELETE /groups/{groupId}/folder/files/{fileId}/link | Team/group folder - Delete a file link |
| HTTP request | Description |
|---|---|
| GET /users/{userId}/drive/sharedfolders/{sharedFolderId}/link-setting | Shared folder - Get link settings |
| GET /users/{userId}/drive/sharedfolders/{sharedFolderId}/files/{fileId}/link | Shared folder - Get file link properties |
| POST /users/{userId}/drive/sharedfolders/{sharedFolderId}/files/{fileId}/link | Shared folder - Create a file link |
| PATCH /users/{userId}/drive/sharedfolders/{sharedFolderId}/files/{fileId}/link | Shared folder - Update a file link |
| DELETE /users/{userId}/drive/sharedfolders/{sharedFolderId}/files/{fileId}/link | Shared folder - Delete a file link |
A file deleted by a user is moved to the trash and then permanently deleted after the retention period specified by the administrator.
You can delete or restore files in the trash using the following API operations.
You can manage trashed files in my drive using the following API operations.
| HTTP request | Description |
|---|---|
| GET /users/{userId}/drive/trash-files | My drive - Get trashed files |
| POST /users/{userId}/drive/trash-files/{trashFileId}/restore | My drive - Restore a trashed file |
| DELETE /users/{userId}/drive/trash-files/{trashFileId} | My drive - Delete a trashed file |
You can manage trashed files in a collaborative drive using the following API operations.
| HTTP request | Description |
|---|---|
| GET /sharedrives/{sharedriveId}/trash-files | Collaborative drive - Get trashed files |
| POST /sharedrives/{sharedriveId}/trash-files/{trashFileId}/restore | Collaborative drive - Restore a trashed file |
| DELETE /sharedrives/{sharedriveId}/trash-files/{trashFileId} | Collaborative drive - Delete a trashed file |
You can manage trashed files in a team/group folder using the following API operations.
| HTTP request | Description |
|---|---|
| GET /groups/{groupId}/folder/trash-files | Team/group - Get trashed files |
| POST /groups/{groupId}/folder/trash-files/{trashFileId}/restore | Team/group - Restore a trashed file |
| DELETE /groups/{groupId}/folder/trash-files/{trashFileId} | Team/group - Delete a trashed file |