---
title: "Prepare a resumable Google Drive upload, or a replacement of an existing file's content, for a client with local file transport"
method: POST
path: "/v1/capabilities/google-workspace/drive-upload-sessions"
tags: ["Capability Sources"]
---

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

`POST /v1/capabilities/google-workspace/drive-upload-sessions`

## Request

- Base URL: `https://api.openworklabs.com`
- URL: `https://api.openworklabs.com/v1/capabilities/google-workspace/drive-upload-sessions`
- Auth: one of:
  - API key in header `x-api-key`
  - HTTP bearer

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.

## Request body

- object
  - `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.

## Response `200`

Secret upload session; file not yet uploaded.

- GoogleDriveUploadSessionResponse
  - `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.
    - `fileId` string, required
    - `previousRevision` string, nullable, required
  - `instructions` string, required

## Other responses

- `400`: Invalid upload metadata, or a Google Docs, Sheets or Slides file cannot be replaced by an upload.
- `401`: Sign in first.
- `403`: Organization policy blocks the selected connection.
- `409`: Connect Google with Drive write access, or the file changed in Drive since baseRevision (drive_conflict) or is in the trash.
- `502`: Google did not confirm upload preparation.

## Changes

- **2026-10-23** `c93387179b31`: 3 breaking, 4 info
  - the response property `currentRevision` became nullable for the status `409`
  - the response property `modifiedTime` became nullable for the status `409`
  - the response property `replaces/previousRevision` became nullable for the status `200`
  - response property `anyOf[#/components/schemas/InvalidRequestError]/details/items/path/items/` list-of-types was narrowed by removing types `number` from media type `application/json` of response `400`
  - …3 more
- **2026-10-15** `370f072eddd0`: 3 breaking, 2 warning, 7 info
  - the response's body type changed from `object` to no type for status `400`
  - removed the required property `details` from the response with the `400` status
  - removed the required property `error` from the response with the `400` status
  - removed the optional property `capability` from the response with the `400` status
  - …8 more
- **2026-10-13** `00596ebe03b8`: 1 info
  - removed the non-success response with the status `404`
- **2026-10-09** `cc8a41bb846e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/openworklabs/apis/den-api/changes/v1/capabilities/google-workspace/drive-upload-sessions/post.md)

---

[API](https://skmtc.dev/openworklabs/apis/den-api.md) - [All operations](https://skmtc.dev/openworklabs/apis/den-api/llms.txt) - [OpenAPI document](https://skmtc.dev/openworklabs/apis/den-api/revisions/84fb0f99fb95?raw)
