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, Supermemory sends them to a hosted label picker; once they choose labels, they return to your redirectUrl and the initial sync begins. Nothing syncs until at least one label is selected. A pending OAuth connector is not returned by list until the user finishes authorization; get returns it with system.status: "pending_authorization". To change the labels later, read the connector with include: "picker" and send the user to picker.url, or set label ids directly with connectors.update(namespace, id, { selection: { labels: ["INBOX"] } }). See Managing Connector Selection.

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. After labels are selected, supermemory registers a Gmail API “watch” subscription when Pub/Sub is configured
  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 selected labels, including labels outside INBOX. If multiple connectors use the same mailbox, its watch covers their combined label selections.

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
  • Selected labels only: Syncs and real-time updates cover the labels chosen in the picker. Nothing syncs until at least one label is selected
  • 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:
  • Manual sync still works
  • 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