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
optionsSuppressionsListOptionsoptional: Optional filter options.recipientstringoptional: 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.createdBeforestringoptional: The date and/or time before which the suppression entries were created. Format:YYYY-MM-DDorYYYY-MM-DDTHH:MM:SSZcreatedAfterstringoptional: The date and/or time after which the suppression entries were created. Format:YYYY-MM-DDorYYYY-MM-DDTHH:MM:SSZlimitnumberoptional: The maximum number of suppression entries to return. Must be between1and1000. Defaults to1000.offsetnumberoptional: The number of suppression entries to skip before returning results. Defaults to0.
Response
dataSuppressionsListEntry[] | nullnullablecreatedAtstringguaranteednotesstringoptionalrecipientstringguaranteed: The email address that is suppressed.senderstringoptionalsource"api" | "unsubscribe_link" | "list_unsubscribe" | "hard_bounce" | "spam_complaint" | "all"guaranteedtypes("transactional" | "non-transactional")[]guaranteed
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 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
Source • Playground • Docs • Tests