Google Drive
Create workspaces synced to your Google Drive.
Sync a workspace to a Google Drive folder so any file added there is automatically ingested and indexed in Context212. Files are kept in sync: additions, updates, and deletions in Drive flow through to the workspace on the next import.
Synced workspaces are read-only: you cannot manually upload to or delete from them.
From the console
The fastest path is the console UI:
- Create a new workspace from Workspaces → New.
- Open the workspace, then choose Sync from Google Drive in its settings.
- Paste the service account JSON, pick the folder, and trigger the first import.
Use this if you'd rather not handle credentials yourself.
From the API
Convert any manual workspace into a Google Drive-synced workspace by issuing a PATCH /api/v1/company/workspaces/{id} with a datasource object. Conversion is one-way: you cannot revert a synced workspace back to manual.
await fetch(`https://api.context212.com/api/v1/company/workspaces/${workspaceId}`, {
method: "PATCH",
headers: {
Authorization: `Bearer ${process.env.C212_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
datasource: {
type: "googledrive",
name: "Engineering Drive",
credentials: {
service_account_file: JSON.stringify(serviceAccountDict),
},
filter_criteria: {
folder_id: "1AbCdEfGhIjKlMnOpQrStUvWxYz",
recursive: true,
},
},
}),
});Credentials
service_account_file: JSON-encoded string of your Google service account credentials. The service account needs read access to the target folder.
Filter criteria
folder_id(required): the Google Drive folder ID to sync fromrecursive(optional): include subfolders
The first import is scheduled immediately. Track progress on the workspace's sync field returned by GET /api/v1/company/workspaces/{id}.
For the full request shape, see PATCH /api/v1/company/workspaces/{id} in the API reference.