Skip to content

Update domain

Request

Update domain configuration like smtp credentials, enable/disable automatic sender security, spam actions, wildcard, or tracking web scheme.

Security
basicAuth
Path
namestringrequired

The name of the domain you want to update

Bodymultipart/form-datarequired
archive_tostring

If set to a URL, then each successfully delivered message will be submitted in an HTTP POST request to the URL. The Content-Type of the POST requests is application/mime and the request body is exactly what the recipient SMTP server received.

mailfrom_hoststring

The hostname to update to. Must be in lower case

message_ttlinteger

Specifies the time-to-live (TTL) in seconds for retrieving both incoming and outgoing messages. The maximum TTL value is determined by your subscription plan.

require_tlsboolean

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.

skip_verificationboolean

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.

smtp_passwordstring

Updates the domain's SMTP credentials with the given string

spam_actionstring

Updates the domain's spam action. Valid values are 'disabled', 'tag', and 'block'

use_automatic_sender_securityboolean

Enable or disable Automatic Sender Security. If enabled, requires setting DNS CNAME entries for DKIM keys instead of a TXT record. Domain must be reverified after changing this field. Defaults to false

webhooks_redact_piiboolean

If set to true, Personally Identifiable Information (PII) will be redacted from the payload of any webhook posted for this domain

web_schemestring

Updates 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.

web_prefixstring

This updates the web prefix used for a domain's tracking features. Must be a valid atom. Nothing will be updated if omitted. This impacts click, open, and unsubscribe tracking features.

Note: Updating the web prefix for a domain will require also updating the domain's DNS to include the CNAME record to match. For example, if you set the web prefix to zed for the domain my-domain.com, the corresponding CNAME zed.my-domain.com will need to be created in your domain's dns zone.

wildcardboolean

Updates the domain's wildcard status with the given boolean

curl -i -X PUT \
  -u '<username>:<password>' \
  'https://api.mailgun.net/v4/domains/{name}' \
  -H 'Content-Type: multipart/form-data' \
  -F archive_to=string \
  -F mailfrom_host=string \
  -F message_ttl=0 \
  -F require_tls=true \
  -F skip_verification=true \
  -F smtp_password=string \
  -F spam_action=string \
  -F use_automatic_sender_security=true \
  -F webhooks_redact_pii=true \
  -F web_scheme=string \
  -F web_prefix=string \
  -F wildcard=true

Responses

A 200 response

Bodyapplication/json
messagestringrequired

Success message

domaingithub.com-mailgun-domains-client-golang-Domain (object) or nullrequired
Any of:

Domain object

receiving_dns_recordsArray of any

List of DNS records required for receiving emails

sending_dns_recordsArray of any

List of DNS records required for sending emails

Response
{ "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" }, "receiving_dns_records": [ {} ], "sending_dns_records": [ {} ] }