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.
Account Webhooks
Webhooks API to manage account-specific webhooks. You can create, retrieve, update, and delete webhooks programmatically. Account-level webhooks are configured independently for US and EU regions. When triggered, webhook URLs are deduplicated by event type, across account and domain levels to prevent redundant webhook sends.
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.
- US Mailgun
https://api.mailgun.net/v1/thresholds/alerts/send
- EU Mailgun
https://api.eu.mailgun.net/v1/thresholds/alerts/send
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
https://api.mailgun.net/v1/thresholds/alerts/sendA 200 response
List of send alerts.
A list of alert channels to notify.
| Items Enum Value | Description |
|---|---|
| slack | Slack |
| webhook | Webhook |
A list of filters to apply to the alert.
The metric being monitored.
| Enum Value | Description |
|---|---|
| hard_bounce_rate | Hard bounce rate |
| temporary_fail_rate | Temporary fail rate |
| delivered_rate | Delivery rate |
| complained_rate | Complaint rate |
The comparison operator.
| Enum Value | Description |
|---|---|
| = | Equal |
| != | Not equal |
| < | Less than |
| <= | Less than or equal |
| > | Greater than |
| >= | Greater than or equal |
The dimension to apply to the metric.
| Enum Value | Description |
|---|---|
| domain | Sender domain name, e.g. example.com |
| ip | Sending IP address |
| ip_pool | IP Pool ID |
| recipient_provider | Recipient Provider, e.g. Gmail, Other US, etc. |
| subaccount | Subaccount name |
{ "items": [ { … }, { … } ], "total": 2 }
The metric being monitored.
| Enum Value | Description |
|---|---|
| hard_bounce_rate | Hard bounce rate |
| temporary_fail_rate | Temporary fail rate |
| delivered_rate | Delivery rate |
| complained_rate | Complaint rate |
The comparison operator.
| Enum Value | Description |
|---|---|
| = | Equal |
| != | Not equal |
| < | Less than |
| <= | Less than or equal |
| > | Greater than |
| >= | Greater than or equal |
The dimension to apply to the metric.
| Enum Value | Description |
|---|---|
| domain | Sender domain name, e.g. example.com |
| ip | Sending IP address |
| ip_pool | IP Pool ID |
| recipient_provider | Recipient Provider, e.g. Gmail, Other US, etc. |
| subaccount | Subaccount name |
A list of alert channels to notify.
| Items Enum Value | Description |
|---|---|
| slack | Slack |
| webhook | Webhook |
A list of filters to apply to the alert.
- US Mailgun
https://api.mailgun.net/v1/thresholds/alerts/send
- EU Mailgun
https://api.eu.mailgun.net/v1/thresholds/alerts/send
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
https://api.mailgun.net/v1/thresholds/alerts/send \
-H 'Content-Type: application/json' \
-d '{
"name": "hard bounce rate",
"metric": "hard_bounce_rate",
"comparator": "<",
"limit": ".99",
"dimension": "subaccount",
"alert_channels": [
"email",
"webhook",
"slack"
],
"period": "1h"
}'A 200 response
A list of alert channels to notify.
| Items Enum Value | Description |
|---|---|
| slack | Slack |
| webhook | Webhook |
A list of filters to apply to the alert.
The metric being monitored.
| Enum Value | Description |
|---|---|
| hard_bounce_rate | Hard bounce rate |
| temporary_fail_rate | Temporary fail rate |
| delivered_rate | Delivery rate |
| complained_rate | Complaint rate |
The comparison operator.
| Enum Value | Description |
|---|---|
| = | Equal |
| != | Not equal |
| < | Less than |
| <= | Less than or equal |
| > | Greater than |
| >= | Greater than or equal |
The dimension to apply to the metric.
| Enum Value | Description |
|---|---|
| domain | Sender domain name, e.g. example.com |
| ip | Sending IP address |
| ip_pool | IP Pool ID |
| recipient_provider | Recipient Provider, e.g. Gmail, Other US, etc. |
| subaccount | Subaccount name |
{ "id": "915ff385-0a9a-4087-86d5-6727ea7d9b49", "parent_account_id": "12345", "subaccount_id": "67890", "name": "delivery rate", "created_at": "2026-02-01T10:30:00Z", "updated_at": "2026-02-01T10:30:00Z", "last_checked": "2026-02-01T10:30:00Z", "alert_channels": [ "email", "webhook", "slack" ], "metric": "delivered_rate", "comparator": "<", "limit": ".99", "dimension": "subaccount", "period": "1h" }
- US Mailgun
https://api.mailgun.net/v1/thresholds/alerts/send/{name}
- EU Mailgun
https://api.eu.mailgun.net/v1/thresholds/alerts/send/{name}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.mailgun.net/v1/thresholds/alerts/send/{name}'A 200 response
A list of alert channels to notify.
| Items Enum Value | Description |
|---|---|
| slack | Slack |
| webhook | Webhook |
A list of filters to apply to the alert.
The metric being monitored.
| Enum Value | Description |
|---|---|
| hard_bounce_rate | Hard bounce rate |
| temporary_fail_rate | Temporary fail rate |
| delivered_rate | Delivery rate |
| complained_rate | Complaint rate |
The comparison operator.
| Enum Value | Description |
|---|---|
| = | Equal |
| != | Not equal |
| < | Less than |
| <= | Less than or equal |
| > | Greater than |
| >= | Greater than or equal |
The dimension to apply to the metric.
| Enum Value | Description |
|---|---|
| domain | Sender domain name, e.g. example.com |
| ip | Sending IP address |
| ip_pool | IP Pool ID |
| recipient_provider | Recipient Provider, e.g. Gmail, Other US, etc. |
| subaccount | Subaccount name |
{ "id": "915ff385-0a9a-4087-86d5-6727ea7d9b49", "parent_account_id": "12345", "subaccount_id": "67890", "name": "delivery rate", "created_at": "2026-02-01T10:30:00Z", "updated_at": "2026-02-03T14:15:00Z", "last_checked": "2026-02-04T16:00:00Z", "alert_channels": [ "email", "webhook", "slack" ], "metric": "delivered_rate", "comparator": "<", "limit": ".99", "dimension": "subaccount", "period": "1h" }
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