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/
- Mock server
https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/v4/domains
- US Mailgun
https://api.mailgun.net/v4/domains
- EU Mailgun
https://api.eu.mailgun.net/v4/domains
- 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/v4/domains?limit=0&skip=0&state=string&sort=string&authority=string&search=string&include_subaccounts=true'
A 200 response
List of domains
If true Mailgun will not verify the certificate and hostname when setting up a TLS connection
Action to take when a message is flagged as spam. Options are disabled
The subaccount ID the domain belongs to. This field is only present if the domain is associated with a subaccount
Custom tracking host for the domain used for tracking opens and clicks if configured
If true Mailgun manages DKIM key generation and DNS record configuration automatically
Indicates if the domain is a wildcard domain and can receive emails for any subdomain
Optional field containing additional details about the domain's disabled status if applicable
Optional field containing additional details about the domain's disabled status if applicable
If true incoming messages to this domain will be encrypted
{ "total_count": 1, "items": [ { … } ] }
Set the DKIM host name for the domain that is being created. Note, the value must be a valid domain name, and can be the domain name being created, a subdomain of the domain being created, or the root domain. This parameter cannot be used in conjunction with force_dkim_authority or force_root_dkim_host.
Explicitly set the value of the DKIM selector for the domain being created. If the domain key does not already exist, one will be created. The selector must be a valid atom per RFC2822. e.g valid value foobar
, invalid value foo.bar
https://datatracker.ietf.org/doc/html/rfc2822#section-3.2.4
Enable encrypting incoming messages for the given domain. This cannot be altered via API after being set for security purposes. Reach out to Support to disable if necessary. Default to false
If set to true, the domain will be the DKIM authority for itself even if the root domain is registered on the same mailgun account. If set to false, the domain will have the same DKIM authority as the root domain registered on the same mailgun account. Default to false.
If set to true, the root domain will be the DKIM Host for the domain being created even if the root domain itself is not registered with Mailgun. The domain being created will still need to pass domain verification with valid spf records for the domain and valid DKIM record for the root domain. This does not effect the smtp mail-from host for the domain being created. The mail-from host will remain the domain name being created, not the root domain.
Determines whether the domain will accept email for sub-domains when sending messages. Default to false.
An optional, comma-separated list of IP addresses to be assigned to this domain. If not specified, all dedicated IP addresses on the account will be assigned. If the request cannot be fulfilled (e.g. a requested IP is not assigned to the account, etc), a 400 will be returned.
If set to true, this requires messages for the domain only be sent over a TLS connection. If a TLS connection cannot be established, Mailgun will not deliver the message.
If set to false, Mailgun will still try and upgrade the connection, but if Mailgun cannot, the message will be delivered over a plaintext SMTP connection.
The default value is false.
If set to true, the certificate and hostname will not be verified when trying to establish a TLS connection and Mailgun will accept any certificate during delivery of a message.
If set to false, Mailgun will verify the certificate and hostname. If either one can not be verified, a TLS connection will not be established.
The default value is false.
Disabled, block or tag. Default to disabled. If disabled, no spam filtering will occur for inbound messages.
If block, inbound spam messages will not be delivered.
If tag, inbound messages will be tagged with a spam header. See Spam Filter.
Enable Automatic Sender Security. This requires setting DNS CNAME entries for DKIM keys instead of a TXT record. Defaults to false.
Sets your open, click and unsubscribe URLs domain name prefix. Links rewritten or added by Mailgun in your emails will look like <web_scheme>://<web_prefix>.<domain_name>/... Default to email
Sets your open, click and unsubscribe URLs to use http or https. Value either http
or https
. Defaults to http. In order for https to work, you must have a valid cert created for your domain. See Domain Tracking for TLS cert generation.
- Mock server
https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/v4/domains
- US Mailgun
https://api.mailgun.net/v4/domains
- EU Mailgun
https://api.eu.mailgun.net/v4/domains
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/v4/domains \
-H 'Content-Type: multipart/form-data' \
-F dkim_host_name=string \
-F dkim_key_size=string \
-F dkim_selector=string \
-F encrypt_incoming_message=true \
-F force_dkim_authority=true \
-F force_root_dkim_host=true \
-F wildcard=true \
-F name=string \
-F pool_id=string \
-F ips=string \
-F require_tls=true \
-F skip_verification=true \
-F spam_action=string \
-F smtp_password=string \
-F use_automatic_sender_security=true \
-F web_prefix=string \
-F web_scheme=string \
-F message_ttl=0
A 200 response
Details of the newly created domain
Details of the newly created domain
If true Mailgun will not verify the certificate and hostname when setting up a TLS connection
Action to take when a message is flagged as spam. Options are disabled
The subaccount ID the domain belongs to. This field is only present if the domain is associated with a subaccount
Custom tracking host for the domain used for tracking opens and clicks if configured
If true Mailgun manages DKIM key generation and DNS record configuration automatically
Indicates if the domain is a wildcard domain and can receive emails for any subdomain
Optional field containing additional details about the domain's disabled status if applicable
Optional field containing additional details about the domain's disabled status if applicable
If true incoming messages to this domain will be encrypted
List of DNS records required for receiving emails
Indicates whether the DNS record is currently active
List of Mailguns cached values for the DNS record
{ "message": "Domain DNS records have been created", "domain": { "created_at": "Thu, 13 Oct 2011 18:02:00 GMT", "id": "123456789012345678901234", "name": "example.com", "require_tls": true, "smtp_login": "postmaster@example.com", "spam_action": "disabled", "state": "active", "type": "sandbox", "use_automatic_sender_security": true, "web_prefix": "email", "web_scheme": "http", "encrypt_incoming_message": true, "message_ttl": 86400 }, "receiving_dns_records": [ { … } ], "sending_dns_records": [ { … } ] }
- Mock server
https://documentation.mailgun.com/_mock/docs/mailgun/api-reference/openapi-final/v4/domains/{name}
- US Mailgun
https://api.mailgun.net/v4/domains/{name}
- EU Mailgun
https://api.eu.mailgun.net/v4/domains/{name}
- 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/v4/domains/{name}?h%3Aextended=true&h%3Awith_dns=true'
A 200 response
Domain details
Domain details
If true Mailgun will not verify the certificate and hostname when setting up a TLS connection
Action to take when a message is flagged as spam. Options are disabled
The subaccount ID the domain belongs to. This field is only present if the domain is associated with a subaccount
Custom tracking host for the domain used for tracking opens and clicks if configured
If true Mailgun manages DKIM key generation and DNS record configuration automatically
Indicates if the domain is a wildcard domain and can receive emails for any subdomain
Optional field containing additional details about the domain's disabled status if applicable
Optional field containing additional details about the domain's disabled status if applicable
If true incoming messages to this domain will be encrypted
List of DNS records required for receiving emails
{ "domain": { "created_at": "Thu, 13 Oct 2011 18:02:00 GMT", "id": "123456789012345678901234", "name": "example.com", "require_tls": true, "smtp_login": "postmaster@example.com", "spam_action": "disabled", "state": "active", "type": "sandbox", "use_automatic_sender_security": true, "web_prefix": "email", "web_scheme": "http" } }
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.
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