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

# Google Drive

> Reference for the Tracecat Google Drive integration: registered actions, required secrets, expected inputs, and example workflow usage.

## Add Drive permission

Action ID: `tools.google_drive.add_permission`

Grant access to a file or folder

Reference: [https://developers.google.com/workspace/drive/api/reference/rest/v3/permissions/create](https://developers.google.com/workspace/drive/api/reference/rest/v3/permissions/create)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="email" type="string" required>
  Email address to grant access to
</ParamField>

<ParamField path="file_id" type="string" required>
  The file or folder ID
</ParamField>

<ParamField path="fields" type="string">
  Fields to return ('\*' for all)

  Default: `"*"`.
</ParamField>

<ParamField path="role" type="string">
  Role: reader, writer, commenter, owner

  Default: `"reader"`.
</ParamField>

<ParamField path="send_notification" type="boolean">
  Send email notification

  Default: `false`.
</ParamField>

## Create Drive folder

Action ID: `tools.google_drive.create_folder`

Create a new folder in Google Drive

Reference: [https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="folder_name" type="string" required>
  Name for the new folder
</ParamField>

<ParamField path="fields" type="string">
  Fields to return ('\*' for all)

  Default: `"*"`.
</ParamField>

<ParamField path="parent_folder_id" type="string">
  Parent folder ID (empty = root)

  Default: `""`.
</ParamField>

## Delete Drive file

Action ID: `tools.google_drive.delete_file`

Move a file or folder to trash

Reference: [https://developers.google.com/workspace/drive/api/reference/rest/v3/files/update](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/update)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="file_id" type="string" required>
  The file or folder ID to delete
</ParamField>

<ParamField path="fields" type="string">
  Fields to return ('\*' for all)

  Default: `"*"`.
</ParamField>

## Get Drive file

Action ID: `tools.google_drive.get_file`

Get metadata for a specific file

Reference: [https://developers.google.com/workspace/drive/api/reference/rest/v3/files/get](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/get)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="file_id" type="string" required>
  The file ID
</ParamField>

<ParamField path="fields" type="string">
  Fields to return ('\*' for all)

  Default: `"*"`.
</ParamField>

## Get Drive file permissions

Action ID: `tools.google_drive.get_file_permissions`

List all permissions for a file

Reference: [https://developers.google.com/workspace/drive/api/reference/rest/v3/permissions/list](https://developers.google.com/workspace/drive/api/reference/rest/v3/permissions/list)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="file_id" type="string" required>
  The file ID
</ParamField>

<ParamField path="fields" type="string">
  Fields to return ('\*' for all)

  Default: `"*"`.
</ParamField>

<ParamField path="page_size" type="integer | null">
  The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.

  Default: `null`.
</ParamField>

<ParamField path="page_token" type="string | null">
  The token for continuing a previous list request on the next page. This should be set to the value of nextPageToken from the previous response.

  Default: `null`.
</ParamField>

## List Drive files

Action ID: `tools.google_drive.list_files`

List and search files in Google Drive

Reference: [https://developers.google.com/workspace/drive/api/reference/rest/v3/files/list](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/list)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="drive_id" type="string">
  Optional Shared Drive ID to scope the search to a single Shared Drive. Implies include\_shared\_drives.

  Default: `""`.
</ParamField>

<ParamField path="fields" type="string">
  Fields to return (e.g., 'files(id,name,mimeType)' or '\*' for all)

  Default: `"*"`.
</ParamField>

<ParamField path="include_shared_drives" type="boolean">
  Include files from Shared Drives (sets supportsAllDrives and includeItemsFromAllDrives).

  Default: `false`.
</ParamField>

<ParamField path="max_results" type="integer">
  Maximum number of results. The maximum value is 1000; values above 1000 will be coerced to 1000.

  Default: `10`.
</ParamField>

<ParamField path="order_by" type="string">
  Sort order

  Default: `"modifiedTime desc"`.
</ParamField>

<ParamField path="page_token" type="string | null">
  The token for continuing a previous list request on the next page. This should be set to the value of nextPageToken from the previous response.

  Default: `null`.
</ParamField>

<ParamField path="query" type="string">
  Search query (e.g., 'name contains "report"')

  Default: `""`.
</ParamField>

## Permanently delete Drive file

Action ID: `tools.google_drive.permanently_delete_file`

Permanently delete a file (bypass trash)

Reference: [https://developers.google.com/workspace/drive/api/reference/rest/v3/files/delete](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/delete)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="file_id" type="string" required>
  The file or folder ID to permanently delete
</ParamField>

## Query Drive activity

Action ID: `tools.google_drive.query_activity`

Query past activity in Google Drive.

Reference: [https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/query](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/query)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="ancestor_name" type="string | null">
  Return activities for this Drive folder, plus all children and descendants. The format is `items/ITEM_ID`.

  Default: `null`.
</ParamField>

<ParamField path="consolidation_strategy" type="object | null">
  Details on how to consolidate related actions that make up the activity. If not set, then related actions aren't consolidated. Union field `strategy`, one of: `none` (the individual activities are not consolidated), `legacy` (the individual activities are consolidated using the legacy strategy). See [https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/query#ConsolidationStrategy](https://developers.google.com/workspace/drive/activity/v2/reference/rest/v2/activity/query#ConsolidationStrategy)

  Default: `null`.
</ParamField>

<ParamField path="filter" type="string | null">
  The filtering for items returned from this query request. The format of the filter string is a sequence of expressions, joined by an optional `AND`, where each expression is of the form `field operator value`. Supported fields are `time` and `detail.action_detail_case`.

  Default: `null`.
</ParamField>

<ParamField path="item_name" type="string | null">
  Return activities for this Drive item. The format is `items/ITEM_ID`.

  Default: `null`.
</ParamField>

<ParamField path="page_size" type="integer | null">
  The minimum number of activities desired in the response; the server attempts to return at least this quantity. The server may also return fewer activities if it has a partial response ready before the request times out. If not set, a default value is used.

  Default: `null`.
</ParamField>

<ParamField path="page_token" type="string | null">
  The token identifies which page of results to return. Set this to the `nextPageToken` value returned from a previous query to obtain the following page of results. If not set, the first page of results is returned.

  Default: `null`.
</ParamField>

## Revoke Drive permission

Action ID: `tools.google_drive.revoke_permission`

Remove access to a file or folder

Reference: [https://developers.google.com/workspace/drive/api/reference/rest/v3/permissions/delete](https://developers.google.com/workspace/drive/api/reference/rest/v3/permissions/delete)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="file_id" type="string" required>
  The file or folder ID
</ParamField>

<ParamField path="permission_id" type="string" required>
  The permission ID to revoke
</ParamField>

## Update Drive permission

Action ID: `tools.google_drive.update_permission`

Modify an existing permission

Reference: [https://developers.google.com/workspace/drive/api/reference/rest/v3/permissions/update](https://developers.google.com/workspace/drive/api/reference/rest/v3/permissions/update)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="file_id" type="string" required>
  The file or folder ID
</ParamField>

<ParamField path="permission_id" type="string" required>
  The permission ID to update
</ParamField>

<ParamField path="role" type="string" required>
  New role: reader, writer, commenter
</ParamField>

<ParamField path="fields" type="string">
  Fields to return ('\*' for all)

  Default: `"*"`.
</ParamField>

## Upload Drive file

Action ID: `tools.google_drive.upload_file`

Upload a file to Google Drive

Reference: [https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create](https://developers.google.com/workspace/drive/api/reference/rest/v3/files/create)

### Secrets

Optional secrets:

* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_USER_TOKEN`.
* `google_drive_oauth`: OAuth token `GOOGLE_DRIVE_SERVICE_TOKEN`.
* `google_api`: required values `GOOGLE_API_CREDENTIALS`; optional values `GOOGLE_API_SUBJECT`.

### Input fields

<ParamField path="file_content" type="string" required>
  Base64-encoded file content
</ParamField>

<ParamField path="file_name" type="string" required>
  Name for the uploaded file
</ParamField>

<ParamField path="fields" type="string">
  Fields to return ('\*' for all)

  Default: `"*"`.
</ParamField>

<ParamField path="mime_type" type="string">
  MIME type of file

  Default: `"application/octet-stream"`.
</ParamField>

<ParamField path="parent_folder_id" type="string">
  Parent folder ID (empty = root)

  Default: `""`.
</ParamField>
