> ## Documentation Index
> Fetch the complete documentation index at: https://developers.lighton.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 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 LightOn. 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:

1. Create a new workspace from **Workspaces → New**.
2. Open the workspace, then choose **Sync from Google Drive** in its settings.
3. 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/v3/company/workspaces/{id}`](/api-reference/workspaces/update-a-company-workspace) with a `datasource` object. Conversion is one-way: you cannot revert a synced workspace back to manual.

```python theme={null}
import requests, json

requests.patch(
    f"https://api.lighton.ai/api/v3/company/workspaces/{workspace_id}",
    headers={"Authorization": "Bearer $LIGHTON_API_KEY"},
    json={
        "datasource": {
            "type": "googledrive",
            "name": "Engineering Drive",
            "credentials": {
                "service_account_file": json.dumps(service_account_dict),
            },
            "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 from
* `recursive` (optional): include subfolders

The first import is scheduled immediately. Track progress on the workspace's `sync` field returned by [`GET /api/v3/company/workspaces/{id}`](/api-reference/workspaces/retrieve-a-company-workspace).

For the full request shape, see [`PATCH /api/v3/company/workspaces/{id}`](/api-reference/workspaces/update-a-company-workspace) in the API reference.
