For each boolean search query, and each email address, returns how many emails in the case match (only in one mailbox when providerId is given; on a case shared with opposing counsel, only in threads the caller may see). A malformed query gets an error on its own row instead of failing the whole request.
Body
Required
-
Boolean query strings. Each is counted independently against the indexed email fields (subject, body, snippet, from/to/cc/bcc). Supports the same AND / OR / NOT / -prefix, parentheses, "quoted phrases" and wildcards as the boolean query parser.
-
Email addresses. Each is counted as the number of emails where the address appears as any participant (from/to/cc/bcc), case-insensitive.
-
Optional: narrow the counts to a single email provider (mailbox) within the case. When omitted, counts span the whole case.
curl \
--request POST 'http://api.example.com/local-emails/{caseId}/search-counts' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"queries": [
"\"confidentiality agreement\"",
"(Nigeria OR Cyprus) AND NDA"
],
"emails": [
"string"
],
"providerId": "string"
}'
{
"queries": [
"\"confidentiality agreement\"",
"(Nigeria OR Cyprus) AND NDA"
],
"emails": [
"string"
],
"providerId": "string"
}
{
"data": {
"queries": [
{
"query": "agreement AND signed",
"count": 17,
"error": "search_failed"
}
],
"emails": [
{
"email": "john.roe@example.org",
"count": 42
}
]
},
"statusCode": 200,
"timestamp": "2026-01-15T10:15:00.000Z"
}