For a list of methods for this resource, see the end of this page.
Resource representations
The metadata for a file.
{ "kind": "drive#file", "id": string, "name": string, "mimeType": string, "description": string, "starred": boolean, "trashed": boolean, "explicitlyTrashed": boolean, "trashingUser": { "kind": "drive#user", "displayName": string, "photoLink": string, "me": boolean, "permissionId": string, "emailAddress": string }, "trashedTime": datetime, "parents": [ string ], "properties": { (key): string }, "appProperties": { (key): string }, "spaces": [ string ], "version": long, "webContentLink": string, "webViewLink": string, "iconLink": string, "hasThumbnail": boolean, "thumbnailLink": string, "thumbnailVersion": long, "viewedByMe": boolean, "viewedByMeTime": datetime, "createdTime": datetime, "modifiedTime": datetime, "modifiedByMeTime": datetime, "modifiedByMe": boolean, "sharedWithMeTime": datetime, "sharingUser": { "kind": "drive#user", "displayName": string, "photoLink": string, "me": boolean, "permissionId": string, "emailAddress": string }, "owners": [ { "kind": "drive#user", "displayName": string, "photoLink": string, "me": boolean, "permissionId": string, "emailAddress": string } ], "teamDriveId": string, "driveId": string, "lastModifyingUser": { "kind": "drive#user", "displayName": string, "photoLink": string, "me": boolean, "permissionId": string, "emailAddress": string }, "shared": boolean, "ownedByMe": boolean, "capabilities": { "canAddChildren": boolean, "canChangeCopyRequiresWriterPermission": boolean, "canChangeViewersCanCopyContent": boolean, "canComment": boolean, "canCopy": boolean, "canDelete": boolean, "canDeleteChildren": boolean, "canDownload": boolean, "canEdit": boolean, "canListChildren": boolean, "canModifyContent": boolean, "canMoveChildrenOutOfTeamDrive": boolean, "canMoveChildrenOutOfDrive": boolean, "canMoveChildrenWithinTeamDrive": boolean, "canMoveChildrenWithinDrive": boolean, "canMoveItemIntoTeamDrive": boolean, "canMoveItemOutOfTeamDrive": boolean, "canMoveItemOutOfDrive": boolean, "canMoveItemWithinTeamDrive": boolean, "canMoveItemWithinDrive": boolean, "canMoveTeamDriveItem": boolean, "canReadRevisions": boolean, "canReadTeamDrive": boolean, "canReadDrive": boolean, "canRemoveChildren": boolean, "canRename": boolean, "canShare": boolean, "canTrash": boolean, "canTrashChildren": boolean, "canUntrash": boolean }, "viewersCanCopyContent": boolean, "copyRequiresWriterPermission": boolean, "writersCanShare": boolean, "permissions": [ permissions Resource ], "permissionIds": [ string ], "hasAugmentedPermissions": boolean, "folderColorRgb": string, "originalFilename": string, "fullFileExtension": string, "fileExtension": string, "md5Checksum": string, "size": long, "quotaBytesUsed": long, "headRevisionId": string, "contentHints": { "thumbnail": { "image": bytes, "mimeType": string }, "indexableText": string }, "imageMediaMetadata": { "width": integer, "height": integer, "rotation": integer, "location": { "latitude": double, "longitude": double, "altitude": double }, "time": string, "cameraMake": string, "cameraModel": string, "exposureTime": float, "aperture": float, "flashUsed": boolean, "focalLength": float, "isoSpeed": integer, "meteringMode": string, "sensor": string, "exposureMode": string, "colorSpace": string, "whiteBalance": string, "exposureBias": float, "maxApertureValue": float, "subjectDistance": integer, "lens": string }, "videoMediaMetadata": { "width": integer, "height": integer, "durationMillis": long }, "isAppAuthorized": boolean, "exportLinks": { (key): string } }
Property name | Value | Description | Notes |
---|---|---|---|
kind |
string |
Identifies what kind of resource this is. Value: the fixed string "drive#file" . |
|
id |
string |
The ID of the file. | writable |
name |
string |
The name of the file. This is not necessarily unique within a folder. Note that for immutable items such as the top level folders of shared drives, My Drive root folder, and Application Data folder the name is constant. | writable |
mimeType |
string |
The MIME type of the file. Google Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded. If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource. |
writable |
description |
string |
A short description of the file. | writable |
starred |
boolean |
Whether the user has starred the file. | writable |
trashed |
boolean |
Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash. | writable |
explicitlyTrashed |
boolean |
Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder. | |
parents[] |
list |
The IDs of the parent folders which contain the file. If not specified as part of a create request, the file will be placed directly in the user's My Drive folder. If not specified as part of a copy request, the file will inherit any discoverable parents of the source file. Update requests must use the |
writable |
properties |
object |
A collection of arbitrary key-value pairs which are visible to all apps. Entries with null values are cleared in update and copy requests. |
writable |
properties.(key) |
string |
||
appProperties |
object |
A collection of arbitrary key-value pairs which are private to the requesting app. Entries with null values are cleared in update and copy requests. |
writable |
appProperties.(key) |
string |
||
spaces[] |
list |
The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'. | |
version |
long |
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 user. | |
webContentLink |
string |
A link for downloading the content of the file in a browser. This is only available for files with binary content in Google Drive. | |
webViewLink |
string |
A link for opening the file in a relevant Google editor or viewer in a browser. | |
iconLink |
string |
A static, unauthenticated link to the file's icon. | |
thumbnailLink |
string |
A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours. Only populated when the requesting app can access the file's content. | |
viewedByMe |
boolean |
Whether the file has been viewed by this user. | |
viewedByMeTime |
datetime |
The last time the file was viewed by the user (RFC 3339 date-time). | writable |
createdTime |
datetime |
The time at which the file was created (RFC 3339 date-time). | writable |
modifiedTime |
datetime |
The last time the file was modified by anyone (RFC 3339 date-time). Note that setting modifiedTime will also update modifiedByMeTime for the user. |
writable |
modifiedByMeTime |
datetime |
The last time the file was modified by the user (RFC 3339 date-time). | |
sharedWithMeTime |
datetime |
The time at which the file was shared with the user, if applicable (RFC 3339 date-time). | |
sharingUser |
nested object |
The user who shared the file with the requesting user, if applicable. | |
sharingUser.kind |
string |
Identifies what kind of resource this is. Value: the fixed string "drive#user" . |
|
sharingUser.displayName |
string |
A plain text displayable name for this user. | |
sharingUser.photoLink |
string |
A link to the user's profile photo, if available. | |
sharingUser.me |
boolean |
Whether this user is the requesting user. | |
sharingUser.permissionId |
string |
The user's ID as visible in Permission resources. | |
sharingUser.emailAddress |
string |
The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester. | |
owners[] |
list |
The owners of the file. Currently, only certain legacy files may have more than one owner. Not populated for items in shared drives. | |
owners[].kind |
string |
Identifies what kind of resource this is. Value: the fixed string "drive#user" . |
|
owners[].displayName |
string |
A plain text displayable name for this user. | |
owners[].photoLink |
string |
A link to the user's profile photo, if available. | |
owners[].me |
boolean |
Whether this user is the requesting user. | |
owners[].permissionId |
string |
The user's ID as visible in Permission resources. | |
owners[].emailAddress |
string |
The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester. | |
lastModifyingUser |
nested object |
The last user to modify the file. | |
lastModifyingUser.kind |
string |
Identifies what kind of resource this is. Value: the fixed string "drive#user" . |
|
lastModifyingUser.displayName |
string |
A plain text displayable name for this user. | |
lastModifyingUser.photoLink |
string |
A link to the user's profile photo, if available. | |
lastModifyingUser.me |
boolean |
Whether this user is the requesting user. | |
lastModifyingUser.permissionId |
string |
The user's ID as visible in Permission resources. | |
lastModifyingUser.emailAddress |
string |
The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester. | |
shared |
boolean |
Whether the file has been shared. Not populated for items in shared drives. | |
ownedByMe |
boolean |
Whether the user owns the file. Not populated for items in shared drives. | |
viewersCanCopyContent |
boolean |
Deprecated - use copyRequiresWriterPermission instead. |
|
writersCanShare |
boolean |
Whether users with only writer permission can modify the file's permissions. Not populated for items in shared drives. |
writable |
permissions[] |
list |
The full list of permissions for the file. This is only available if the requesting user can share the file. Not populated for items in shared drives. | |
folderColorRgb |
string |
The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource. If an unsupported color is specified, the closest color in the palette will be used instead. |
writable |
originalFilename |
string |
The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Google Drive. |
writable |
fullFileExtension |
string |
The full file extension extracted from the name field. May contain multiple concatenated extensions, such as "tar.gz". This is only available for files with binary content in Google Drive. This is automatically updated when the |
|
fileExtension |
string |
The final component of fullFileExtension . This is only available for files with binary content in Google Drive. |
|
md5Checksum |
string |
The MD5 checksum for the content of the file. This is only applicable to files with binary content in Google Drive. | |
size |
long |
The size of the file's content in bytes. This is only applicable to files with binary content in Google Drive. | |
quotaBytesUsed |
long |
The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled. |
|
headRevisionId |
string |
The ID of the file's head revision. This is currently only available for files with binary content in Google Drive. | |
contentHints |
object |
Additional information about the content of the file. These fields are never populated in responses. | |
contentHints.thumbnail |
object |
A thumbnail for the file. This will only be used if Google Drive cannot generate a standard thumbnail. | |
contentHints.thumbnail.image |
bytes |
The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5). | writable |
contentHints.thumbnail.mimeType |
string |
The MIME type of the thumbnail. | writable |
contentHints.indexableText |
string |
Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements. | writable |
imageMediaMetadata |
object |
Additional metadata about image media, if available. | |
imageMediaMetadata.width |
integer |
The width of the image in pixels. | |
imageMediaMetadata.height |
integer |
The height of the image in pixels. | |
imageMediaMetadata.rotation |
integer |
The rotation in clockwise degrees from the image's original orientation. | |
imageMediaMetadata.location |
object |
Geographic location information stored in the image. | |
imageMediaMetadata.location.latitude |
double |
The latitude stored in the image. | |
imageMediaMetadata.location.longitude |
double |
The longitude stored in the image. | |
imageMediaMetadata.location.altitude |
double |
The altitude stored in the image. | |
imageMediaMetadata.time |
string |
The date and time the photo was taken (EXIF DateTime). | |
imageMediaMetadata.cameraMake |
string |
The make of the camera used to create the photo. | |
imageMediaMetadata.cameraModel |
string |
The model of the camera used to create the photo. | |
imageMediaMetadata.exposureTime |
float |
The length of the exposure, in seconds. | |
imageMediaMetadata.aperture |
float |
The aperture used to create the photo (f-number). | |
imageMediaMetadata.flashUsed |
boolean |
Whether a flash was used to create the photo. | |
imageMediaMetadata.focalLength |
float |
The focal length used to create the photo, in millimeters. | |
imageMediaMetadata.isoSpeed |
integer |
The ISO speed used to create the photo. | |
imageMediaMetadata.meteringMode |
string |
The metering mode used to create the photo. | |
imageMediaMetadata.sensor |
string |
The type of sensor used to create the photo. | |
imageMediaMetadata.exposureMode |
string |
The exposure mode used to create the photo. | |
imageMediaMetadata.colorSpace |
string |
The color space of the photo. | |
imageMediaMetadata.whiteBalance |
string |
The white balance mode used to create the photo. | |
imageMediaMetadata.exposureBias |
float |
The exposure bias of the photo (APEX value). | |
imageMediaMetadata.maxApertureValue |
float |
The smallest f-number of the lens at the focal length used to create the photo (APEX value). | |
imageMediaMetadata.subjectDistance |
integer |
The distance to the subject of the photo, in meters. | |
imageMediaMetadata.lens |
string |
The lens used to create the photo. | |
videoMediaMetadata |
object |
Additional metadata about video media. This may not be available immediately upon upload. | |
videoMediaMetadata.width |
integer |
The width of the video in pixels. | |
videoMediaMetadata.height |
integer |
The height of the video in pixels. | |
videoMediaMetadata.durationMillis |
long |
The duration of the video in milliseconds. | |
capabilities |
object |
Capabilities the current user has on this file. Each capability corresponds to a fine-grained action that a user may take. | |
capabilities.canEdit |
boolean |
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 canChangeCopyRequiresWriterPermission or canModifyContent . |
|
capabilities.canComment |
boolean |
Whether the current user can comment on this file. | |
capabilities.canShare |
boolean |
Whether the current user can modify the sharing settings for this file. | |
capabilities.canCopy |
boolean |
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.canReadRevisions |
boolean |
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. | |
isAppAuthorized |
boolean |
Whether the file was created or opened by the requesting app. | |
hasThumbnail |
boolean |
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. | |
thumbnailVersion |
long |
The thumbnail version for use in thumbnail cache invalidation. | |
modifiedByMe |
boolean |
Whether the file has been modified by this user. | |
trashingUser |
nested object |
If the file has been explicitly trashed, the user who trashed it. Only populated for items in shared drives. | |
trashingUser.kind |
string |
Identifies what kind of resource this is. Value: the fixed string "drive#user" . |
|
trashingUser.displayName |
string |
A plain text displayable name for this user. | |
trashingUser.photoLink |
string |
A link to the user's profile photo, if available. | |
trashingUser.me |
boolean |
Whether this user is the requesting user. | |
trashingUser.permissionId |
string |
The user's ID as visible in Permission resources. | |
trashingUser.emailAddress |
string |
The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester. | |
trashedTime |
datetime |
The time that the item was trashed (RFC 3339 date-time). Only populated for items in shared drives. | |
teamDriveId |
string |
Deprecated - use driveId instead. |
|
capabilities.canAddChildren |
boolean |
Whether the current user can add children to this folder. This is always false when the item is not a folder. | |
capabilities.canDelete |
boolean |
Whether the current user can delete this file. | |
capabilities.canDownload |
boolean |
Whether the current user can download this file. | |
capabilities.canListChildren |
boolean |
Whether the current user can list the children of this folder. This is always false when the item is not a folder. | |
capabilities.canMoveTeamDriveItem |
boolean |
Deprecated - use canMoveItemWithinDrive or canMoveItemOutOfDrive instead. |
|
capabilities.canMoveItemIntoTeamDrive |
boolean |
Deprecated - use canMoveItemOutOfDrive instead. |
|
capabilities.canReadTeamDrive |
boolean |
Deprecated - use canReadDrive instead. |
|
capabilities.canRemoveChildren |
boolean |
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 canDeleteChildren or canTrashChildren instead. |
|
capabilities.canRename |
boolean |
Whether the current user can rename this file. | |
capabilities.canTrash |
boolean |
Whether the current user can move this file to trash. | |
capabilities.canUntrash |
boolean |
Whether the current user can restore this file from trash. | |
hasAugmentedPermissions |
boolean |
Whether there are permissions directly on this file. This field is only populated for items in shared drives. | |
capabilities.canChangeViewersCanCopyContent |
boolean |
Deprecated | |
permissionIds[] |
list |
List of permission IDs for users with access to this file. | |
capabilities.canChangeCopyRequiresWriterPermission |
boolean |
Whether the current user can change the copyRequiresWriterPermission restriction of this file. |
|
copyRequiresWriterPermission |
boolean |
Whether the options to copy, print, or download this file, should be disabled for readers and commenters. | writable |
capabilities.canDeleteChildren |
boolean |
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 |
boolean |
Deprecated - use canMoveChildrenOutOfDrive instead. |
|
capabilities.canMoveChildrenWithinTeamDrive |
boolean |
Deprecated - use canMoveChildrenWithinDrive instead. |
|
capabilities.canMoveItemOutOfTeamDrive |
boolean |
Deprecated - use canMoveItemOutOfDrive instead. |
|
capabilities.canMoveItemWithinTeamDrive |
boolean |
Deprecated - use canMoveItemWithinDrive instead. |
|
capabilities.canTrashChildren |
boolean |
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. | |
exportLinks |
object |
Links for exporting Google Docs to specific formats. | |
exportLinks.(key) |
string |
A mapping from export format to URL | |
driveId |
string |
ID of the shared drive the file resides in. Only populated for items in shared drives. | |
capabilities.canMoveChildrenOutOfDrive |
boolean |
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.canMoveChildrenWithinDrive |
boolean |
Whether the current user can move children of this folder within the shared drive. This is false when the item is not a folder. Only populated for items in shared drives. | |
capabilities.canMoveItemOutOfDrive |
boolean |
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.canMoveItemWithinDrive |
boolean |
Whether the current user can move this item within this shared drive. Note that a request to change the parent of the item may still fail depending on the new parent that is being added. Only populated for items in shared drives. | |
capabilities.canReadDrive |
boolean |
Whether the current user can read the shared drive to which this file belongs. Only populated for items in shared drives. | |
capabilities.canModifyContent |
boolean |
Whether the current user can modify the content of this file. |
Methods
- copy
- Creates a copy of a file and applies any requested updates with patch semantics.
- create
- Creates a new file.
- delete
- Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive the user must be an organizer on the parent. If the target is a folder, all descendants owned by the user are also deleted.
- emptyTrash
- Permanently deletes all of the user's trashed files.
- export
- Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB.
- generateIds
- Generates a set of file IDs which can be provided in create or copy requests.
- get
- Gets a file's metadata or content by ID.
- list
- Lists or searches files.
- update
- Updates a file's metadata and/or content with patch semantics.
- watch
- Subscribes to changes to a file