# Everything about invoice 1042
curl -s "https://api.gork.email/v1/messages?q=invoice%201042" \
-H "Authorization: Bearer gork_live_YOUR_API_KEY"
# Mail from a domain, since a date, received only
curl -s "https://api.gork.email/v1/messages?from=acme.com&since=2026-09-01&direction=inbound" \
-H "Authorization: Bearer gork_live_YOUR_API_KEY"
import { GorkClient } from "@gork/sdk"
const client = new GorkClient({ apiKey: process.env.GORK_API_KEY })
const hits = await client.messages.search("invoice 1042")
const recent = await client.messages.list({ from: "acme.com", since: "2026-09-01" })
{
"data": [
{
"id": "msg_90e38dfb4a2c",
"direction": "inbound",
"fromAddress": "billing@acme.com",
"toAddresses": ["agent@yourdomain.com"],
"subject": "Invoice 1042",
"status": "received",
"createdAt": "2026-09-11T08:00:00.000Z"
}
]
}
Messages
Search Messages
Search a mailbox by free text and filters — subject, body, sender and recipients.
GET
/
v1
/
messages?q=
# Everything about invoice 1042
curl -s "https://api.gork.email/v1/messages?q=invoice%201042" \
-H "Authorization: Bearer gork_live_YOUR_API_KEY"
# Mail from a domain, since a date, received only
curl -s "https://api.gork.email/v1/messages?from=acme.com&since=2026-09-01&direction=inbound" \
-H "Authorization: Bearer gork_live_YOUR_API_KEY"
import { GorkClient } from "@gork/sdk"
const client = new GorkClient({ apiKey: process.env.GORK_API_KEY })
const hits = await client.messages.search("invoice 1042")
const recent = await client.messages.list({ from: "acme.com", since: "2026-09-01" })
{
"data": [
{
"id": "msg_90e38dfb4a2c",
"direction": "inbound",
"fromAddress": "billing@acme.com",
"toAddresses": ["agent@yourdomain.com"],
"subject": "Invoice 1042",
"status": "received",
"createdAt": "2026-09-11T08:00:00.000Z"
}
]
}
Mail accumulates fast when an agent runs on its own. Instead of pulling the
whole inbox and filtering client-side, ask for exactly what you need: the
invoice, the reset link, everything a customer sent this week.
Search is case-insensitive and matches across the subject, the body,
the sender (address and display name) and the recipients. Results are
newest first.
Query parameters
string
Free-text terms. Up to 200 characters.
% and _ are treated literally, so
searching for 50% does not match everything.string
Restrict the search to one inbox. Inbox-bound keys are always restricted to
their own inbox regardless of this value.
string
inbound for received mail, outbound for sent mail.string
Substring match against the sender address (
from=acme.com).string
ISO date or timestamp lower bound, e.g.
2026-09-01.string
ISO date or timestamp upper bound.
number
default:"50"
Maximum results, 1–100.
# Everything about invoice 1042
curl -s "https://api.gork.email/v1/messages?q=invoice%201042" \
-H "Authorization: Bearer gork_live_YOUR_API_KEY"
# Mail from a domain, since a date, received only
curl -s "https://api.gork.email/v1/messages?from=acme.com&since=2026-09-01&direction=inbound" \
-H "Authorization: Bearer gork_live_YOUR_API_KEY"
import { GorkClient } from "@gork/sdk"
const client = new GorkClient({ apiKey: process.env.GORK_API_KEY })
const hits = await client.messages.search("invoice 1042")
const recent = await client.messages.list({ from: "acme.com", since: "2026-09-01" })
{
"data": [
{
"id": "msg_90e38dfb4a2c",
"direction": "inbound",
"fromAddress": "billing@acme.com",
"toAddresses": ["agent@yourdomain.com"],
"subject": "Invoice 1042",
"status": "received",
"createdAt": "2026-09-11T08:00:00.000Z"
}
]
}
From an agent (MCP)
Thegork_search_emails tool exposes the same query with direction, from,
since and until filters, and returns a compact list of hits.