Max Plan Required: The Gmail connector is available on Max plan and above.
Quick setup
1. Create Gmail connection
- TypeScript
- Python
- cURL
2. Handle OAuth callback
After user grants permissions, Google redirects to your callback URL. The connection is automatically established and the initial sync begins.3. Check connection status
- TypeScript
- Python
- cURL
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:
Connection management
List all connections
- TypeScript
- Python
- cURL
Delete connection
- TypeScript
- Python
- cURL
Deleting a connection will:
- Stop all future syncs from Gmail
- Remove the OAuth authorization
- Keep existing synced documents in supermemory (they won’t be deleted)
Manual sync
Trigger a manual synchronization:- TypeScript
- Python
- cURL
Sync mechanism
Gmail connector supports multiple sync methods:How real-time sync works
- When a connection is created, supermemory registers a Gmail API “watch” subscription
- 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 INBOX label. Emails in other labels are synced via scheduled/manual sync.
Permissions & scopes
The Gmail connector requests the following OAuth scopes:Limitations
Troubleshooting
OAuth fails or missing refresh token
If OAuth fails or the connection stops syncing:- Delete the existing connection
- Create a new connection
- 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 connection was created recently (watch registration happens on creation)
- Trigger a manual sync to verify the connection 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