Files: create

Creates a new file. Try it now.

This method supports an /upload URI and accepts uploaded media with the following characteristics:

  • Maximum file size: 5120GB
  • Accepted Media MIME types: */*


HTTP request

This method provides media upload functionality through two separate URIs. For more details, see the document on media upload.

  • Upload URI, for media upload requests:
  • Metadata URI, for metadata-only requests:


Parameter name Value Description
Required query parameters
uploadType string The type of upload request to the /upload URI. Acceptable values are:
  • media - Simple upload. Upload the media only, without any metadata.
  • multipart - Multipart upload. Upload both the media and its metadata, in a single request.
  • resumable - Resumable upload. Upload the file in a resumable fashion, using a series of at least two requests where the first request includes the metadata.
Optional query parameters
ignoreDefaultVisibility boolean Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders. (Default: false)
keepRevisionForever boolean Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive. Only 200 revisions for the file can be kept forever. If the limit is reached, try deleting pinned revisions. (Default: false)
ocrLanguage string A language hint for OCR processing during image import (ISO 639-1 code).
supportsAllDrives boolean Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives. (Default: false)
supportsTeamDrives boolean Deprecated use supportsAllDrives instead. (Default: false)
useContentAsIndexableText boolean Whether to use the uploaded content as indexable text. (Default: false)


This request requires authorization with at least one of the following scopes:


Some scopes are restricted and require a security assessment for your app to use them. For more information, see the authentication and authorization page.

Request body

In the request body, supply a Files resource with the following properties as the metadata. For more information, see the document on media upload.

Property name Value Description Notes
Optional Properties
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.

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
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
copyRequiresWriterPermission boolean Whether the options to copy, print, or download this file, should be disabled for readers and commenters. writable
createdTime datetime The time at which the file was created (RFC 3339 date-time). writable
description string A short description of the file. writable
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.

id string The ID of the file. 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.

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.

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
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
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 addParents and removeParents parameters to modify the parents list.

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.

starred boolean Whether the user has starred the file. writable
viewedByMeTime datetime The last time the file was viewed by the user (RFC 3339 date-time). writable
writersCanShare boolean Whether users with only writer permission can modify the file's permissions. Not populated for items in shared drives. writable


If successful, this method returns a Files resource in the response body.

Try it!

Note: APIs Explorer currently supports metadata requests only.

Use the APIs Explorer below to call this method on live data and see the response.