Skip to content

Search

MoMail’s search API uses vector embeddings to enable semantic search. Find emails by meaning, not just keywords.

Perform a semantic search across your emails.

POST /search
{
"query": "Q4 budget discussions from Sarah",
"domain": "example.com",
"limit": 20,
"offset": 0
}
FieldTypeRequiredDescription
querystringYesNatural language search query
domainstringNoFilter by specific domain
limitnumberNoMaximum results (1-100, default: 20)
offsetnumberNoResults to skip (for pagination)
{
"success": true,
"data": [
{
"email_id": "msg_abc123",
"subject": "Q4 Budget Review - Action Required",
"from": "sarah@example.com",
"date": "2024-01-15T10:30:00.000Z",
"snippet": "Hi team, I wanted to discuss our Q4 budget allocation...",
"score": 0.92
}
],
"meta": {
"page": 1,
"limit": 20,
"total": 45,
"hasMore": true
}
}
FieldTypeDescription
email_idstringUnique email identifier
subjectstringEmail subject line
fromstringSender email address
datestringISO 8601 timestamp
snippetstringPreview of email body (first 200 characters)
scorenumberSimilarity score (0-1, higher is better)

Get autocomplete suggestions for search queries.

GET /search/suggestions?q={query}
ParameterTypeRequiredDescription
qstringYesPartial search query
{
"success": true,
"data": [
"budget Q4",
"budget review",
"budget meeting",
"budget allocation"
]
}

MoMail’s semantic search understands natural language:

QueryFinds emails about…
“invoices from last month”Invoices received recently
”meeting notes with the design team”Meeting summaries and notes
”urgent issues requiring attention”High-priority problems
”project delays and timeline updates”Schedule changes
”feedback on the proposal”Reviews and comments

The score field indicates how relevant each result is:

ScoreRelevance
0.90-1.00Highly relevant
0.70-0.89Very relevant
0.50-0.69Moderately relevant
0.30-0.49Somewhat relevant
Below 0.30Weak match

Search endpoints have specific rate limits:

PlanSearches per Minute
Free10
Pro60
Enterprise300
Terminal window
# Search emails
curl -X POST https://api.momail.io/v1/search \
-H "X-API-Key: your_key" \
-H "Content-Type: application/json" \
-d '{
"query": "Q4 budget discussions",
"limit": 10
}'
# Get suggestions
curl "https://api.momail.io/v1/search/suggestions?q=budget" \
-H "X-API-Key: your_key"

While the basic search uses semantic matching, you can combine it with domain filtering:

{
"query": "project updates",
"domain": "company.com",
"limit": 50
}

For large result sets, use pagination:

async function searchAll(query) {
const allResults = [];
let offset = 0;
const limit = 100;
while (true) {
const response = await fetch('https://api.momail.io/v1/search', {
method: 'POST',
headers: { 'X-API-Key': 'your_key', 'Content-Type': 'application/json' },
body: JSON.stringify({ query, limit, offset })
}).then(r => r.json());
allResults.push(...response.data);
if (!response.meta.hasMore) break;
offset += limit;
}
return allResults;
}