Skip to content

List DKIM Keys method 🌐 Domains

Search for DKIM keys by domain, with optional filters. If selector is provided, at most one key will be returned.

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.list('example.com', {
  includeDnsRecord: true
})
ts
import { MailChannels } from 'mailchannels-sdk'

const mailchannels = new MailChannels('your-api-key')

const { data, error } = await mailchannels.domains.dkim.list('example.com', {
  includeDnsRecord: true
})

Params

  • domain string required: The domain to get the DKIM keys for.
  • options DomainsDkimListOptions optional: Optional filter options.
    • selector string optional: Selector to filter keys by. Must be a maximum of 63 characters.
    • status "active" | "revoked" | "retired" | "rotated" optional: Status to filter keys by.

      TIP

      Possible values: active, revoked, retired, rotated.

    • offset number optional: Number of results to skip from the start. Must be a positive integer. Defaults to 0.
    • limit number optional: Maximum number of keys to return. Maximum is 100 and minimum is 1. Defaults to 10.
    • includeDnsRecord boolean optional: If true, includes the suggested DKIM DNS record for each returned key. Defaults to false.

Response

  • data Optional<DomainsDkimKey, "dnsRecords">[] | null nullable: List of keys matching the filter. Empty if no keys match the filter.
    • algorithm string guaranteed: Algorithm used for the key pair.
    • createdAt string optional: Timestamp when the key pair was created.
    • dnsRecords object[] optional: Suggested DNS records for the DKIM key. Only included if includeDnsRecord is true.
      • name string guaranteed
      • type string guaranteed
      • value string guaranteed
    • domain string guaranteed: Domain associated with the key pair.
    • gracePeriodExpiresAt string optional: UTC timestamp after which you can no longer use the rotated key for signing.
    • length 1024 | 2048 | 3072 | 4096 guaranteed: Key length in bits.
    • publicKey string guaranteed
    • retiresAt string optional: UTC timestamp when a rotated key pair is retired.
    • selector string guaranteed: Selector assigned to the key pair.
    • status "active" | "revoked" | "retired" | "rotated" guaranteed: Status of the key.
    • statusModifiedAt string optional: Timestamp when the key was last modified.
  • error ErrorResponse | null nullable: Error information if the operation failed.
    • message string guaranteed: A human-readable description of the error.
    • statusCode number | null nullable: The HTTP status code from the API, or null if the error is not related to an HTTP request. This field is intended for diagnostic use only and should not be relied upon.
    • type string guaranteed: 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 list (domain: string, options?: DomainsDkimListOptions): Promise<DomainsDkimListResponse>

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;
};

DKIM key type declarations

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;
}

List DKIM Keys type declarations

ts
interface DomainsDkimListOptions {
  selector?: string;
  status?: DomainsDkimKey["status"];
  offset?: number;
  limit?: number;
  includeDnsRecord?: boolean;
}
ts
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
ts
type DomainsDkimListResponse = DataResponse<Optional<DomainsDkimKey, "dnsRecords">[]>;

Source

SourcePlaygroundDocsTests

Released under the MIT License.