The photos space will sunset in early January 2018. Your users can continue to access Google Photos via the drive space by enabling the Google Photos folder in My Drive in the Drive client settings

Files

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,
  "lastModifyingUser": {
    "kind": "drive#user",
    "displayName": string,
    "photoLink": string,
    "me": boolean,
    "permissionId": string,
    "emailAddress": string
  },
  "shared": boolean,
  "ownedByMe": boolean,
  "capabilities": {
    "canAddChildren": boolean,
    "canChangeViewersCanCopyContent": boolean,
    "canComment": boolean,
    "canCopy": boolean,
    "canDelete": boolean,
    "canDownload": boolean,
    "canEdit": boolean,
    "canListChildren": boolean,
    "canMoveItemIntoTeamDrive": boolean,
    "canMoveTeamDriveItem": boolean,
    "canReadRevisions": boolean,
    "canReadTeamDrive": boolean,
    "canRemoveChildren": boolean,
    "canRename": boolean,
    "canShare": boolean,
    "canTrash": boolean,
    "canUntrash": boolean
  },
  "viewersCanCopyContent": 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
}
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 Team Drives, My Drive root folder, and Application Data folder the name is constant. writable
mimeType string The MIME type of the file.

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 My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.

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.
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.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 Team Drive files.
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[].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.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 Team Drive files.
ownedByMe boolean Whether the user owns the file. Not populated for Team Drive files.
viewersCanCopyContent boolean Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations. writable
writersCanShare boolean Whether users with only writer permission can modify the file's permissions. Not populated for Team Drive files. 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 Team Drive files.
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 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 Drive.

This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.

fileExtension string The final component of fullFileExtension. This is only available for files with binary content in Drive.
md5Checksum string The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive.
size long The size of the file's content in bytes. This is only applicable to files with binary content in 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 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 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.
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 a Team Drive item, 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 Team 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 Team Drive files.
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.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 Team Drive files.
teamDriveId string ID of the Team Drive the file resides in.
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 Whether the current user can move this Team Drive item by changing its parent. Note that a request to change the parent for this item may still fail depending on the new parent that is being added. Only populated for Team Drive files.
capabilities.canMoveItemIntoTeamDrive boolean Whether the current user can move this item into a Team Drive. If the item is in a Team Drive, this field is equivalent to canMoveTeamDriveItem.
capabilities.canReadTeamDrive boolean Whether the current user can read the Team Drive to which this file belongs. Only populated for Team Drive files.
capabilities.canRemoveChildren boolean Whether the current user can remove children from this folder. This is always false when the item is not a folder.
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 any users are granted file access directly on this file. This field is only populated for Team Drive files.
capabilities.canChangeViewersCanCopyContent boolean Whether the current user can change whether viewers can copy the contents of this file.
permissionIds[] list List of permission IDs for users with access to 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 Team 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 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

Send feedback about...

Drive REST API
Drive REST API