# Update domain

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

Endpoint: PUT /v4/domains/{name}
Version: 3.0.0
Security: basicAuth

## Security:

  - `basicAuth` (unknown)
    http basic

## Path parameters:

  - `name` (string, required)
    The name of the domain you want to update

## Request fields (multipart/form-data):

  - `archive_to` (string)
    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_host` (string)
    The hostname to update to. Must be in lower case

  - `message_ttl` (integer)
    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_tls` (boolean)
    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_verification` (boolean)
    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_password` (string)
    Updates the domain's SMTP credentials with the given string

  - `spam_action` (string)
    Updates the domain's spam action. Valid values are 'disabled', 'tag', and 'block'

  - `use_automatic_sender_security` (boolean)
    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_pii` (boolean)
    If set to true, Personally Identifiable Information (PII) will be redacted from the payload of any webhook posted for this domain

  - `web_scheme` (string)
    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_prefix` (string)
    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.

  - `wildcard` (boolean)
    Updates the domain's wildcard status with the given boolean

## Response 200:

  - `200` (unknown)
    A 200 response

## Response 200 fields (application/json):

  - `message` (string, required)
    Success message

  - `domain` (any, required)
    Domain object

  - `domain.archive_to` (string)
    URL that a copy of each successfully delivered message is going to be posted to.

  - `domain.created_at` (string, required)
    Timestamp indicating when the domain was created in RFC1123 format

  - `domain.id` (string, required)
    Unique identifier of the domain

  - `domain.is_disabled` (boolean, required)
    Indicates whether the domain is currently disabled

  - `domain.name` (string, required)
    Fully qualified domain name registered with Mailgun

  - `domain.require_tls` (boolean, required)
    If true Mailgun will only send messages over a TLS connection

  - `domain.skip_verification` (boolean, required)
    If true Mailgun will not verify the certificate and hostname when setting up a TLS connection

  - `domain.smtp_login` (string, required)
    SMTP login username for the domain, only present if the user provides an smtp_password. Use the Credentials API for SMTP credentials management

  - `domain.smtp_password` (string)
    Optional SMTP password for the domain used for SMTP authentication

  - `domain.spam_action` (string, required)
    Action to take when a message is flagged as spam. Options are disabled, tag, or block

  - `domain.subaccount_id` (string)
    The subaccount ID the domain belongs to. This field is only present if the domain is associated with a subaccount

  - `domain.state` (string, required)
    Current verification status of the domain

  - `domain.type` (string, required)
    Classification of the domain. Possible values are custom or sandbox

  - `domain.tracking_host` (string)
    Custom tracking host for the domain used for tracking opens and clicks if configured

  - `domain.use_automatic_sender_security` (boolean, required)
    If true Mailgun manages DKIM key generation and DNS record configuration automatically

  - `domain.webhooks_redact_pii` (boolean)
    If true Personally Identifiable Information (PII) will be redacted from the payload of any webhook posted for this domain

  - `domain.web_prefix` (string, required)
    Subdomain prefix used for open and click tracking

  - `domain.web_scheme` (string, required)
    Protocol scheme used for tracking

  - `domain.wildcard` (boolean, required)
    Indicates if the domain is a wildcard domain and can receive emails for any subdomain

  - `domain.disabled` (any)
    Optional field containing additional details about the domain's disabled status if applicable

  - `domain.disabled.code` (string, required)
    Code indicating the reason for the domain being disabled

  - `domain.disabled.note` (string, required)
    Additional information about why the domain was disabled

  - `domain.disabled.permanently` (boolean, required)
    Indicates whether the domain is permanently disabled

  - `domain.disabled.reason` (string, required)
    Additional information about why the domain was disabled

  - `domain.disabled.until` (string)
    Timestamp in RFC1123 format indicating when the domain will be re-enabled if the disablement is temporary

  - `domain.encrypt_incoming_message` (boolean, required)
    If true incoming messages to this domain will be encrypted

  - `domain.message_ttl` (integer, required)
    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

  - `receiving_dns_records` (array)
    List of DNS records required for receiving emails

  - `receiving_dns_records.is_active` (boolean, required)
    Indicates whether the DNS record is currently active

  - `receiving_dns_records.cached` (array, required)
    List of Mailguns cached values for the DNS record

  - `receiving_dns_records.name` (string)
    Name of the DNS record if applicable

  - `receiving_dns_records.priority` (string)
    Priority value for MX DNS records

  - `receiving_dns_records.record_type` (string, required)
    Type of DNS record such as MX TXT or CNAME

  - `receiving_dns_records.valid` (string, required)
    Indicates whether the DNS record is valid

  - `receiving_dns_records.value` (string, required)
    Expected value of the DNS record

  - `sending_dns_records` (array)
    List of DNS records required for sending emails

## Response 401:

  - `401` (unknown)
    A 401 response

## Response 401 fields (application/json):

  - `message` (string, required)
    Response message

## Response 404:

  - `404` (unknown)
    A 404 response

## Response 404 fields (application/json):

  - `message` (string, required)
    Response message

## Response 200 examples:

  - `Example` (unknown)

## Response 401 examples:

  - `Example` (unknown)

## Response 404 examples:

  - `Example` (unknown)

