Searches the connected Gmail mailbox with Gmail search syntax and returns sender, subject, date and snippet per message.
curl -X POST "https://api.primaryapi.com/v1/run/gmail.search" \
-H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"subject:report newer_than:30d","limit":2}'{
"output": {
"found": true,
"data": {
"resultSizeEstimate": 2,
"nextCursor": "eyJ0IjoiMDg3NjU0MzIxMDk4NzY1NDMyMTA…",
"messages": [
{
"sizeEstimate": 5120,
"from": "Alice Example <[email protected]>",
"to": "[email protected]",
"subject": "October report", …
}
]
}
},
"credits": 1
}Input and output
6 fields
subject:report newer_than:30d.2.10 fields
Good to know
Runs as your connected Google account (read-only Gmail access).
Message bodies are not included. Read one with gmail.message.
Run the call again to refresh them.
One page per call. Send nextCursor back as cursor to read the next page.
More from Gmail. Same key, same credits.
The same key and credits work for every API.