DMARC metric aggregation

View as Markdown

The aggregation endpoint turns your DMARC reports into numbers you can chart, compare, and act on. You choose what to count, how to break it down, how to spread it over time, and what to leave out. The dmarced dashboard uses this same endpoint for its email traffic tables, graphs, and summary emails.

For tokens and the full specification, see Programmable access to email monitoring.

Request

Send a GET request with your team ID (it can be found in your team's settings) and a query query parameter as URL-encoded JSON.

Text
https://api.dmarced.eu/v1/teams/{teamId}/dmarc/aggregate?query={query}

The following example query asks: “For November, how many emails did each sending provider send, and how many were DMARC compliant? Show me each half of the month separately.”

JSON
{
  "start": "2026-11-01T00:00:00Z",
  "end": "2026-12-01T00:00:00Z",
  "metrics": ["reportedEmailCount", "dmarcCompliantEmailCount"],
  "groups": [
    { "attributes": ["sourceLabel"], "limit": 2 }
  ],
  "periods": 2,
  "filters": {
    "domainName": "example.com"
  }
}

A query has five parts. Four are required.

FieldRequiredWhat it does
startYesStart of the reporting time range as ISO 8601 timestamp.
endYesEnd of the reporting time range as ISO 8601 timestamp.
metricsYesOne or more metrics to calculate.
groupsYesHow to break the numbers down. Use [] for totals only.
periodsYesHow many equal time slices to split the range into, or null for none.
filtersNoAttribute values that emails must match to be counted.

Metrics

A metric is a number we calculate for the whole range, for every group, and for every period. Most metrics count emails. A DMARC report doesn’t list emails one by one. It says “this many emails from this sending IP got these results”, and we add those up. Counts are allocated to periods (see Periods and allocation below) and rounded to whole emails.

Email volume

MetricDescription
reportedEmailCountAll emails the reports cover.
acceptedEmailCountEmails the receiving provider accepted. Accepted doesn’t guarantee final inbox placement, see Service limitations.
quarantinedEmailCountEmails the receiving provider quarantined.
rejectedEmailCountEmails the receiving provider rejected.

Authentication

MetricDescription
dmarcCompliantEmailCountEmails where SPF or DKIM passed and aligned with the header from domain.
spfAlignedEmailCountEmails where SPF passed and aligned.
dkimAlignedEmailCountEmails where DKIM passed and aligned.
ptrConfirmedEmailCountEmails from sending IPs with a confirmed PTR record, also called forward-confirmed reverse DNS (FCrDNS).

Distinct counts

MetricDescription
dmarcReportCountThe number of (overlapping) reports the numbers come from.
dmarcRecordCountThe authentication results behind the numbers. Each one covers one DMARC report record.
sourceAddressCountNumber of sending IPs.
sourceLabelCountNumber of sending providers.

Distinct counts aren’t scaled by allocation factors. A report is either part of a period or it isn’t, so a report that overlaps two periods counts once in each. The same goes for groups: a sending IP that shows up in two groups counts once in each. Every period and group shows the right number, but the totals above them add those numbers up, so they can be higher than the number of distinct reports, authentication results, or sending IPs in the whole range. Email counts don’t have this problem, because the allocation factors split them. For an exact distinct count of the whole range, don’t use periods, and read it at the deepest group level, or at the top if you don’t use groups.

Attributes

An attribute describes where an email came from or what happened to it. You can use an attribute in groups to break numbers down by it, and in filters to keep only matching emails. The attributes fall into a few families.

Domains

AttributeDescription
domainNameThe DMARC domain, where the DMARC record is published.
headerFromDomainNameThe domain in the header from address. It can be a subdomain of the DMARC domain.

Sending IP and sending provider

AttributeDescription
sourceAddressThe sending IP.
sourceLabelThe name of the sending provider. It is the organizational domain of the sending IP’s confirmed PTR record, such as example.com. Without a confirmed PTR record, it is the IP address itself.
sourceCountryCodeThe two-letter country code of the sending IP. Can be null.
sourceAsnThe autonomous system number of the network that hosts the sending IP, such as AS12345. Can be null.
sourceAsNameThe name of that network. Can be null.

Start overviews with sourceLabel. Big senders use many IP addresses, so sourceAddress quickly gives you hundreds of groups.

Authentication and outcome

AttributeDescription
spfAlignedtrue when SPF passed and the envelope from domain aligned with the header from domain.
dkimAlignedtrue when a DKIM signature passed and its signing domain aligned with the header from domain.
dmarcComplianttrue when spfAligned or dkimAligned is true.
dispositionWhat the receiving provider did: none, pass, quarantine, or reject. Both none and pass mean it accepted the email.
emailTrafficGuidanceThe recommended next step for the traffic. See the values below.

Group by emailTrafficGuidance when you want to know what to do next, not only what happened.

Traffic guidance values

These are the values of emailTrafficGuidance, with the labels you see in the app. What each category means and what to do about it is explained in Email traffic guidance categories.

ValueLabel
noActionFully verified
improveTrustImprove trust
investigateForwardingInvestigate forwarding
authenticateSendingVerify sources
investigateFilteringInvestigate filtering
investigateRejectionInvestigate rejection

Reports

AttributeDescription
dmarcReportIdThe ID of the report.
dmarcReportGeneratorNameThe name of the receiving provider that sent the report.
dmarcReportGeneratorFromEmailThe address the report was sent from.
dmarcReportStartAt and dmarcReportEndAtThe time span the report covers.
dmarcReportSourceHow we got the report: mailbox, mailboxDmarcFail, or mailboxDuplicate.
dmarcReportFileSizeThe size of the report file in bytes.
dmarcReportRecordIndexThe position of the authentication results within the report.

Groups

Groups break metric numbers down. Without groups, you get one set of totals. With groups, you also get a list of groups, and every group has its own totals.

Each entry in groups is one level, and an entry can hold more than one attribute:

  • [{ "attributes": ["sourceLabel"] }] gives one group per sending provider.
  • [{ "attributes": ["headerFromDomainName", "sourceLabel"] }] gives one group per combination, such as each sending provider for each header from domain. The result is one flat list.

Nested groups

To nest groups, add more entries. Each entry sits inside the one before it, like folders inside folders. This query first splits traffic by recommended action, then splits each of those by sending provider:

JSON
{
  "start": "2026-11-01T00:00:00Z",
  "end": "2026-12-01T00:00:00Z",
  "metrics": ["reportedEmailCount"],
  "groups": [
    { "attributes": ["emailTrafficGuidance"] },
    { "attributes": ["sourceLabel"], "limit": 5 }
  ],
  "periods": null
}

The answer has this shape:

Text
totals
├── noAction                         totals
│   ├── mailer.example.net           totals
│   ├── news.example.org             totals
│   └── other                        totals
└── investigateForwarding            totals
    └── mailer.example.net           totals

You get totals at every level, so you don’t have to add anything up yourself. You don’t repeat the parent’s attribute in the next level. A group at a deeper level carries its parent’s values too, so the same sending provider under two different guidance values shows up as two groups.

Limits and the “other” group

By default, every level returns up to 100 groups per parent. Set limit between 1 and 100 to get fewer. We keep the groups we see first, which are usually the largest, and fold the rest into a single group with "attributes": null. Its metrics add up everything that was folded.

Each level also has groupCount. It counts every group at that level, including the folded ones, so you can say “and 12 more”.

Periods and allocation

Periods split your time range into equal slices, so you can draw a trend. "periods": 2 over a 30-day range gives two periods of 15 days. Each slice is a window with a start and an end, and periodDateRanges lists them. Every metric appears in every period, with 0 when nothing was reported.

A DMARC report covers a span of time, usually 24 hours, and doesn’t say when inside that span each email arrived. That means we can’t tell which period a single email belongs to. So we allocate. For every report and every window, we calculate an allocation factor by dividing the time the report overlaps the window by the time the report covers.

We multiply the counts of the report’s authentication results by that factor. For each group and period, we add the results up and round to whole emails.

Here’s an example. A report covers November 15 at 12:00 to November 16 at 12:00 and contains 1,000 emails. You ask for two periods that meet at November 16 at 00:00. The first window overlaps half of the report, and so does the second. Both get a factor of 0.5, so each period receives 500 emails.

If a report lies fully inside your range, its factors add up to 1, so no emails get lost or counted twice. At the edges of your range, a report that starts before start or ends after end only counts for the part inside it. The same goes for "periods": null, where the whole range is one window.

As such, allocated numbers are not raw data. Rounding happens for each group and period, so adding up raw records yourself can differ by a few emails.

For daily numbers, use a range of whole days and set periods to the number of days. A 30-day range with "periods": 30 gives you one value per day. A report that spans two days is split between them by the factors above.

Filters

Filters decide which emails are counted at all. Each filter is an attribute with one value, and an email has to match every filter to count.

JSON
{
  "filters": {
    "domainName": "example.com",
    "disposition": "reject"
  }
}

This counts only emails rejected for the DMARC domain example.com.

  • A filter takes one value.
  • Use real JSON booleans for spfAligned, dkimAligned, and dmarcCompliant: true.
  • Filtering by an attribute doesn’t add it to the answer. To see it, group by it as well.
  • By default, we only count reports with dmarcReportSource set to mailbox. Set the filter yourself to look at another source.

Response

The query from the start of this page returns this. The values are examples.

JSON
{
  "data": {
    "metrics": {
      "reportedEmailCount": 12840,
      "dmarcCompliantEmailCount": 12300
    },
    "groupCount": 4,
    "groups": [
      {
        "attributes": { 
          "sourceLabel": "mailer.example.net"
        },
        "metrics": {
          "reportedEmailCount": 9000, 
          "dmarcCompliantEmailCount": 8900 
        },
        "periods": [
          { 
            "reportedEmailCount": 5000, 
            "dmarcCompliantEmailCount": 4950 
          },
          {
            "reportedEmailCount": 4000,
            "dmarcCompliantEmailCount": 3950
          }
        ]
      },
      {
        "attributes": {
          "sourceLabel": "news.example.org"
        },
        "metrics": {
          "reportedEmailCount": 2500,
          "dmarcCompliantEmailCount": 2400
        },
        "periods": [
          {
            "reportedEmailCount": 1200,
            "dmarcCompliantEmailCount": 1150
          },
          {
            "reportedEmailCount": 1300,
            "dmarcCompliantEmailCount": 1250
          }
        ]
      },
      {
        "attributes": null,
        "metrics": {
          "reportedEmailCount": 1340,
          "dmarcCompliantEmailCount": 1000
        },
        "periods": [
          {
            "reportedEmailCount": 800,
            "dmarcCompliantEmailCount": 600
          },
          {
            "reportedEmailCount": 540,
            "dmarcCompliantEmailCount": 400
          }
        ]
      }
    ],
    "periods": [
      {
        "reportedEmailCount": 7000,
        "dmarcCompliantEmailCount": 6700
      },
      {
        "reportedEmailCount": 5840,
        "dmarcCompliantEmailCount": 5600
      }
    ],
    "periodDateRanges": [
      {
        "start": "2026-11-01T00:00:00.000Z",
        "end": "2026-11-16T00:00:00.000Z"
      },
      {
        "start": "2026-11-16T00:00:00.000Z",
        "end": "2026-12-01T00:00:00.000Z"
      }
    ]
  },
  "meta": {
  }
}
JSON fieldDescription
data.metricsThe totals for the whole range and all groups.
data.groupCountHow many groups exist at this level, including folded ones. Here it is 4, but only 3 entries are listed because 2 sending providers were folded into one.
data.groupsThe groups, each with attributes, metrics, and, if you nested more levels, its own groupCount and groups.
attributesThe values that identify a group. It is null for the folded group.
periodsOne set of metrics for each period, in the same order as periodDateRanges. Every group has its own.
data.periodDateRangesThe start and end of every period. Only present at the top.
meta.legalAttribution text, set when the query uses the sending IP, country, or network attributes. Show it next to that data.

Example queries

How much of my mail is DMARC compliant, day by day?

JSON
{
  "start": "2026-11-01T00:00:00Z",
  "end": "2026-12-01T00:00:00Z",
  "metrics": ["reportedEmailCount", "dmarcCompliantEmailCount"],
  "groups": [],
  "periods": 30
}

Which sending providers fail DMARC?

JSON
{
  "start": "2026-11-01T00:00:00Z",
  "end": "2026-12-01T00:00:00Z",
  "metrics": ["reportedEmailCount"],
  "groups": [
    { "attributes": ["sourceLabel"], "limit": 10 }
  ],
  "periods": null,
  "filters": {
    "dmarcCompliant": false
  }
}

Who got rejected, and by which receiving provider?

JSON
{
  "start": "2026-11-01T00:00:00Z",
  "end": "2026-12-01T00:00:00Z",
  "metrics": ["rejectedEmailCount"],
  "groups": [
    { "attributes": ["dmarcReportGeneratorName"] },
    { "attributes": ["sourceLabel"], "limit": 5 }
  ],
  "periods": null,
  "filters": {
    "disposition": "reject"
  }
}

Limitations

This endpoint is built for dashboards and reports. It isn’t the right tool for every job.

Aggregated data isn’t raw data

Allocation factors turn the numbers into interpreted values, not copies of what a report says. When you need the data as the receiving provider sent it, use these endpoints instead:

DMARC data isn’t live data

Data becomes visible once we have finished processing it. That includes looking up details about the sending IP, such as its PTR record. Receiving providers can also send reports up to three days late. So the most recent days are incomplete and can still change. Treat the numbers as a view of the past, not as a live feed.

Aggregation isn't meant for polling

You may use this endpoint on a schedule, such as a daily summary. Checking more often than once a day doesn't reveal more data. Receiving providers usually send their reports once a day, and we add them in batches, so more frequent queries mostly return the same numbers. We may add rate limits to this endpoint in the future.