Skip to content

Get Signing Key method 📢 Webhooks

Retrieves the public key used to verify signatures on incoming webhook payloads.

Usage

ts
import { MailChannelsClient, Webhooks } from 'mailchannels-sdk'

const mailchannels = new MailChannelsClient('your-api-key')
const webhooks = new Webhooks(mailchannels)

const { data, error } = await webhooks.getSigningKey('key-id')
ts
import { MailChannels } from 'mailchannels-sdk'

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

const { data, error } = await mailchannels.webhooks.getSigningKey('key-id')

Params

  • id string required: The ID of the key.

    TIP

    The id can be found in the signature-input request header of the webhook notification as keyid.

Response

  • data object | null nullable
    • id string guaranteed: The ID of the key.
    • key string guaranteed: The public key used to verify webhook signatures.
  • 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 getSigningKey (id: string): Promise<WebhooksSigningKeyResponse>

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

Signing Key type declarations

ts
type WebhooksSigningKeyResponse = DataResponse<{
  id: string;
  key: string;
}>;

Source

SourcePlaygroundDocsTests

Released under the MIT License.