Hide

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,
  "etag": etag,
  "selfLink": string,
  "webContentLink": string,
  "webViewLink": string,
  "alternateLink": string,
  "embedLink": string,
  "openWithLinks": {
    (key): string
  },
  "defaultOpenWithLink": string,
  "iconLink": string,
  "thumbnailLink": string,
  "thumbnail": {
    "image": bytes,
    "mimeType": string
  },
  "title": string,
  "mimeType": string,
  "description": string,
  "labels": {
    "starred": boolean,
    "hidden": boolean,
    "trashed": boolean,
    "restricted": boolean,
    "viewed": boolean
  },
  "createdDate": datetime,
  "modifiedDate": datetime,
  "modifiedByMeDate": datetime,
  "lastViewedByMeDate": datetime,
  "markedViewedByMeDate": datetime,
  "sharedWithMeDate": datetime,
  "version": long,
  "sharingUser": {
    "kind": "drive#user",
    "displayName": string,
    "picture": {
      "url": string
    },
    "isAuthenticatedUser": boolean,
    "permissionId": string,
    "emailAddress": string
  },
  "parents": [
    parents Resource
  ],
  "downloadUrl": string,
  "exportLinks": {
    (key): string
  },
  "indexableText": {
    "text": string
  },
  "userPermission": permissions Resource,
  "permissions": [
    permissions Resource
  ],
  "originalFilename": string,
  "fileExtension": string,
  "md5Checksum": string,
  "fileSize": long,
  "quotaBytesUsed": long,
  "ownerNames": [
    string
  ],
  "owners": [
    {
      "kind": "drive#user",
      "displayName": string,
      "picture": {
        "url": string
      },
      "isAuthenticatedUser": boolean,
      "permissionId": string,
      "emailAddress": string
    }
  ],
  "lastModifyingUserName": string,
  "lastModifyingUser": {
    "kind": "drive#user",
    "displayName": string,
    "picture": {
      "url": string
    },
    "isAuthenticatedUser": boolean,
    "permissionId": string,
    "emailAddress": string
  },
  "editable": boolean,
  "copyable": boolean,
  "writersCanShare": boolean,
  "shared": boolean,
  "explicitlyTrashed": boolean,
  "appDataContents": boolean,
  "headRevisionId": string,
  "properties": [
    properties Resource
  ],
  "folderColorRgb": string,
  "imageMediaMetadata": {
    "width": integer,
    "height": integer,
    "rotation": integer,
    "location": {
      "latitude": double,
      "longitude": double,
      "altitude": double
    },
    "date": 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
  }
}
Property name Value Description Notes
kind string The type of file. This is always drive#file.
id string The ID of the file.
etag etag ETag of the file.
title string The title of the file. Used to identify file or folder name. writable
mimeType string 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. writable
description string A short description of the file. writable
labels object A group of labels for the file.
labels.starred boolean Whether this file is starred by the user. writable
labels.hidden boolean Deprecated. writable
labels.trashed boolean 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. writable
createdDate datetime Create time for this file (formatted RFC 3339 timestamp).
modifiedDate datetime Last time this file was modified by anyone (formatted RFC 3339 timestamp). This is only mutable on update when the setModifiedDate parameter is set. writable
modifiedByMeDate datetime 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.
downloadUrl string Short lived download URL for the file. This is only populated for files with content stored in Drive.
indexableText object Indexable text attributes for the file. This property can only be written, and is not returned by files.get. For more information, see Custom thumbnails and indexable text.
indexableText.text string The text to be indexed for this file. writable
userPermission nested object The permissions for the authenticated user on this file.
fileExtension string The file extension used when downloading this file. This field is read only. To set the extension, include it in the title when creating the file. This is only populated for files with content stored in Drive.
md5Checksum string An MD5 checksum for the content of this file. This is populated only for files with content stored in Drive.
fileSize long The size of the file in bytes. This is only populated for files with content stored in Drive.
labels.restricted boolean Whether viewers are prevented from downloading this file. writable
labels.viewed boolean Whether this file has been viewed by this user. writable
sharedWithMeDate datetime Time at which this file was shared with the user (formatted RFC 3339 timestamp).
parents[] list Collection of parent folders which contain this file.

Setting this field will put the file in all of the provided folders. On insert, if no folders are provided, the file will be placed in the default root folder.

writable
exportLinks.(key) string A mapping from export format to URL
originalFilename string The original filename if the file was uploaded manually, or the original title if the file was inserted through the API. Note that renames of the title will not change the original filename. This will only be populated on files with content stored in Drive.
quotaBytesUsed long The number of quota bytes used by this file.
ownerNames[] list Name(s) of the owner(s) of this file.
lastModifyingUserName string Name of the last user to modify this file.
editable boolean Whether the file can be edited by the current user.
writersCanShare boolean Whether writers can share the document with other users. writable
lastViewedByMeDate datetime Last time this file was viewed by the user (formatted RFC 3339 timestamp). writable
explicitlyTrashed boolean Whether this file has been explicitly trashed, as opposed to recursively trashed. This will only be populated if the file is trashed.
imageMediaMetadata object 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.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.
thumbnail object Thumbnail for the file. Only accepted on upload and for files that are not already thumbnailed by Google.
thumbnail.image bytes The URL-safe Base64 encoded bytes of the thumbnail image. It should conform to RFC 4648 section 5.
thumbnail.mimeType string The MIME type of the thumbnail.
imageMediaMetadata.date string The date and time the photo was taken (EXIF format timestamp).
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.
shared boolean Whether the file has been shared.
owners[] list The owner(s) of this file.
owners[].kind string This is always drive#user.
owners[].displayName string A plain text displayable name for this user.
owners[].picture object The user's profile picture.
owners[].picture.url string A URL that points to a profile picture of this user.
owners[].isAuthenticatedUser boolean Whether this user is the same as the authenticated user for whom the request was made.
owners[].permissionId string The user's ID as visible in the permissions collection.
lastModifyingUser nested object The last user to modify this file.
lastModifyingUser.kind string This is always drive#user.
lastModifyingUser.displayName string A plain text displayable name for this user.
lastModifyingUser.picture object The user's profile picture.
lastModifyingUser.picture.url string A URL that points to a profile picture of this user.
lastModifyingUser.isAuthenticatedUser boolean Whether this user is the same as the authenticated user for whom the request was made.
lastModifyingUser.permissionId string The user's ID as visible in the permissions collection.
appDataContents boolean Whether this file is in the Application Data folder.
openWithLinks.(key) string
headRevisionId string The ID of the file's head revision. This will only be populated for files with content stored in Drive.
copyable boolean Whether the file can be copied by the current user.
properties[] list The list of properties. writable
owners[].emailAddress string The email address of the user.
lastModifyingUser.emailAddress string The email address of the user. This field is returned only if the last modifying user is an owner of the file, the requesting user is an owner or can modify the file, or if the last modifying user's email address is visible.
markedViewedByMeDate datetime Time this file was explicitly marked viewed by the user (formatted RFC 3339 timestamp). writable
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 requesting user.
sharingUser nested object User that shared the item with the current user, if available.
sharingUser.kind string This is always drive#user.
sharingUser.displayName string A plain text displayable name for this user.
sharingUser.picture object The user's profile picture.
sharingUser.picture.url string A URL that points to a profile picture of this user.
sharingUser.isAuthenticatedUser boolean Whether this user is the same as the authenticated user for whom the request was made.
sharingUser.permissionId string The user's ID as visible in the permissions collection.
sharingUser.emailAddress string The email address of the user.
permissions[] list The list of permissions for users with access to this file.
videoMediaMetadata object Metadata about video media. This will only be present for video types.
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.
folderColorRgb string Folder color as an RGB hex string if the file is 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. writable

Methods

get
Gets a file's metadata by ID.
insert
Insert a new file.
patch
Updates file metadata. This method supports patch semantics.
update
Updates file metadata and/or content.
copy
Creates a copy of the specified file.
delete
Permanently deletes a file by ID. Skips the trash. The currently authenticated user must own the file.
list
Lists the user's files.
touch
Set the file's updated time to the current server time.
trash
Moves a file to the trash.
untrash
Restores a file from the trash.
watch
Start watching for changes to a file.
emptyTrash
Permanently deletes all of the user's trashed files.

Send feedback about...

Drive REST API