Mailgun API defined by OpenAPI Specification (OAS) 3.1.0
![]() |
VOOZH | about |
Mailgun API defined by OpenAPI Specification (OAS) 3.1.0
Send email two ways via our REST API:
Reminder: You can also send email via SMTP with Mailgun. Please reference the user manual.
Domains API manages domains, domain keys and DNS verification.
An authentication standard used to prevent email spoofing.
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.
Automatic Sender Security DKIM Key APIs. To enable this feature please see 'Update a domain' API docs.
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.
Webhooks API to manage domain-specific webhooks. You can create, retrieve, update, and delete webhooks programmatically. When triggered, webhook URLs are deduplicated by event type, across account and domain levels to prevent redundant webhook sends.
The Mailgun Metrics API provides programmatic access to detailed analytics data about your email sending activity. This API allows you to query, filter, and analyze email performance metrics to gain insights into deliverability, engagement, and overall sending health.
Mailgun keeps track of every inbound and outbound message event and stores this log data. Using this logs API, this data can be queried and filtered to provide insights into the health of your email infrastructure.
Mailgun allows you to tag your email with unique identifiers. Tags are visible via our analytics tags API endpoint.
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 lets you tag each outgoing message with a custom value. When you access stats on your messages, they will be aggregated by these tags.
WARNING: This API is deprecated in favor of our new Tags 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.
Mailgun allows you to set limits on your subaccounts to help you manage usage and costs. You can create, update, retrieve, and delete limits for various pre-send features such as email previews and email validations.
Unsubscribe list stores email addresses of recipients who unsubscribed from your mailings by clicking a Mailgun generated unsubscribe link.
Email addresses of recipients who marked your messages as a spam (for ESPs that support FBL).
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
Define a list of routes to handle incoming emails. When a message matches a route expression, Mailgun can forward it on to your application via HTTP or another email address, or store the message temporarily (3 days) for subsequent retrieval.
This API allows you to manage forwarding of incoming emails.
Programatically create mailing lists.
This API allows you to store predefined templates at the account level and use them to send messages using the Sending API.
This API allows you to store predefined templates at the domain level and use them to send messages using the Sending API.
IP Pools allow you to group your dedicated IPs into customized "pools" to help manage your sending reputation for different mail sending streams.
Dynamic IP Pools allow you to group your dedicated IPs into customized "pools" based on sender reputation. Domains enrolled in Dynamic IP Pools will be assigned to a pool based on the result of periodic health checks.
The IP API endpoint allows you to access information regarding the IPs allocated to your Mailgun account that are used for outbound sending.
This endpoint retrieves the DIPP spillover settings for a specific domain.
Id of the domain to get DIPP spillover settings for
curl -i -X GET \
-u <username>:<password> \
'https://api.mailgun.net/v3/ips/domain/{name}'A 200 response
the DIPP spillover settings for the account
the ID of the IP pool that spillover IPs are assigned to
{ "extra_dedicated_ips": { "pool_id": "6a219e7515415d72b6e47358" } }
This endpoint allows you to set or update the DIPP spillover settings for a specific domain. You can specify the ID of the IP pool that spillover IPs are assigned to. The IP pool must contain at least one fully warmed IP address to be valild. To disable DIPP spillover, set the pool_id to an empty string ("").
Id of the domain to update DIPP spillover settings for
the DIPP spillover settings for the account
the ID of the IP pool that spillover IPs are assigned to
curl -i -X PATCH \
-u <username>:<password> \
'https://api.mailgun.net/v3/ips/domain/{name}' \
-H 'Content-Type: application/json' \
-d '{
"extra_dedicated_ips": {
"pool_id": "6a219e7515415d72b6e47359"
}
}'A 200 response
Response message
{ "message": "success" }
The behavior of the endpoint depends on the value of the ip parameter. It can be one of the following:
all: the entire domain pool will be removed. As far as the system is concerned, such domain will no longer exist.ip_pool: the DIPP which is currently linked to the domain will be unlinked.Note that it's impossible to alter domain IPs if a DIPP is linked to the domain.
If the account is not eligible for shared IPs, additional rules apply:
The account must have 'DIPPs' feature enabled.
Either ip or pool_id query parameter must be specified, but not both.
If the special value shared is used for the replacement IP, the account must be eligible for shared IPs. In this case the system will assign a shared IP as the replacement.
One of the following: all, ip_pool or a valid IP address.
Domain name. Converted to X-Mailgun-Domain-Id header by the middleware.
Replacement IP or special value shared.
Replacement DIPP id.
curl -i -X DELETE \
-u <username>:<password> \
'https://api.mailgun.net/v3/domains/{name}/ips/{ip}?ip=string&pool_id=string'A 200 response
Response message
{ "message": "success" }
Mailgun supports the creation, modification, and deletion of subaccounts. A subaccount is a child account of a parent account. The parent account can have multiple subaccounts. The subaccounts are created and managed by the parent account.
The custom message limit imposes a hard limit on how many messages your account can send during a calendar month.
Perform account-level CRUD operations.
The Keys API lets you view and manage API keys.
The Credentials API lets you view and manage SMTP credentials.
The IP Allowlist API lets you view and manage allowlisted IP addresses to which API key and SMTP credential usage is restricted.
Mailgun API supports viewing user entities.