Skip to main content
POST
Prepare a resumable Google Drive upload, or a replacement of an existing file's content, for a client with local file transport

Authorizations

x-api-key
string
header
required

Organization API key passed as the x-api-key header. The raw key is the header value; do not prefix it with Bearer.

Body

application/json
name
string
required

File basename; no file bytes or local paths. Ignored when replacing a file.

Required string length: 1 - 255
Pattern: ^[^\x00-\x1f\x7f]+$
size
integer
required

Exact file size in bytes, up to Google's 5 TiB limit.

Required range: 1 <= x <= 5497558138880
mimeType
string
default:application/octet-stream
Required string length: 1 - 255
Pattern: ^[A-Za-z0-9!#$&^_.+-]+\/[A-Za-z0-9!#$&^_.+-]+$
folderId
string
Required string length: 1 - 512
Pattern: ^[A-Za-z0-9_-]+$
fileId
string

Replace this existing file's content instead of creating a file. It keeps its ID, link, sharing and comments; the previous version stays in Drive's version history for 30 days.

Required string length: 1 - 512
Pattern: ^[A-Za-z0-9_-]+$
baseRevision
string

Required with fileId: the revision your copy was downloaded from. Refused with drive_conflict when Drive changed since; download the newer version and reapply the edits, or save a new file.

Required string length: 1 - 512
convertTo
enum<string>

New files only: save the uploaded Office file as this native Google Docs, Sheets or Slides type.

Available options:
application/vnd.google-apps.spreadsheet,
application/vnd.google-apps.document,
application/vnd.google-apps.presentation

Response

Secret upload session; file not yet uploaded.

ok
boolean
required
uploadUrl
string<uri>
required

Secret bearer upload-session URL. Never print, share, persist, or log it. Only upload the authorized file; no Google access token is needed.

method
string
required
Allowed value: "PUT"
size
integer
required
Required range: -9007199254740991 <= x <= 9007199254740991
chunkSize
number
required
instructions
string
required
replaces
object

Present when the upload replaces an existing file's content.