Resource: 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.
JSON representation |
---|
{ "kind": string, "userPermission": { object ( |
Fields | |
---|---|
kind |
Output only. The type of file. This is always |
userPermission |
Output only. The permissions for the authenticated user on this file. |
fileExtension |
Output only. The final component of |
md5Checksum |
Output only. An MD5 checksum for the content of this file. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
selfLink |
Output only. A link back to this file. |
ownerNames[] |
Output only. Name(s) of the owner(s) of this file. Not populated for items in shared drives. |
lastModifyingUserName |
Output only. Name of the last user to modify this file. |
editable |
Output only. Deprecated: Use |
writersCanShare |
Whether writers can share the document with other users. Not populated for items in shared drives. |
downloadUrl |
Output only. Short lived download URL for the file. This field is only populated for files with content stored in Google Drive; it is not populated for Google Docs or shortcut files. |
mimeType |
The MIME type of the file. This is only mutable on update when uploading new content. This field can be left blank, and the mimetype will be determined from the uploaded content's MIME type. |
exportLinks |
Output only. Links for exporting Docs Editors files to specific formats. An object containing a list of |
driveId |
Output only. ID of the shared drive the file resides in. Only populated for items in shared drives. |
parents[] |
The ID of the parent folder containing the file. A file can only have one parent folder; specifying multiple parents isn't supported. If not specified as part of an insert request, the file is placed directly in the user's My Drive folder. If not specified as part of a copy request, the file inherits any discoverable parent of the source file. files.update requests must use the |
thumbnailLink |
Output only. A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Not intended for direct usage on web applications due to Cross-Origin Resource Sharing (CORS), consider using a proxy server. Only populated when the requesting app can access the file's content. If the file isn't shared publicly, the URL returned in |
appDataContents |
Output only. Whether this file is in the Application Data folder. |
webViewLink |
Output only. A link only available on public folders for viewing their static web assets (HTML, CSS, JS, etc) via Google Drive's Website Hosting. |
iconLink |
Output only. A link to the file's icon. |
shared |
Output only. Whether the file has been shared. Not populated for items in shared drives. |
lastModifyingUser |
Output only. The last user to modify this file. This field is only populated when the last modification was performed by a signed-in user. |
owners[] |
Output only. The owner of this file. Only certain legacy files may have more than one owner. This field isn't populated for items in shared drives. |
openWithLinks |
Output only. A map of the id of each of the user's apps to a link to open this file with that app. Only populated when the drive.apps.readonly scope is used. An object containing a list of |
defaultOpenWithLink |
Output only. A link to open this file with the user's default app for this file. Only populated when the drive.apps.readonly scope is used. |
headRevisionId |
Output only. The ID of the file's head revision. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
properties[] |
The list of properties. |
copyable |
Output only. Deprecated: Use |
etag |
Output only. ETag of the file. |
sharingUser |
Output only. User that shared the item with the current user, if available. |
alternateLink |
Output only. A link for opening the file in a relevant Google editor or viewer. |
embedLink |
Output only. A link for embedding the file. |
webContentLink |
Output only. A link for downloading the content of the file in a browser using cookie based authentication. In cases where the content is shared publicly, the content can be downloaded without any credentials. |
fileSize |
Output only. Size in bytes of blobs and first party editor files. Won't be populated for files that have no size, like shortcuts and folders. |
copyRequiresWriterPermission |
Whether the options to copy, print, or download this file, should be disabled for readers and commenters. |
permissions[] |
Output only. The list of permissions for users with access to this file. Not populated for items in shared drives. |
hasThumbnail |
Output only. Whether this file has a thumbnail. This does not indicate whether the requesting app has access to the thumbnail. To check access, look for the presence of the thumbnailLink field. |
spaces[] |
Output only. The list of spaces which contain the file. Supported values are |
folderColorRgb |
Folder color as an RGB hex string if the file is a folder or a shortcut to a folder. The list of supported colors is available in the folderColorPalette field of the About resource. If an unsupported color is specified, it will be changed to the closest color in the palette. |
id |
The ID of the file. |
title |
The title of this file. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the title is constant. |
description |
A short description of the file. |
labels |
A group of labels for the file. |
labels.viewed |
Whether this file has been viewed by this user. |
labels.restricted |
Output only. Deprecated: Use |
labels.starred |
Whether this file is starred by the user. |
labels.hidden |
Output only. Deprecated. |
labels.trashed |
Whether this file has been trashed. This label applies to all users accessing the file; however, only owners are allowed to see and untrash files. |
labels.modified |
Output only. Whether the file has been modified by this user. |
explicitlyTrashed |
Output only. Whether this file has been explicitly trashed, as opposed to recursively trashed. |
createdDate |
Output only. Create time for this file (formatted RFC 3339 timestamp). |
modifiedDate |
Last time this file was modified by anyone (formatted RFC 3339 timestamp). This is only mutable on update when the setModifiedDate parameter is set. |
modifiedByMeDate |
Output only. Last time this file was modified by the user (formatted RFC 3339 timestamp). Note that setting modifiedDate will also update the modifiedByMe date for the user which set the date. |
lastViewedByMeDate |
Last time this file was viewed by the user (formatted RFC 3339 timestamp). |
markedViewedByMeDate |
Output only. Deprecated. |
sharedWithMeDate |
Output only. Time at which this file was shared with the user (formatted RFC 3339 timestamp). |
quotaBytesUsed |
Output only. The number of quota bytes used by this file. |
version |
Output only. A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the requesting user. |
indexableText |
Indexable text attributes for the file (can only be written) |
indexableText.text |
The text to be indexed for this file. |
originalFilename |
The original filename of the uploaded content if available, or else the original value of the |
ownedByMe |
Output only. Whether the file is owned by the current user. Not populated for items in shared drives. |
canComment |
Output only. Deprecated: Use |
shareable |
Output only. Deprecated: Use |
fullFileExtension |
Output only. The full file extension; extracted from the title. May contain multiple concatenated extensions, such as "tar.gz". Removing an extension from the title does not clear this field; however, changing the extension on the title does update this field. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
isAppAuthorized |
Output only. Whether the file was created or opened by the requesting app. |
teamDriveId |
Output only. Deprecated: Use |
capabilities |
Output only. Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take. |
capabilities.canChangeRestrictedDownload |
Output only. Deprecated. |
capabilities.canMoveChildrenOutOfDrive |
Output only. Whether the current user can move children of this folder outside of the shared drive. This is false when the item is not a folder. Only populated for items in shared drives. |
capabilities.canReadDrive |
Output only. Whether the current user can read the shared drive to which this file belongs. Only populated for items in shared drives. |
capabilities.canEdit |
Output only. Whether the current user can edit this file. Other factors may limit the type of changes a user can make to a file. For example, see |
capabilities.canCopy |
Output only. Whether the current user can copy this file. For an item in a shared drive, whether the current user can copy non-folder descendants of this item, or this item itself if it is not a folder. |
capabilities.canComment |
Output only. Whether the current user can comment on this file. |
capabilities.canAddChildren |
Output only. Whether the current user can add children to this folder. This is always false when the item is not a folder. |
capabilities.canDelete |
Output only. Whether the current user can delete this file. |
capabilities.canDownload |
Output only. Whether the current user can download this file. |
capabilities.canListChildren |
Output only. Whether the current user can list the children of this folder. This is always false when the item is not a folder. |
capabilities.canRemoveChildren |
Output only. Whether the current user can remove children from this folder. This is always false when the item is not a folder. For a folder in a shared drive, use |
capabilities.canRename |
Output only. Whether the current user can rename this file. |
capabilities.canTrash |
Output only. Whether the current user can move this file to trash. |
capabilities.canReadRevisions |
Output only. Whether the current user can read the revisions resource of this file. For a shared drive item, whether revisions of non-folder descendants of this item, or this item itself if it is not a folder, can be read. |
capabilities.canReadTeamDrive |
Output only. Deprecated: Use |
capabilities.canMoveTeamDriveItem |
Output only. Deprecated: Use |
capabilities.canChangeCopyRequiresWriterPermission |
Output only. Whether the current user can change the |
capabilities.canMoveItemIntoTeamDrive |
Output only. Deprecated: Use |
capabilities.canUntrash |
Output only. Whether the current user can restore this file from trash. |
capabilities.canModifyContent |
Output only. Whether the current user can modify the content of this file. |
capabilities.canMoveItemWithinTeamDrive |
Output only. Deprecated: Use |
capabilities.canMoveItemOutOfTeamDrive |
Output only. Deprecated: Use |
capabilities.canDeleteChildren |
Output only. Whether the current user can delete children of this folder. This is false when the item is not a folder. Only populated for items in shared drives. |
capabilities.canMoveChildrenOutOfTeamDrive |
Output only. Deprecated: Use |
capabilities.canMoveChildrenWithinTeamDrive |
Output only. Deprecated: Use |
capabilities.canTrashChildren |
Output only. Whether the current user can trash children of this folder. This is false when the item is not a folder. Only populated for items in shared drives. |
capabilities.canMoveItemOutOfDrive |
Output only. Whether the current user can move this item outside of this drive by changing its parent. Note that a request to change the parent of the item may still fail depending on the new parent that is being added. |
capabilities.canAddMyDriveParent |
Output only. Whether the current user can add a parent for the item without removing an existing parent in the same request. Not populated for shared drive files. |
capabilities.canRemoveMyDriveParent |
Output only. Whether the current user can remove a parent from the item without adding another parent in the same request. Not populated for shared drive files. |
capabilities.canMoveItemWithinDrive |
Output only. Whether the current user can move this item within this drive. Note that a request to change the parent of the item may still fail depending on the new parent that is being added and the parent that is being removed. |
capabilities.canShare |
Output only. Whether the current user can modify the sharing settings for this file. |
capabilities.canMoveChildrenWithinDrive |
Output only. Whether the current user can move children of this folder within this drive. This is false when the item is not a folder. Note that a request to move the child may still fail depending on the current user's access to the child and to the destination folder. |
capabilities.canModifyContentRestriction |
Deprecated: Output only. Use one of |
capabilities.canAddFolderFromAnotherDrive |
Output only. Whether the current user can add a folder from another drive (different shared drive or My Drive) to this folder. This is false when the item is not a folder. Only populated for items in shared drives. |
capabilities.canChangeSecurityUpdateEnabled |
Output only. Whether the current user can change the securityUpdateEnabled field on link share metadata. |
capabilities.canAcceptOwnership |
Output only. Whether the current user is the pending owner of the file. Not populated for shared drive files. |
capabilities.canReadLabels |
Output only. Whether the current user can read the labels on the file. |
capabilities.canModifyLabels |
Output only. Whether the current user can modify the labels on the file. |
capabilities.canModifyEditorContentRestriction |
Output only. Whether the current user can add or modify content restrictions on the file which are editor restricted. |
capabilities.canModifyOwnerContentRestriction |
Output only. Whether the current user can add or modify content restrictions which are owner restricted. |
capabilities.canRemoveContentRestriction |
Output only. Whether there is a content restriction on the file that can be removed by the current user. |
hasAugmentedPermissions |
Output only. Whether there are permissions directly on this file. This field is only populated for items in shared drives. |
trashingUser |
Output only. If the file has been explicitly trashed, the user who trashed it. Only populated for items in shared drives. |
canReadRevisions |
Output only. Deprecated: Use |
thumbnailVersion |
Output only. The thumbnail version for use in thumbnail cache invalidation. |
trashedDate |
Output only. The time that the item was trashed (formatted RFC 3339 timestamp). Only populated for items in shared drives. |
permissionIds[] |
Output only. files.list of permission IDs for users with access to this file. |
thumbnail |
A thumbnail for the file. This will only be used if a standard thumbnail cannot be generated. |
thumbnail.image |
The URL-safe Base64 encoded bytes of the thumbnail image. It should conform to RFC 4648 section 5. A base64-encoded string. |
thumbnail.mimeType |
The MIME type of the thumbnail. |
imageMediaMetadata |
Output only. Metadata about image media. This will only be present for image types, and its contents will depend on what can be parsed from the image content. |
imageMediaMetadata.flashUsed |
Output only. Whether a flash was used to create the photo. |
imageMediaMetadata.meteringMode |
Output only. The metering mode used to create the photo. |
imageMediaMetadata.sensor |
Output only. The type of sensor used to create the photo. |
imageMediaMetadata.exposureMode |
Output only. The exposure mode used to create the photo. |
imageMediaMetadata.colorSpace |
Output only. The color space of the photo. |
imageMediaMetadata.whiteBalance |
Output only. The white balance mode used to create the photo. |
imageMediaMetadata.width |
Output only. The width of the image in pixels. |
imageMediaMetadata.height |
Output only. The height of the image in pixels. |
imageMediaMetadata.location |
Output only. Geographic location information stored in the image. |
imageMediaMetadata.location.latitude |
Output only. The latitude stored in the image. |
imageMediaMetadata.location.longitude |
Output only. The longitude stored in the image. |
imageMediaMetadata.location.altitude |
Output only. The altitude stored in the image. |
imageMediaMetadata.rotation |
Output only. The number of clockwise 90 degree rotations applied from the image's original orientation. |
imageMediaMetadata.date |
Output only. The date and time the photo was taken (EXIF format timestamp). |
imageMediaMetadata.cameraMake |
Output only. The make of the camera used to create the photo. |
imageMediaMetadata.cameraModel |
Output only. The model of the camera used to create the photo. |
imageMediaMetadata.exposureTime |
Output only. The length of the exposure, in seconds. |
imageMediaMetadata.aperture |
Output only. The aperture used to create the photo (f-number). |
imageMediaMetadata.focalLength |
Output only. The focal length used to create the photo, in millimeters. |
imageMediaMetadata.isoSpeed |
Output only. The ISO speed used to create the photo. |
imageMediaMetadata.exposureBias |
Output only. The exposure bias of the photo (APEX value). |
imageMediaMetadata.maxApertureValue |
Output only. The smallest f-number of the lens at the focal length used to create the photo (APEX value). |
imageMediaMetadata.subjectDistance |
Output only. The distance to the subject of the photo, in meters. |
imageMediaMetadata.lens |
Output only. The lens used to create the photo. |
videoMediaMetadata |
Output only. Metadata about video media. This will only be present for video types. |
videoMediaMetadata.width |
Output only. The width of the video in pixels. |
videoMediaMetadata.height |
Output only. The height of the video in pixels. |
videoMediaMetadata.durationMillis |
Output only. The duration of the video in milliseconds. |
shortcutDetails |
Shortcut file details. Only populated for shortcut files, which have the mimeType field set to |
shortcutDetails.targetId |
The ID of the file that this shortcut points to. Can only be set on |
shortcutDetails.targetMimeType |
Output only. The MIME type of the file that this shortcut points to. The value of this field is a snapshot of the target's MIME type, captured when the shortcut is created. |
shortcutDetails.targetResourceKey |
Output only. The ResourceKey for the target file. |
contentRestrictions[] |
Restrictions for accessing the content of the file. Only populated if such a restriction exists. |
resourceKey |
Output only. A key needed to access the item via a shared link. |
linkShareMetadata |
Output only. LinkShare related details. Contains details about the link URLs that clients are using to refer to this item. |
linkShareMetadata.securityUpdateEligible |
Output only. Whether the file is eligible for security update. |
linkShareMetadata.securityUpdateEnabled |
Output only. Whether the security update is enabled for this file. |
labelInfo |
Output only. An overview of the labels on the file. |
labelInfo.labels[] |
Output only. The set of labels on the file as requested by the label IDs in the |
sha1Checksum |
Output only. The SHA1 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
sha256Checksum |
Output only. The SHA256 checksum associated with this file, if available. This field is only populated for files with content stored in Google Drive; it is not populated for Docs Editors or shortcut files. |
ContentRestriction
A restriction for accessing the content of the file.
JSON representation |
---|
{
"readOnly": boolean,
"reason": string,
"type": string,
"restrictingUser": {
object ( |
Fields | |
---|---|
readOnly |
Whether the content of the file is read-only. If a file is read-only, a new revision of the file may not be added, comments may not be added or modified, and the title of the file may not be modified. |
reason |
Reason for why the content of the file is restricted. This is only mutable on requests that also set |
type |
Output only. The type of the content restriction. Currently the only possible value is |
restrictingUser |
Output only. The user who set the content restriction. Only populated if |
restrictionDate |
Output only. The time at which the content restriction was set (formatted RFC 3339 timestamp). Only populated if |
ownerRestricted |
Whether the content restriction can only be modified or removed by a user who owns the file. For files in shared drives, any user with |
systemRestricted |
Output only. Whether the content restriction was applied by the system, for example due to an esignature. Users cannot modify or remove system restricted content restrictions. |
Methods |
|
---|---|
|
Creates a copy of the specified file. |
|
Permanently deletes a file owned by the user without moving it to the trash. |
|
Permanently deletes all of the user's trashed files. |
|
Exports a Google Workspace document to the requested MIME type and returns exported byte content. |
|
Generates a set of file IDs which can be provided in insert or copy requests. |
|
Gets a file's metadata or content by ID. |
|
Inserts a new file. |
|
Lists the user's files. |
|
Lists the labels on a file. |
|
Modifies the set of labels applied to a file. |
|
Updates a file's metadata and/or content. |
|
Set the file's updated time to the current server time. |
|
Moves a file to the trash. |
|
Restores a file from the trash. |
|
Updates a file's metadata and/or content. |
|
Subscribes to changes to a file. |