Mailgun collects many different events and generates event metrics which are available in your Control Panel. This data is also available via our analytics metrics API endpoint.
Gets filtered metrics for an account
end | string An end date (default: current time). Must be in RFC 2822 format: https://datatracker.ietf.org/doc/html/rfc2822.html#page-14 |
start | string A start date (default: 7 days before current time). Must be in RFC 2822 format: https://datatracker.ietf.org/doc/html/rfc2822.html#page-14 |
dimensions | Array of strings Attributes of the metric data such as 'time' 'domain' 'ip' 'ip_pool' 'recipient_domain' 'tag' 'country' 'subaccount'. |
resolution | string A resolution in the format of 'day' 'hour' 'month'. Default is day. |
object Filters to apply to the query. | |
metrics | Array of strings Name of the metrics to receive the stats for such as 'accepted_count' 'delivered_count' 'accepted_rate'. |
include_aggregates | boolean Include top-level aggregate metrics. |
include_subaccounts | boolean Include stats from all subaccounts. |
duration | string A duration in the format of '1d' '2h' '2m'. If duration is provided then it is calculated from the end date and overwrites the start date. |
{- "start": "Mon, 13 Nov 2023 20:56:50 -0600",
- "end": "Wed, 20 Dec 2023 20:56:50 -0600",
- "metrics": [
- "accepted_count",
- "delivered_count",
- "clicked_rate",
- "opened_rate"
], - "filter": {
- "AND": [
- {
- "attribute": "domain",
- "comparator": "=",
- "values": [
- {
- "label": "example.com",
- "value": "example.com"
}
]
}
]
}, - "resolution": "month",
- "include_aggregates": true,
- "include_subaccounts": true,
- "duration": "1m",
- "dimensions": [
- "time"
]
}
{- "duration": "1m",
- "items": [
- {
- "dimensions": [
- {
- "dimension": "time",
- "display_value": "Wed, 01 Nov 2023 00:00:00 +0000",
- "value": "Wed, 01 Nov 2023 00:00:00 +0000"
}
], - "metrics": {
- "accepted_count": 40,
- "accepted_incoming_count": 10,
- "accepted_outgoing_count": 30,
- "clicked_count": 50,
- "clicked_rate": "0.8300",
- "delivered_count": 60,
- "delivered_http_count": 20,
- "delivered_optimized_count": 0,
- "delivered_smtp_count": 40,
- "opened_count": 55
}
}, - {
- "dimensions": [
- {
- "dimension": "time",
- "display_value": "Fri, 01 Dec 2023 00:00:00 +0000",
- "value": "Fri, 01 Dec 2023 00:00:00 +0000"
}
], - "metrics": {
- "accepted_count": 40,
- "accepted_incoming_count": 10,
- "accepted_outgoing_count": 30,
- "clicked_count": 50,
- "clicked_rate": "0.8300",
- "delivered_count": 60,
- "delivered_http_count": 20,
- "delivered_optimized_count": 0,
- "delivered_smtp_count": 40,
- "opened_count": 55
}
}
], - "end": "Wed, 20 Dec 2023 20:56:50 -0600",
- "start": "Mon, 13 Nov 2023 20:56:50 -0600",
- "resolution": "month"
}