Search + K

Command Palette

Search for a command to run...

Sign In

drive.files.list

GET /files
Copy endpoint
https://www.googleapis.com/drive/v3

Lists the user's files. For more information, see Search for files and folders. This method accepts the q parameter, which is a search query combining one or more search terms. This method returns all files by default, including trashed files. If you don't want trashed files to appear in the list, use the trashed=false query parameter to remove trashed files from the results.

Parameters

query Query Parameters

Name Type
corpora

Bodies of items (files or documents) to which the query applies. Supported bodies are: * user * domain * drive * 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. For more information, see File organization.

string
corpus

Deprecated: The source of files to list. Use corpora instead.

"domain" | "user"
driveId

ID of the shared drive to search.

string
includeItemsFromAllDrives

Whether both My Drive and shared drive items should be included in results.

boolean
includeLabels

A comma-separated list of IDs of labels to include in the labelInfo part of the response.

string
includePermissionsForView

Specifies which additional view's permissions to include in the response. Only published is supported.

string
includeTeamDriveItems

Deprecated: Use includeItemsFromAllDrives instead.

boolean
orderBy

A comma-separated list of sort keys. Valid keys are: * createdTime: When the file was created. * folder: The folder ID. This field is sorted using alphabetical ordering. * modifiedByMeTime: The last time the file was modified by the user. * modifiedTime: The last time the file was modified by anyone. * name: The name of the file. This field is sorted using alphabetical ordering, so 1, 12, 2, 22. * name_natural: The name of the file. This field is sorted using natural sort ordering, so 1, 2, 12, 22. * quotaBytesUsed: The number of storage quota bytes used by the file. * recency: The most recent timestamp from the file's date-time fields. * sharedWithMeTime: When the file was shared with the user, if applicable. * starred: Whether the user has starred the file. * viewedByMeTime: The last time the file was viewed by the user. Each key sorts ascending by default, but can be reversed with the desc modifier. Example usage: ?orderBy=folder,modifiedTime desc,name.

string
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.

number
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.

string
q

A query for filtering the file results. For supported syntax, see Search for files and folders.

string
spaces

A comma-separated list of spaces to query within the corpora. Supported values are drive and appDataFolder. For more information, see File organization.

string
supportsAllDrives

Whether the requesting application supports both My Drives and shared drives.

boolean
supportsTeamDrives

Deprecated: Use supportsAllDrives instead.

boolean
teamDriveId

Deprecated: Use driveId instead.

string
access_token

OAuth access token.

string
alt

Data format for response.

"json" | "media" | "proto"
callback

JSONP

string
fields

Selector specifying which fields to include in a partial response.

string
key

API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.

string
oauth_token

OAuth 2.0 token for the current user.

string
prettyPrint

Returns response with indentations and line breaks.

boolean
quotaUser

Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

string
upload_protocol

Upload protocol for media (e.g. "raw", "multipart").

string
uploadType

Legacy upload protocol for media (e.g. "media", "multipart").

string
$.xgafv

V1 error format.

"1" | "2"

Responses

200 */*

Successful response

interface FileList {
files?: File

The metadata for a file. Some resource methods (such as files.update) require a fileId. Use the files.list method to retrieve the ID for a file.

interface File {
appProperties?: { };
capabilities?: {
canAcceptOwnership?: boolean;
canAddChildren?: boolean;
canAddFolderFromAnotherDrive?: boolean;
canAddMyDriveParent?: boolean;
canChangeCopyRequiresWriterPermission?: boolean;
canChangeItemDownloadRestriction?: boolean;
canChangeSecurityUpdateEnabled?: boolean;
canChangeViewersCanCopyContent?: boolean;
canComment?: boolean;
canCopy?: boolean;
canDelete?: boolean;
canDeleteChildren?: boolean;
canDisableInheritedPermissions?: boolean;
canDownload?: boolean;
canEdit?: boolean;
canEnableInheritedPermissions?: boolean;
canListChildren?: boolean;
canModifyContent?: boolean;
canModifyContentRestriction?: boolean;
canModifyEditorContentRestriction?: boolean;
canModifyLabels?: boolean;
canModifyOwnerContentRestriction?: boolean;
canMoveChildrenOutOfDrive?: boolean;
canMoveChildrenOutOfTeamDrive?: boolean;
canMoveChildrenWithinDrive?: boolean;
canMoveChildrenWithinTeamDrive?: boolean;
canMoveItemIntoTeamDrive?: boolean;
canMoveItemOutOfDrive?: boolean;
canMoveItemOutOfTeamDrive?: boolean;
canMoveItemWithinDrive?: boolean;
canMoveItemWithinTeamDrive?: boolean;
canMoveTeamDriveItem?: boolean;
canReadDrive?: boolean;
canReadLabels?: boolean;
canReadRevisions?: boolean;
canReadTeamDrive?: boolean;
canRemoveChildren?: boolean;
canRemoveContentRestriction?: boolean;
canRemoveMyDriveParent?: boolean;
canRename?: boolean;
canShare?: boolean;
canTrash?: boolean;
canTrashChildren?: boolean;
canUntrash?: boolean;
}
;
contentHints?: { indexableText?: string;thumbnail?: { ... }; };
contentRestrictions?: ContentRestriction[];
copyRequiresWriterPermission?: boolean;
createdTime?: string;
description?: string;
downloadRestrictions?: DownloadRestrictionsMetadata;
driveId?: string;
explicitlyTrashed?: boolean;
exportLinks?: { };
fileExtension?: string;
folderColorRgb?: string;
fullFileExtension?: string;
hasAugmentedPermissions?: boolean;
hasThumbnail?: boolean;
headRevisionId?: string;
iconLink?: string;
id?: string;
imageMediaMetadata?: {
aperture?: number;
cameraMake?: string;
cameraModel?: string;
colorSpace?: string;
exposureBias?: number;
exposureMode?: string;
exposureTime?: number;
flashUsed?: boolean;
focalLength?: number;
height?: number;
isoSpeed?: number;
lens?: string;
location?: { ... };
maxApertureValue?: number;
meteringMode?: string;
rotation?: number;
sensor?: string;
subjectDistance?: number;
time?: string;
whiteBalance?: string;
width?: number;
}
;
inheritedPermissionsDisabled?: boolean;
isAppAuthorized?: boolean;
kind?: string;
labelInfo?: { labels?: Label[]; };
lastModifyingUser?: User;
linkShareMetadata?: { securityUpdateEligible?: boolean;securityUpdateEnabled?: boolean; };
md5Checksum?: string;
mimeType?: string;
modifiedByMe?: boolean;
modifiedByMeTime?: string;
modifiedTime?: string;
name?: string;
originalFilename?: string;
ownedByMe?: boolean;
owners?: User[];
parents?: string[];
permissionIds?: string[];
permissions?: Permission[];
properties?: { };
quotaBytesUsed?: string;
resourceKey?: string;
sha1Checksum?: string;
sha256Checksum?: string;
shared?: boolean;
sharedWithMeTime?: string;
sharingUser?: User;
shortcutDetails?: { targetId?: string;targetMimeType?: string;targetResourceKey?: string; };
size?: string;
spaces?: string[];
starred?: boolean;
teamDriveId?: string;
thumbnailLink?: string;
thumbnailVersion?: string;
trashed?: boolean;
trashedTime?: string;
trashingUser?: User;
version?: string;
videoMediaMetadata?: { durationMillis?: string;height?: number;width?: number; };
viewedByMe?: boolean;
viewedByMeTime?: string;
viewersCanCopyContent?: boolean;
webContentLink?: string;
webViewLink?: string;
writersCanShare?: boolean;
}
[]
;
incompleteSearch?: boolean;
kind?: string;
nextPageToken?: string;
}