Lists the user's files.
This method accepts the q
parameter, which is a search query combining one or more search terms. For more information, see the Search for files & folders guide.
HTTP request
GET https://www.googleapis.com/drive/v3/files
The URL uses gRPC Transcoding syntax.
Query parameters
Parameters | |
---|---|
corpora |
Bodies of items (files/documents) to which the query applies. Supported bodies are 'user', 'domain', 'drive', and 'allDrives'. Prefer 'user' or 'drive' to 'allDrives' for efficiency. By default, corpora is set to 'user'. However, this can change depending on the filter set through the 'q' parameter. |
corpus |
Deprecated: The source of files to list. Use 'corpora' instead. |
driveId |
ID of the shared drive to search. |
includeItemsFromAllDrives |
Whether both My Drive and shared drive items should be included in results. |
includeTeamDriveItems |
Deprecated: Use |
orderBy |
A comma-separated list of sort keys. Valid keys are:
Each key sorts ascending by default, but can be reversed with the 'desc' modifier. Example usage: |
pageSize |
The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached. |
pageToken |
The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response. |
q |
A query for filtering the file results. See the "Search for files & folders" guide for supported syntax. |
spaces |
A comma-separated list of spaces to query within the corpora. Supported values are 'drive' and 'appDataFolder'. |
supportsAllDrives |
Whether the requesting application supports both My Drives and shared drives. |
supportsTeamDrives |
Deprecated: Use |
teamDriveId |
Deprecated: Use |
includePermissionsForView |
Specifies which additional view's permissions to include in the response. Only 'published' is supported. |
includeLabels |
A comma-separated list of IDs of labels to include in the |
Request body
The request body must be empty.
Response body
A list of files.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{
"nextPageToken": string,
"kind": string,
"incompleteSearch": boolean,
"files": [
{
object ( |
Fields | |
---|---|
nextPageToken |
The page token for the next page of files. This will be absent if the end of the files list has been reached. If the token is rejected for any reason, it should be discarded, and pagination should be restarted from the first page of results. The page token is typically valid for several hours. However, if new items are added or removed, your expected results might differ. |
kind |
Identifies what kind of resource this is. Value: the fixed string |
incompleteSearch |
Whether the search process was incomplete. If true, then some search results might be missing, since all documents were not searched. This can occur when searching multiple drives with the 'allDrives' corpora, but all corpora couldn't be searched. When this happens, it's suggested that clients narrow their query by choosing a different corpus such as 'user' or 'drive'. |
files[] |
The list of files. If nextPageToken is populated, then this list may be incomplete and an additional page of results should be fetched. |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.meet.readonly
https://www.googleapis.com/auth/drive.metadata
https://www.googleapis.com/auth/drive.metadata.readonly
https://www.googleapis.com/auth/drive.photos.readonly
https://www.googleapis.com/auth/drive.readonly
Some scopes are restricted and require a security assessment for your app to use them. For more information, see the Authorization guide.
Corpus
Enums | |
---|---|
user |
Files owned by or shared to the user. |
domain |
Files shared to the user's domain. |