Max Plan Required: The Gmail connector is available on Max plan and above.
Quick setup
1. Create Gmail Connector
- TypeScript
- Python
- cURL
2. Handle OAuth callback
Send the user toauthorization.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
- TypeScript
- Python
- cURL
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
- TypeScript
- Python
- cURL
Delete Connector
- TypeScript
- Python
- cURL
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 returns409 while a sync for that connector is already running.
- TypeScript
- Python
- cURL
Sync mechanism
Gmail connector supports multiple sync methods:How real-time sync works
- After labels are selected, supermemory registers a Gmail API “watch” subscription when Pub/Sub is configured
- Gmail sends notifications to a Google Cloud Pub/Sub topic when emails change
- supermemory receives these notifications and fetches updated threads
- 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:Limitations
Troubleshooting
OAuth fails or missing refresh token
If OAuth fails or the connector stops syncing:- Delete the existing connector
- Create a new connector
- 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