Skip to main content
POST
/
domains
/
{domain}
/
dkim-keys
Create DKIM Key Pair
curl --request POST \
  --url https://api.mailchannels.net/tx/v1/domains/{domain}/dkim-keys \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: <x-api-key>' \
  --data '
{
  "selector": "<string>",
  "algorithm": "rsa",
  "key_length": 2048
}
'
{
  "algorithm": "<string>",
  "domain": "<string>",
  "public_key": "<string>",
  "selector": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "dkim_dns_records": [
    {
      "name": "<string>",
      "type": "TXT",
      "value": "<string>"
    }
  ],
  "gracePeriodExpiresAt": "2023-11-07T05:31:56Z",
  "key_length": 123,
  "retiresAt": "2023-11-07T05:31:56Z",
  "status_modified_at": "2023-11-07T05:31:56Z"
}

Headers

X-Api-Key
string
required

Path Parameters

domain
string
required

Body

application/json
selector
string
required

Selector for the new key pair

Required string length: 1 - 63
algorithm
enum<string>
default:rsa

Algorithm used for the new key pair Currently, only RSA is supported.

Available options:
rsa
key_length
integer
default:2048

Key length in bits. For RSA, must be a multiple of 1024. Common values: 1024 or 2048. Defaults to 2048 bits.

Required range: 1024 <= x <= 4096

Response

Key pair created successfully

algorithm
string
required

Algorithm used for the key pair

domain
string
required

Domain associated with the key pair

public_key
string
required
selector
string
required

Selector assigned to the key pair

status
enum<string>
required
Available options:
active,
retired,
revoked,
rotated
created_at
string<date-time> | null

Timestamp when the key pair was created

dkim_dns_records
(object | null)[]

Suggested DNS records for the DKIM key

Suggested DNS record for the DKIM key

gracePeriodExpiresAt
string<date-time> | null

UTC timestamp after which you can no longer use the rotated key for signing

key_length
integer

Key length in bits

retiresAt
string<date-time> | null

UTC timestamp when a rotated key pair is retired

status_modified_at
string<date-time> | null

Timestamp when the key was last modified