Google Workspace

Workspace Gmail and Google Drive.

Who can see it Partial
Works with Gmail · Google Drive
Set up in console

Scan Workspace Gmail mailboxes and Google Drive, read-only, from your own agent.

What it scans

Connection type Scanned scope
gmail Headers, bounded body text and attachment contents for the explicit Workspace users you list, optionally limited by label and received-after time
google_drive One shared drive, or one explicitly impersonated user's My Drive root; Docs/Slides export as text and Sheets as CSV

What you need

Requirement Details
People A Google Workspace super admin and a Google Cloud project operator
Agent A customer-run agent that can reach Google's OAuth, Gmail and Drive API endpoints over HTTPS
Secrets The service-account key stays on your agent

Step 1: Create a project and service account

  1. In Google Cloud console, choose Select a project → New project or an existing project you control.
  2. APIs & Services → Library: enable Gmail API and/or Google Drive API, according to the sources you will scan.
  3. IAM & Admin → Service Accounts → Create service account: name it myrikeep-scan. Skip project roles and optional user access grants.
  4. Open the new account's Details → Advanced settings → Domain-wide delegation and record its numeric OAuth Client ID.
  5. Keys → Add key → Create new key → JSON downloads the private key file. Protect it like a password. Do not upload it to Myrikeep.

See Google's service-account delegation instructions.

Step 2: Authorize read-only delegation

  1. As Workspace super admin, open Admin console → Security → Access and data control → API controls → Manage Domain Wide Delegation → Add new.
  2. Enter the service account's numeric Client ID.
  3. Enter only the scopes your connections need:
text
https://www.googleapis.com/auth/gmail.readonly,https://www.googleapis.com/auth/drive.readonly
Source Scope to authorize
Gmail https://www.googleapis.com/auth/gmail.readonly
Drive https://www.googleapis.com/auth/drive.readonly

Authorize just one scope if you use just one source. Do not add Gmail modify/send, Drive write or Admin SDK directory scopes.

These are broad read permissions: the key can read mail and Drive as users across your domain. Keep it on the host, rotate it routinely and review provider audit logs. See Gmail scopes and Drive scopes.

Step 3: Choose scope and connect

Source Scope value
Gmail The actual Workspace user email addresses
Shared drive An impersonated user with access, plus the shared drive ID from its Drive URL (the ID after /drive/folders/); never the full URL
My Drive An impersonated user, with Drive ID left empty

The connector never searches the user directory or lists every drive in the domain.

  1. Open Connections → Add connection and select Workspace Gmail (Pilot) or Google Drive (Pilot).
  2. Enter the scope, assign your agent and use Local credential catalog.
  3. Save the JSON below on the agent.
  4. Wait for present, then queue a small scan in Scans and check Coverage.

Connection settings table

Console field Example Required or optional
Connection name Workspace finance Required; unique in workspace
Type gmail or google_drive Required
Impersonated users (Gmail) [email protected] Required; one per line or comma-separated, at most 1,000
Gmail label ID (Gmail) INBOX or Label_7 Optional; blank scans mailbox scope
Received after (Gmail) 2026-01-01T00:00:00Z Optional; UTC
Impersonated user (Drive) [email protected] Required; user with drive access
Drive / document library ID (Drive) 0AExampleDriveId Optional; shared drive ID, blank for My Drive
Agent Google agent Required; same workspace
Credential mode Local credential catalog Required
Credential name GOOGLE_MAIN Required; uppercase alias
Exclude patterns (View/edit) *.tmp Optional; one glob per line
Enabled (connection row) Enabled Disable to stop new scans

Workspace Drive has no folder-ID or root-path field. For a smaller scan, choose a separate shared drive or use exclusions, while remembering the key's broad authority.

Secret file

Save the downloaded Google service-account JSON verbatim as /srv/myrikeep/secrets/GOOGLE_MAIN. Its shape is below. The key is an explicit placeholder, not a usable private key; do not manufacture a key from this example.

json
{
  "type": "service_account",
  "project_id": "example-scan-project",
  "private_key_id": "<GOOGLE_KEY_ID>",
  "private_key": "<GOOGLE_GENERATED_PEM_PRIVATE_KEY>",
  "client_email": "[email protected]",
  "client_id": "123456789012345678901",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/myrikeep-scan%40example-scan-project.iam.gserviceaccount.com",
  "universe_domain": "googleapis.com"
}
Rule Detail
Required fields type, client_email, private_key, token_uri
Other fields shown Accepted optional fields, not permission settings
Values All must be nonempty strings
Unknown fields Rejected by the catalog validator
token_uri Must be exactly the one shown

Merge this catalog entry, including only the types you use:

json
{"version": 1, "credentials": {"GOOGLE_MAIN": {"types": ["gmail", "google_drive"], "source": {"kind": "file_json", "path": "/run/secrets/GOOGLE_MAIN"}}}}
  • Modes and mounts: follow Agent credentials.
  • Rotation: create a new Google key, replace the local file, verify a scan, then remove the old key in Google Cloud.

Scope, exclusions and schedules

Gmail scans only the named users and the optional label/time filter. Drive walks only the selected drive's descendants. Configure exclusions in Connections → View/edit.

Source What a glob matches Example
Drive Item names, not full folder paths *.tmp, ~$*
Gmail Slash-joined user, message, part and filename fields *.pdf skips PDF attachments, not message bodies

Enumeration fetches bounded full message payloads to discover parts, even if a part is later excluded. See Getting started for schedule cadence.

"Who can see it" support

Source Sharing checks Age signal
Drive Anyone links, internal domain sharing and external grants Modified time
Gmail Not available for this source yet Internal receipt time
  • Complete, owner-visible narrow permissions may be restricted.
  • Incomplete or non-owner views, unresolved groups and shared-drive limits stay unknown or partial.
  • It does not enumerate directory or group membership.
  • A Drive viewed-by-me date describes only the caller, not all users.

See Who can see it.

Troubleshooting

State or error What to do
unknown Check heartbeat, assignment and current connection revision.
missing / credential_missing Check alias/type and read-only secret mount.
Invalid / credential_config_invalid Use the downloaded service-account object, with valid PEM key, permitted fields, token URI and file modes.
present The key is structurally valid; delegation and user/resource access still need a scan.
source_error / unauthorized_client Inspect local diagnostics. Check numeric client ID and the exact delegated scopes in Admin console.
invalid_grant / invalid credentials Check key revocation, private-key format, agent clock and impersonated user.
403 / access denied Enable the API, check delegated scope and impersonated user's access to this shared drive.
404 / item gone Verify plain provider ID and the selected user's visibility; do not paste a browser URL.
access_denied sharing / unknown Review read-only metadata access; do not infer restricted from missing permission evidence.
429 / rate_limited The agent retries within bounds; narrow scope and spread schedules if quota failures persist.
Paused / Migration paused / Disabled Resume agent, assign and save a valid migrated connection, or enable it.
signin_required Workspace types use service accounts. Interactive sign-in belongs to personal drives.

Limits

What it never does: send or write, discover the directory, or search files across the domain.

Limit Value
Gmail messages 100,000
Attachments per message 100
Body text 20,000 characters
Attachment size 10 MiB by default
Drive items 1,000,000
Drive folders 100,000
Drive depth 64
Text files Read in full up to the full-read limit (Agent settings)

All reads, exports and sampling are bounded. The scan report lists files that were only partially read or skipped.

Skipped items and file formats
  • Inline-only attachment parts without attachmentId are skipped.
  • Cross-drive and chained shortcuts, and unsupported Google-native types, are skipped.
  • Docs and Slides export as text and Sheets as CSV, without full original formatting.
  • Common text, PDF text and modern Office have parsers; other file formats use strings-only checks.
  • Text in images and scanned PDFs needs OCR, an optional premium feature a workspace owner enables. It runs inside your agent with the OCR agent image.