Set DKIM record for hostedemail domains using API

This article explains how to add DKIM record to hostedemail domains using API rather than adding the private key and selector manually using the Mail admin interface.


Generate DKIM public key, private key, and key selector

First, you need to generate a public key, private key, and domain key selector to add the DKIM record on a hostedemail domain. You may use online tools like SparkPost DKIM wizard. Enter the domain name, domain key selector, and the key size.

Note: If you are using the default systemDNS nameservers, please generate the key in 1024 bits, not 2048 bits.  

DKIM.png

Back to top

Add public key as a TXT record on the domain

Once the DKIM key is created, the next step is to add the public key as a TXT record on the DNS zone of the domain name. The TXT record needs to be added on a subdomain based on the selector that you choose. For the above example, add the TXT record on key1._domainkey.dkimtesting.com. If the domain is registered with OpenSRS, you can use set_dns_zone to add the TXT record to the domain.

Add the private key and selector information for the domain using API 

The change_domain method can be used to add the DKIM record to an existing email domain.

dkim_selectorA selector generated with your private DKIM record.
This is required if attribute dkim_key is specified.
dkim_key

Your private DKIM key generated with your selector.
This is required if attribute dkim_selector is specified.

Note: Every line break in the DKIM key must be denoted with newline control character '\n'

Sample request

{ 
"attributes":{
"dkim_selector":"key1",
"dkim_key":"BEGIN RSA PRIVATE KEY/END RSA PRIVATE KEY"
},
"credentials":{
"user":"user@domain.adm",
"password":"AubE8bHbhx4"
},
"domain":"dkimtesting.com"
}
Response
{
"success": true,
"audit": "snake40_5dcdd78e14"
}

Back to top

 

Was this article helpful? If not please submit a request here

How helpful was this article?