Files: list

Lists or searches files. Try it now.

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 and Team Drives guide.


HTTP request



Parameter name Value Description
Optional query parameters
corpora string Comma-separated list of bodies of items (files/documents) to which the query applies. Supported bodies are 'user', 'domain', 'teamDrive' and 'allTeamDrives'. 'allTeamDrives' must be combined with 'user'; all other values must be used in isolation. Prefer 'user' or 'teamDrive' to 'allTeamDrives' for efficiency.
corpus string The source of files to list. Deprecated: use 'corpora' instead.

Acceptable values are:
  • "domain": Files shared to the user's domain.
  • "user": Files owned by or shared to the user.
fields string The paths of the fields you want included in the response. If not specified, the response includes a default set of fields specific to this method. For development you can use the special value * to return all fields, but you'll achieve greater performance by only selecting the fields you need. For more information see the partial responses documentation.
includeTeamDriveItems boolean Whether Team Drive items should be included in results. (Default: false)
orderBy string A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.
pageSize integer 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. Acceptable values are 1 to 1000, inclusive. (Default: 100)
pageToken string 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 string A query for filtering the file results. See the "Search for Files and Team Drives" guide for the supported syntax.
spaces string A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.
supportsTeamDrives boolean Whether the requesting application supports Team Drives. (Default: false)
teamDriveId string ID of Team Drive to search.

Request body

Do not supply a request body with this method.


If successful, this method returns a response body with the following structure:

  "kind": "drive#fileList",
  "nextPageToken": string,
  "incompleteSearch": boolean,
  "files": [
    files Resource
Property name Value Description Notes
kind string Identifies what kind of resource this is. Value: the fixed string "drive#fileList".
nextPageToken string 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.
files[] list The list of files. If nextPageToken is populated, then this list may be incomplete and an additional page of results should be fetched.
incompleteSearch boolean Whether the search process was incomplete. If true, then some search results may be missing, since all documents were not searched. This may occur when searching multiple Team Drives with the "user,allTeamDrives" corpora, but all corpora could not be searched. When this happens, it is suggested that clients narrow their query by choosing a different corpus such as "user" or "teamDrive".

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Send feedback about...

Need help? Visit our support page.