Skip to main content

DKIM

You can choose to manage your own keys, or let MailChannels manage your keys for you. If you choose to manage your own keys, you are responsible for creating the key pair, publishing the DNS record, and rotating keys when necessary. If you choose to let MailChannels manage your keys, we manage the keys, and all you have to do is update the DNS. If you want to manage your own keys: include dkim_domain, dkim_selector and dkim_private_key in your API request to send a message. If you want MailChannels to manage your keys: MailChannels generates and stores the private key, and handles the signing process.

Create a key pair

Generate a key pair for your domain. selector is a string that identifies the key and is used in the DNS record and email headers. algorithm defaults to rsa and key_length defaults to 2048. Choose a short, descriptive selector that helps you identify the key, for example “marketing2026” or “transactional20260101”.
The response includes the suggested DNS record under dkim_dns_records:

Publish the DNS record

Add the returned TXT record to your domain’s DNS. Receivers fetch this record to verify the DKIM signatures on your mail. Here is an example record: DNS Name: mc1._domainkey.example.com TXT Record value: v=DKIM1; k=rsa; p=public_key_value The format of the record is specified in RFC 6376, section 3.6.1.

Send a message using the managed key

Once you have created a key and published the DNS record, your mail will automatically be signed using that key. If you have multiple keys and want to specify which one to use, include dkim_selector in your send request. See the API reference for more details.

Rotate a key

Rotating a key refers to the process of creating a new key, updating your DNS records, and retiring the old key. This is a security best practice that limits the potential damage if a private key is compromised. MailChannels provides a tool to rotate your DKIM keys. When you rotate a key, a new key pair is generated, and the old key is marked as rotated.
The response contains both keys, each with its suggested DNS record:
The rotated key remains valid for signing for a 3-day grace period (gracePeriodExpiresAt) and is automatically marked retired 2 weeks after rotation (retiresAt). To avoid signature-verification failures during the cutover:
  1. Publish the new key’s DNS record before updating your send requests to use the new selector.
  2. Leave the rotated key’s DNS record in place until the grace period ends — in-flight mail signed with it still needs the record for verification.
  3. Once the grace period ends, update your send requests to use the new selector. Signing with the old selector will fail after it transitions to retired.