Mailgun API (0.0.0)
Mailgun API defined by OpenAPI Specification (OAS) 3.1.0
https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/
https://api.mailgun.net/
https://api.eu.mailgun.net/
Domain Tracking
Mailgun offers tracking for clicks, unsubscribes, and opens, with optional HTTPS protocol support on tracking URLs. To enable HTTPS, Mailgun uses Let’s Encrypt with HTTP-01 challenges through your existing tracking CNAME record to issue a TLS certificate. This setup also includes support for HTTP Strict Transport Security (HSTS) for enhanced security.
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
An end date (default: current time). Must be in RFC 2822 format: https://datatracker.ietf.org/doc/html/rfc2822.html#page-14
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.
Name of the metrics to receive the stats for such as 'processed_count'.
Filters to apply to the query.
- Mock server
https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/v1/analytics/metrics
- US Mailgun
https://api.mailgun.net/v1/analytics/metrics
- EU Mailgun
https://api.eu.mailgun.net/v1/analytics/metrics
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/v1/analytics/metrics \
-H 'Content-Type: application/json' \
-d '{
"start": "Mon, 13 Nov 2023 20:56:50 -0600",
"end": "Wed, 20 Dec 2023 20:56:50 -0600",
"resolution": "month",
"duration": "1m",
"dimensions": [
"time"
],
"metrics": [
"accepted_count",
"delivered_count",
"clicked_rate",
"opened_rate"
],
"filter": {
"AND": [
{
"attribute": "domain",
"comparator": "=",
"values": [
{
"label": "example.com",
"value": "example.com"
}
]
}
]
},
"include_subaccounts": true,
"include_aggregates": true
}'
{ "start": "Mon, 13 Nov 2023 20:56:50 -0600", "end": "Wed, 20 Dec 2023 20:56:50 -0600", "resolution": "month", "duration": "1m", "pagination": { "sort": "timestamp:asc", "skip": 1, "limit": 10, "total": 1000 }, "items": [ { … }, { … } ], "aggregates": { "metrics": {} } }
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
An end date (default: current time). Must be in RFC 2822 format: https://datatracker.ietf.org/doc/html/rfc2822.html#page-14
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.
Name of the metrics to receive the stats for such as 'processed_count'.
Filters to apply to the query.
- Mock server
https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/v1/analytics/usage/metrics
- US Mailgun
https://api.mailgun.net/v1/analytics/usage/metrics
- EU Mailgun
https://api.eu.mailgun.net/v1/analytics/usage/metrics
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/v1/analytics/usage/metrics \
-H 'Content-Type: application/json' \
-d '{
"start": "Mon, 13 Nov 2023 20:56:50 -0600",
"end": "Wed, 20 Dec 2023 20:56:50 -0600",
"resolution": "month",
"duration": "1m",
"dimensions": [
"time"
],
"metrics": [
"accessibility_count",
"accessibility_failed_count",
"domain_blocklist_monitoring_count",
"email_preview_count",
"email_preview_failed_count",
"email_validation_bulk_count",
"email_validation_count",
"email_validation_list_count",
"email_validation_mailgun_count",
"email_validation_mailjet_count",
"email_validation_public_count",
"email_validation_single_count",
"email_validation_valid_count",
"image_validation_count",
"image_validation_failed_count",
"ip_blocklist_monitoring_count",
"link_validation_count",
"link_validation_failed_count",
"processed_count",
"seed_test_count"
],
"filter": {
"AND": [
{
"attribute": "subaccount",
"comparator": "=",
"values": [
{
"label": "12345",
"value": "12345"
}
]
}
]
},
"include_subaccounts": true,
"include_aggregates": true
}'
{ "start": "Mon, 13 Nov 2023 20:56:50 -0600", "end": "Wed, 20 Dec 2023 20:56:50 -0600", "resolution": "month", "duration": "1m", "pagination": { "sort": "timestamp:asc", "skip": 1, "limit": 10, "total": 1000 }, "items": [ { … }, { … } ], "aggregates": { "metrics": {} } }
Stats
Mailgun collects many different events and generates event statistics which are available in your Control Panel. This data is also available via our stats API endpoint.
WARNING: This API is deprecated in favor of our Metrics API.
Events
Mailgun keeps track of every inbound and outbound message event and stores this data for at least 3 days.
WARNING: This API is deprecated in favor of our Logs API.
Bounces
Bounces - Bounce list stores events of delivery failures due to permanent recipient mailbox errors such as non-existent mailbox. Soft bounces (for example, mailbox is full) and other failures (for example, ESP rejects an email because it thinks it is spam) are not added to the list.
Allowlist
The allowlist API provides the ability to allowlist specific addresses from being added to bounce list. You can allowlist by domain name (i.e example.com) or by specific address (i.e. alice@example.com). Mailgun doesn’t add an address to bounce list if the address is allowlisted. This API is very useful if you test against your private services and don’t want to constantly clean up bounce lists