Secure tracking

Mailgun supports enabling the HTTPS protocol on open, click and unsubscribe tracking URLs. Mailgun utilizes Let’s Encrypt with HTTP-01 challenges via your existing tracking CNAME record to issue a TLS certificate. This configuration also supports HTTP Strict Transport Security (HSTS).

Status of x509 TLS certificate

get/v2/x509/{domain}/status

Get x509 TLS certificate and status

SecuritybasicAuth
Request
path Parameters
domain
required
string

The tracking domain of the TLS certificate, formatted as webPrefix.domainName from domains settings

Responses
200

A 200 response

Response Schema: application/json
status
required
object
error
required
string
certificate
string
404

A 404 response

Request samples
Response samples
application/json
{
  • "status": "expired",
  • "error": "x509 certificate has expired",
  • "certificate": "{CERT}"
}

Initiate regeneration of an expired x509 TLS certificate

put/v2/x509/{domain}

Initiates regeneration of an expired TLS certificate for the tracking domain in a background task. Once generation is enqueued, you may poll status endpoint in location field to check for success. This will not regenerate an existing certificate that is still valid

SecuritybasicAuth
Request
path Parameters
domain
required
string

The tracking domain of the TLS certificate, formatted as webPrefix.domainName from domains settings

Responses
202

A 202 response

400

A 400 response

402

A 402 response

404

A 404 response

409

A 409 response

429

A 429 response

Request samples
Response samples
application/json
{
  • "message": "Initiated x509 key pair generation",
  • "location": "/v2/x509/example.com/status"
}

Initiate generation of an x509 TLS certificate

post/v2/x509/{domain}

Initiates generation of a TLS certificate for the tracking domain in a background task. Once generation is enqueued, you may poll the status endpoint in location field to check for success

SecuritybasicAuth
Request
path Parameters
domain
required
string

The tracking domain of the TLS certificate, formatted as webPrefix.domainName from domains settings

Responses
202

A 202 response

400

A 400 response

402

A 402 response

404

A 404 response

409

A 409 response

Request samples
Response samples
application/json
{
  • "message": "Initiated x509 key pair generation",
  • "location": "/v2/x509/example.com/status"
}