Create DKIM Key method 🌐 Domains
Create a DKIM key pair for a specified domain and selector using the specified algorithm and key length, for the current customer.
Usage
ts
import { MailChannelsClient, Domains } from 'mailchannels-sdk'
const mailchannels = new MailChannelsClient('your-api-key')
const domains = new Domains(mailchannels)
const { data, error } = await domains.dkim.create('example.com', {
selector: 'mailchannels'
})ts
import { MailChannels } from 'mailchannels-sdk'
const mailchannels = new MailChannels('your-api-key')
const { data, error } = await mailchannels.domains.dkim.create('example.com', {
selector: 'mailchannels'
})Params
domainstringrequired: The domain to create the DKIM key for.optionsDomainsDkimCreateOptionsrequired: Create DKIM key options.algorithm"rsa"optional: Algorithm used for the new key pair Currently, only RSA is supported. Defaults torsa.length1024 | 2048 | 3072 | 4096optional: Key length in bits. For RSA, must be a multiple of1024.TIP
Defaults to
2048. Common values:1024or2048.selectorstringrequired: Selector for the new key pair. Must be a maximum of 63 characters.
Response
dataDomainsDkimKey | nullnullable: The created DKIM key information.algorithmstringguaranteed: Algorithm used for the key pair.createdAtstringoptional: Timestamp when the key pair was created.dnsRecordsobject[]guaranteed: Suggested DNS records for the DKIM key.namestringguaranteedtypestringguaranteedvaluestringguaranteed
domainstringguaranteed: Domain associated with the key pair.gracePeriodExpiresAtstringoptional: UTC timestamp after which you can no longer use the rotated key for signing.length1024 | 2048 | 3072 | 4096guaranteed: Key length in bits.publicKeystringguaranteedretiresAtstringoptional: UTC timestamp when a rotated key pair is retired.selectorstringguaranteed: Selector assigned to the key pair.status"active" | "revoked" | "retired" | "rotated"guaranteed: Status of the key.statusModifiedAtstringoptional: Timestamp when the key was last modified.
errorErrorResponse | nullnullable: Error information if the operation failed.messagestringguaranteed: A human-readable description of the error.statusCodenumber | nullnullable: The HTTP status code from the API, ornullif the error is not related to an HTTP request. This field is intended for diagnostic use only and should not be relied upon.typestringguaranteed: A string identifier for the type of error. This field is intended for diagnostic use only and should not be relied upon.
Type declarations
Signature
ts
async function create (domain: string, options: DomainsDkimCreateOptions): Promise<DomainsDkimCreateResponse>Response type declarations
ts
interface ErrorResponse {
message: string;
statusCode: number | null;
type: ErrorType;
}ts
type DataResponse<T> = {
data: T;
error: null;
} | {
data: null;
error: ErrorResponse;
};Create DKIM Key type declarations
ts
interface DomainsDkimCreateOptions {
algorithm?: "rsa";
length?: 1024 | 2048 | 3072 | 4096;
selector: string;
}ts
type DomainsDkimKeyStatus = "active" | "retired" | "revoked" | "rotated";ts
interface DomainsDkimKey {
algorithm: string;
createdAt?: string;
dnsRecords: {
name: string;
type: string;
value: string;
}[];
domain: string;
gracePeriodExpiresAt?: string;
length: 1024 | 2048 | 3072 | 4096;
publicKey: string;
retiresAt?: string;
selector: string;
status: DomainsDkimKeyStatus;
statusModifiedAt?: string;
}ts
type DomainsDkimCreateResponse = DataResponse<DomainsDkimKey>;Source
Source • Playground • Docs • Tests