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.
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.
Request
Mailgun tracks every inbound and outbound message event and retains this data for at least 3 days. See Filter expression for details about filtering expressions
Sort direction by time. Must be provided if the range end time is not specified. Can be either yes or no
Enum Value | Description |
---|---|
yes | Sort by ascending time |
no | Do not sort |
Filter by email address of a recipient. While messages are addressable to one or more recipients, each event (with one exception) tracks one recipient. See stored events for use of recipients
Specific to stored events, this field tracks all of the potential message recipients.
Filter by event severity, if exists. Currently for failed events only. See Tracking Failures
Enum Value | Description |
---|---|
temporary | Mailgun could not deliver the email to the recipient email server, but will retry |
permanent | Mailgun could not deliver the email to the recipient email server, and will drop the message without retrying sending. |
- Mock server
https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/v3/{domain_name}/events
- US Mailgun
https://api.mailgun.net/v3/{domain_name}/events
- EU Mailgun
https://api.eu.mailgun.net/v3/{domain_name}/events
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/v3/{domain_name}/events?begin=string&end=string&ascending=yes&limit=300&event=string&list=string&attachment=string&from=string&message-id=string&subject=string&to=string&size=string&recipient=string&recipients=string&tags=string&severity=temporary'
{ "items": [ { … } ], "paging": { "next": "https://api.mailgun.net/v3/samples.mailgun.org/events/W3siY...", "previous": "https://api.mailgun.net/v3/samples.mailgun.org/events/Lkawm..." } }
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