Mailgun API defined by OpenAPI Specification (OAS) 3.1.0
- List account IPs - detailed view
Mailgun API (3.0.0)
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.
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.
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.
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.
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 - 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.
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
- US Mailgunhttps://api.mailgun.net/v3/ips/request/new
- EU Mailgunhttps://api.eu.mailgun.net/v3/ips/request/new
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
https://api.mailgun.net/v3/ips/request/new{ "message": "success" }
Request
List IPs belonging to the account and subaccounts. For IPs linked to subaccounts, there will be an additional record returned per subaccount The detailed IP view feature must be enabled for the account.
- US Mailgunhttps://api.mailgun.net/v3/ips/details/all
- EU Mailgunhttps://api.eu.mailgun.net/v3/ips/details/all
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.mailgun.net/v3/ips/details/all?limit=10&skip=0&pool_id=string&domain_id=string&subaccount_id=string&ip=string&sort_by=string&sort_order=ascending'{ "items": [ { … }, { … }, { … } ], "total_count": 3 }
Request
Links and/or unlinks dedicated IPs to/from one or more subaccounts in a single operation. IPs linked to subaccounts can be linked to subaccount domains and placed in subaccount IP pools. The account must have the centralized IP assignment feature enabled.
Either subaccount_id (one or more) or all_subaccounts=true must be specified, but not both. When all_subaccounts=true or over 100 subaccounts are specified, the operation is applied to every subaccount asynchronously and the response will contain 'queued' instead of 'success'.
Rules for linking an IP: The IP must be a dedicated IP belonging to the parent account. The IP must not be assigned to a Dynamic IP Pool on the parent account.
Rules for unlinking an IP: The IP must not be assigned to any IP pools on the subaccount. The IP must not be assigned to any domains on the subaccount.
Request parameters are encoded as form data.
| Name | Description | Required | Type |
|---|---|---|---|
| subaccount_id | Id of a subaccount to update (may be specified multiple times). Required unless all_subaccounts is true. | false | string |
| all_subaccounts | When true, applies the operation to all subaccounts of the parent account asynchronously. Cannot be combined with subaccount_id. | false | string |
| link_ip | Dedicated IP address to link to the subaccount (may be specified multiple times) | false | string |
| unlink_ip | Dedicated IP address to unlink from the subaccount (may be specified multiple times) | false | string |
- US Mailgunhttps://api.mailgun.net/v3/ips/subaccounts
- EU Mailgunhttps://api.eu.mailgun.net/v3/ips/subaccounts
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X PATCH \
-u <username>:<password> \
https://api.mailgun.net/v3/ips/subaccounts{ "message": "success" }