Skip to content

Create a domain key

Request

Create a domain key. Note that once private keys are created or imported they are never exported. Alternatively, you can import an existing PEM file containing a RSA private key in PKCS #1, ASn.1 DER format. Note, the pem can be passed as a file attachment or as a form-string parameter.

Security
basicAuth
Bodymultipart/form-datarequired
signing_domainstringrequired

Signing domain to be used for the new domain key

selectorstringrequired

Selector to be used for the new domain key

bitsinteger

Key size, can be 1024 or 2048

pemstring

Private key PEM file

curl -i -X POST \
  -u '<username>:<password>' \
  https://api.mailgun.net/v1/dkim/keys \
  -H 'Content-Type: multipart/form-data' \
  -F signing_domain=string \
  -F selector=string \
  -F bits=0 \
  -F pem=string

Responses

A 200 response

Bodyapplication/json
signing_domainstringrequired
selectorstringrequired
dns_recordgithub.com-mailgun-domains-client-golang-Record (object) or null
Any of:
Response
{ "signing_domain": "example.com", "selector": "s1", "dns_record": { "cached": [], "name": "s1._domainkey.example.com", "record_type": "TXT", "valid": "unknown", "value": "k=rsa; p=<public_key>" } }