Mailgun API defined by OpenAPI Specification (OAS) 3.1.0
| Enum Value | Description |
|---|---|
| basic | Basic/Analyst user role |
| billing | Billing user role |
| support | Support user role |
| developer | Developer user role |
| admin | Admin user role |
![]() |
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.
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.
Get users on an account
The user role by which to filter results (basic == analyst)
| Enum Value | Description |
|---|---|
| basic | Basic/Analyst user role |
| billing | Billing user role |
| support | Support user role |
| developer | Developer user role |
| admin | Admin user role |
The number of users to return
The number of users to skip
curl -i -X GET \
-u <username>:<password> \
'https://api.mailgun.net/v5/users?role=basic&limit=0&skip=0'A 200 response
total number of users on the account or the total number of users that match the query
{ "users": [ { … } ], "total": 1 }
Get details for a user on the account
The ID of the user on the account
curl -i -X GET \
-u <username>:<password> \
'https://api.mailgun.net/v5/users/{user_id}'A 200 response
the user ID
user activation status
full name of user
disablement status of user
user email address
role of user on the account
account ID
IP address from which the user opened the account, if applicable
whether the user is the account owner
any optional metadata for the user
whether 2-factor auth has been enabled for the user
whether 2-factor auth has been activated for the user
the date and time at which 2-factor auth was activated in ISO 8601 date-time format without timezone offset (UTC time) and with microseconds
the date and time at which the user password was last updated in ISO 8601 date-time format without timezone offset (UTC time) and with microseconds
Github ID, if part of Github Student Developer Pack account
Salesforce ID, if part of Salesforce platform account
status of migration to Sinch ID for user authentication, if applicable
{ "id": "123", "name": "John Doe", "activated": true, "is_disabled": false, "email": "johndoe@example.com", "email_details": { "address": "johndoe@example.com", "is_valid": true, "parts": { … } }, "role": "basic", "account_id": "567", "opened_ip": "67.111.60.111", "is_master": true, "metadata": {}, "tfa_enabled": true, "tfa_active": true, "tfa_created_at": "2022-12-20T16:52:01.892000", "password_updated_at": "2022-12-20T16:52:01.892000", "preferences": { "programming_language": "curl", "time_format": "%m/%d/%y %I:%M %p", "time_zone": "US/Eastern" }, "auth": { "method": "sinch", "prior_details": {}, "prior_method": "" }, "github_user_id": null, "salesforce_user_id": null, "migration_status": "done" }
Get one's own user details, requires use of an API key with a user_id saved on it, typically of 'web' kind
curl -i -X GET \
-u <username>:<password> \
https://api.mailgun.net/v5/users/meA 200 response
the user ID
user activation status
full name of user
disablement status of user
user email address
role of user on the account
account ID
IP address from which the user opened the account, if applicable
whether the user is the account owner
any optional metadata for the user
whether 2-factor auth has been enabled for the user
whether 2-factor auth has been activated for the user
the date and time at which 2-factor auth was activated in ISO 8601 date-time format without timezone offset (UTC time) and with microseconds
the date and time at which the user password was last updated in ISO 8601 date-time format without timezone offset (UTC time) and with microseconds
Github ID, if part of Github Student Developer Pack account
Salesforce ID, if part of Salesforce platform account
status of migration to Sinch ID for user authentication, if applicable
{ "id": "123", "name": "John Doe", "activated": true, "is_disabled": false, "email": "johndoe@example.com", "email_details": { "address": "johndoe@example.com", "is_valid": true, "parts": { … } }, "role": "basic", "account_id": "567", "opened_ip": "67.111.60.111", "is_master": true, "metadata": {}, "tfa_enabled": true, "tfa_active": true, "tfa_created_at": "2022-12-20T16:52:01.892000", "password_updated_at": "2022-12-20T16:52:01.892000", "preferences": { "programming_language": "curl", "time_format": "%m/%d/%y %I:%M %p", "time_zone": "US/Eastern" }, "auth": { "method": "sinch", "prior_details": {}, "prior_method": "" }, "github_user_id": null, "salesforce_user_id": null, "migration_status": "done" }