Direct uploads

Prepare a Google Drive session for host file transport

Changed on

Prepare a Google Drive resumable upload session for an explicitly requested file upload. This does not upload bytes or prove completion. Clients with file transport can PUT local bytes directly to the returned secret uploadUrl, outside model context. With fileId the upload replaces that file's content as a new Drive version; with convertTo a new Office file becomes a native Google file. Google sessions can remain valid for up to one week; they are not short-lived signed URLs. Do not automatically create another session after an uncertain result. Final PUT returns file metadata, including headRevisionId and md5Checksum for later replaces. Uses the selected connection.

post/v1/direct-uploads/google-workspace/drive-upload-sessions

Request

  • Base URL
    https://api.openworklabs.com
  • Auth
    • API key in header x-api-key
    • or HTTP bearer

Request body

object required
name, string required

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

size, integer required

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

mimeType, string
folderId, string
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.

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.

convertTo, 'application/vnd.google-apps.spreadsheet' | 'application/vnd.google-apps.document' | 'application/vnd.google-apps.presentation'

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

connectionId, string

Response

Secret upload session for host transport.

GoogleDriveUploadSessionResponse required
ok, true 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, 'PUT' required
size, integer required
chunkSize, 8388608 required
replaces, object

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

instructions, string required

Changes

    • breaking

      the response property currentRevision became nullable for the status

    • breaking

      the response property modifiedTime became nullable for the status

    • breaking

      the response property replaces/previousRevision became nullable for the status

    4 more changes in this revision