Skip to content

List method 🚫 Suppressions

Retrieve suppression entries associated with the specified account. Supports filtering by recipient, source and creation date range. The response is paginated, with a default limit of 1000 entries per page and an offset of 0.

Usage

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

const mailchannels = new MailChannelsClient('your-api-key')
const suppressions = new Suppressions(mailchannels)

const { data, error } = await suppressions.list()
ts
import { MailChannels } from 'mailchannels-sdk'

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

const { data, error } = await mailchannels.suppressions.list()

Params

  • options SuppressionsListOptions optional: Optional filter options.
    • recipient string optional: The email address of the suppression entry to search for. If provided, the search will return the suppression entry associated with this recipient. If not provided, the search will return all suppression entries for the account.
    • source "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" optional: The source of the suppression entries to filter by. If not provided, suppression entries from all sources will be returned.

      NOTE

      Possible values are: api, unsubscribe_link, list_unsubscribe, hard_bounce, spam_complaint.

    • createdBefore string optional: The date and/or time before which the suppression entries were created. Format: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ
    • createdAfter string optional: The date and/or time after which the suppression entries were created. Format: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ
    • limit number optional: The maximum number of suppression entries to return. Must be between 1 and 1000. Defaults to 1000.
    • offset number optional: The number of suppression entries to skip before returning results. Defaults to 0.

Response

  • data SuppressionsListEntry[] | null nullable
    • createdAt string guaranteed
    • notes string optional
    • recipient string guaranteed: The email address that is suppressed.
    • sender string optional
    • source "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all" guaranteed
    • types ("transactional" | "non-transactional")[] guaranteed
  • 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 (options?: SuppressionsListOptions): Promise<SuppressionsListResponse>

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

List type declarations

ts
type SuppressionsSource = "api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all";
ts
interface SuppressionsListOptions {
  recipient?: string;
  source?: Exclude<SuppressionsSource, "all">;
  createdBefore?: string;
  createdAfter?: string;
  limit?: number;
  offset?: number;
}
ts
type SuppressionsTypes = "transactional" | "non-transactional";
ts
interface SuppressionsListEntry {
  createdAt: string;
  notes?: string;
  recipient: string;
  sender?: string;
  source: SuppressionsSource;
  types: SuppressionsTypes[];
}
ts
type SuppressionsListResponse = DataResponse<SuppressionsListEntry[]>;

Source

SourcePlaygroundDocsTests

Released under the MIT License.