Import Email History into AI Memory via IMAP

Your inbox holds years of context -- conversations with clients, vendor negotiations, project updates, decisions made over email. REM Labs imports email threads via standard IMAP so your AI can search across your entire communication history semantically, regardless of email provider.

What Gets Imported

The IMAP integration extracts structured content from email messages:

Gmail OAuth (Recommended)

For Gmail users, the easiest path is OAuth. In the REM Labs Console, go to Integrations and click Connect Gmail. Authorize read-only access and select which labels to sync.

IMAP Import (Any Provider)

For Outlook, Fastmail, ProtonMail Bridge, or any IMAP-compatible provider, use the IMAP import endpoint.

curl -X POST https://api.remlabs.ai/v1/memory/sync/email/import \ -H "Authorization: Bearer sk-slop-..." \ -H "Content-Type: application/json" \ -d '{ "imap_host": "imap.gmail.com", "imap_port": 993, "imap_user": "you@company.com", "imap_password": "app-specific-password", "folders": ["INBOX", "Sent", "Projects"], "since": "2025-01-01", "sync_mode": "incremental" }'

The since parameter limits the import to emails after a given date. The folders array lets you target specific IMAP folders or Gmail labels. Incremental mode uses message UIDs to only fetch new messages since the last sync.

Thread Intelligence

Individual emails are often fragments of a larger conversation. The integration groups related messages into threads using standard email headers (In-Reply-To, References, and subject-based threading). A 12-message thread about a partnership negotiation becomes one searchable memory with the complete context.

Search Your Email History

curl -X POST https://api.remlabs.ai/v1/integrations/email/search \ -H "Authorization: Bearer sk-slop-..." \ -H "Content-Type: application/json" \ -d '{ "query": "what pricing did we agree on with the design agency", "filters": {"folder": "Projects", "from": "agency@design.co"}, "limit": 10 }'

Semantic search finds the email thread titled "Re: Q2 Engagement Scope" that discusses rates and deliverables, and the follow-up thread about contract amendments -- without needing the word "pricing" to appear in any of them.

Signature and Boilerplate Removal

Email bodies are cleaned before indexing. Signatures, legal disclaimers, forwarded message headers, and quoted reply chains are stripped to keep the knowledge base focused on actual content rather than repeated boilerplate.

API Endpoints Reference

EndpointMethodDescription
/v1/memory/sync/email/importPOSTImport emails via IMAP or Gmail OAuth
/v1/integrations/email/statusGETCheck sync status and message count
/v1/integrations/email/searchPOSTSearch within the email namespace
/v1/integrations/email/foldersGETList available IMAP folders

Security: IMAP credentials are encrypted at rest and used only during sync operations. For Gmail, OAuth tokens provide read-only access with no ability to send or modify messages. You can revoke access anytime from your Google Account settings. See Email integration docs.

Make your email searchable by meaning

Free tier. Years of conversations, queryable by AI.

Get started free →