Skip to main content
Connect Gmail to automatically sync email threads into your supermemory knowledge base. Supports real-time updates via Google Cloud Pub/Sub webhooks and incremental synchronization.
Max Plan Required: The Gmail connector is available on Max plan and above.

Quick setup

1. Create Gmail Connector

2. Handle OAuth callback

Send the user to authorization.url before authorization.expiresAt. After the user grants permissions, Google redirects to your redirectUrl and the initial sync begins. A pending OAuth connector is not visible in list or get until the user finishes authorization.

3. Check Connector Status

There is no per-connector document list in v5. supermemory.list(namespace, "documents") returns every document in the namespace.

What gets synced

Email threads

Gmail threads (conversations) are synced as individual documents with all messages included:
  • Thread content converted to structured markdown
  • All messages within each thread preserved in order
  • Message metadata: subject, from, to, cc, bcc, date
  • HTML content converted to clean markdown
  • Attachment metadata: filename, mime type, size (attachments are referenced, not stored)

Document metadata

Each synced thread includes searchable metadata: You can filter searches using these metadata fields:

Connector Management

List All Connectors

Delete Connector

Deleting a connector will:
  • Stop all future syncs from Gmail
  • Remove the OAuth authorization
  • Delete the synced documents unless you pass deleteDocuments: false

Manual sync

Trigger a manual synchronization. The call returns 409 while a sync for that connector is already running.

Sync mechanism

Gmail connector supports multiple sync methods:

How real-time sync works

  1. When a connector is created, supermemory registers a Gmail API “watch” subscription
  2. Gmail sends notifications to a Google Cloud Pub/Sub topic when emails change
  3. supermemory receives these notifications and fetches updated threads
  4. Watch subscriptions expire after 7 days and are automatically renewed
Real-time sync monitors the INBOX label. Emails in other labels are synced via scheduled/manual sync.

Permissions & scopes

The Gmail connector requests the following OAuth scopes:
Read-only Access: The Gmail connector only reads emails. It cannot send, delete, or modify any emails in the user’s account.

Limitations

Important Limitations:
  • Plan requirement: Requires Max Plan or above
  • INBOX only for real-time sync: Only INBOX label triggers real-time updates; other labels sync via scheduled sync
  • Watch expiration: Gmail watch subscriptions expire after 7 days (automatically renewed by supermemory)
  • Document limit: Default limit is 10,000 threads per connector (configurable via documentLimit parameter)
  • Attachments: Attachment metadata is stored, but attachment content is not downloaded
  • Rate limits: Gmail API rate limits may affect sync speed for accounts with many emails

Troubleshooting

OAuth fails or missing refresh token

If OAuth fails or the connector stops syncing:
  1. Delete the existing connector
  2. Create a new connector
  3. Ensure the user completes the full OAuth flow with consent

Emails not syncing in real-time

If real-time sync isn’t working:
  • Scheduled sync (every 4 hours) and manual sync still work
  • Real-time sync requires supermemory’s Pub/Sub infrastructure
  • Check if the connector was created recently (watch registration happens on creation)
  • Trigger a manual sync to verify the connector is working

Permission denied errors

If you see permission errors:
  • Ensure the user granted the required Gmail scopes during OAuth
  • Verify your organization has Max Plan or above access
  • Check if the user revoked app access in their Google Account settings