Skip to the documentation
API

Rule stats

How your rules did over a window: messages matched and failed, a series of buckets, the matches of each rule, the actions taken, the failures and the senders matched most.

GET/rules/stats

Runs the real call on your workspace.

GET /rules/stats

How your rules did over a window: messages matched and failed, a series of buckets, the matches of each rule, the actions taken, the failures and the senders matched most.

Example

Needs rules:read. since and until are ISO 8601 instants, ruleIds takes up to 50 rule ids separated by commas, grain is minute, hour or day, and offsetMinutes moves the bucket edges to where the reader's day starts. The window defaults to the last 30 days.

curl
curl "$API/rules/stats?ruleIds=rul_7f3a1c94e05d3862c1f0a44b&since=2026-10-01T00:00:00Z&offsetMinutes=120" -H "$AUTH"
Response
{  "object": "rule_stats",  "since": "2026-10-01T00:00:00.000Z",  "until": "2026-10-24T09:30:00.000Z",  "grain": "day",  "ruleIds": ["rul_7f3a1c94e05d3862c1f0a44b"],  "totals": { "matched": 928, "failed": 3, "senders": 2 },  "buckets": [{ "bucket": "2026-10-24", "matched": 41, "failed": 0 }],  "rules": [{ "id": "rul_7f3a1c94e05d3862c1f0a44b", "count": 928 }],  "actions": [{ "id": "label", "count": 928 }],  "failures": [{ "id": "forward: consent pending", "count": 3 }],  "senders": [{ "id": "[email protected]", "count": 921 }],  "scanned": 928}

totals.matched, the matched of each bucket and rules count every match in the window. totals.failed, the failed of each bucket, actions, failures, senders and totals.senders are read from the newest 2,000 matches, because what a run did is encrypted at rest, and scanned says how many that was.

A bucket with no match has no entry, so a chart has to fill the gaps.

Left without ruleIds, it counts every rule you can see, deleted rules included. A key limited to particular addresses or domains counts only the rules it can list in GET /rules.

Reference