diff --git a/source/includes/rest/_metrics.md b/source/includes/rest/_metrics.md index 9d8cfd0c451..61ff5ddb687 100644 --- a/source/includes/rest/_metrics.md +++ b/source/includes/rest/_metrics.md @@ -103,7 +103,7 @@ Dates are interpreted in the account owner's time zone. ``` Every rate is calculated against `sends` and rounded to four decimal places. The same object is -used for the report `summary` and for each email's `email_metric`. +used for the report `summary`, for each email's `email_metric`, and for each `series` entry. @@ -268,6 +268,34 @@ const body = await response.json(); } ``` +> With interval=week, the response adds series, one entry per week: + +```json +{ + "summary": { ... }, + "series": [ + { + "start_date": "2026-01-01", + "end_date": "2026-01-04", + "sends": 1000, + "deliveries": 970, + ... + }, + { + "start_date": "2026-01-05", + "end_date": "2026-01-11", + "sends": 0, + "deliveries": 0, + ... + }, + ... + ], + "emails_total": 3, + "emails_truncated": false, + "emails": [ ... ] +} +``` + > If the filters match no emails, the summary is zeroed and no emails are returned: ```json @@ -306,7 +334,8 @@ const body = await response.json(); } ``` -> If the report cannot be produced in time, responds with a 503 Service Unavailable: +> If the report cannot be produced in time, responds with a 503 Service Unavailable +> and a Retry-After header indicating when to try again: ```json { @@ -324,6 +353,20 @@ that matched, and `emails_truncated` is `true` when that is more than `emails` l rest, call again with `limit` set to `emails_total`, up to 1,000; beyond that the full list isn't available. This endpoint is not paginated. +Metrics count the emails sent in the date range, with every open, click, bounce, unsubscribe, +complaint, and order they have received since. + +With `interval` (`day`, `week`, or `month`), the response adds `series`: one entry per period in +the date range, oldest first, including periods with nothing sent (all zeros). Each entry has a +`start_date`, an `end_date`, and every `summary` key, with rates calculated from that period's own +counts; the entries add up to `summary`. Periods are by send date: an entry counts the emails sent +in that period and everything they have received since, so a recent period keeps growing as late +opens and clicks arrive. Weeks start on Monday and months are calendar months. The first and last +periods are cut to the date range, so they can be partial. A Single-Email Campaign whose sending +crosses the edge of the date range (sent by time zone or in batches) counts in full, in the first +or last period. To compare periods, such as this month against last month, make one call covering +both with the matching `interval`. `emails` always holds totals per email. + Rule- and form-automation emails appear only in unfiltered results. `broadcast_ids` reaches only Single-Email Campaign emails, `workflow_ids` only Workflow emails, and `campaign_ids` only Email Series Campaign emails, so no filter can target them. @@ -368,6 +411,11 @@ Requests that exceed any of these limits are rejected with a `400 Bad Request`. This endpoint has its own rate limit, separate from the standard API rate limit. Limits are applied per account. +Responses are cached per request: about 15 minutes for date ranges ending today or yesterday, 2 +hours for ranges ending in the last week, and 24 hours for older ranges. Repeating an identical +request returns the cached response and does not count toward the rate limit, and neither do +requests that are rejected or whose filters match no emails. +
@@ -377,7 +425,7 @@ applied per account. - + @@ -421,6 +469,10 @@ applied per account. + + + +
20 requests20 uncached requests Per hour
limit Optional. The maximum number of emails to list in emails, a whole number from 1 to 1,000. Defaults to 100. Does not change summary or emails_total.
intervalOptional. day, week, or month. Adds series, the metrics for each period by send date. Omit for totals only.