Mailgun API defined by OpenAPI Specification (OAS) 3.1.0
Mailgun API (3.0.0)
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.
Mailgun retains metrics data for different durations based on resolution:
- Hourly: 60 days
- Daily: 1 year
- Monthly: Indefinitely
For queries that return large result sets, the API uses offset-based pagination with skip and limit request attributes.
skipspecifies how many items to offset (skip) from the beginning of the result set.limitspecifies the maximum number of items to return in a single request.
Defaults and limits:
- Default page size varies by dimension. Default for time dimension is 1500 items. All other dimensions default to 10 items.
- Maximum
limitis 1500 for the time dimension and 1000 for all other dimensions.
How pagination works:
- Start with
skip=0and a desiredlimit(for example,limit=1000). - Retrieve the next page by increasing
skipby the value oflimit: - First page:
skip=0,limit=1000 - Second page:
skip=1000,limit=1000 - Third page:
skip=2000,limit=1000 - Continue paging until fewer items than the specified
limitare returned.
Additional details:
- The response includes a
paginationobject containing the total number of available items. - Results can be sorted using the
sortparameter, for exampletime:ascortime:desc. For consistent pagination, use a deterministic sort order.
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.
Alerts
Mailgun allows you to get instant notifications on the sending metrics that matter most, configured specifically for your unique business needs and assets. Route these alerts to the channels your team relies on. Stay on top of sending performance without the need to manually monitor.
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