Node.js
import { MailChannels } from "mailchannels-sdk";
const { MAILCHANNELS_API_KEY } = process.env;
if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY before running");
const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);
const { data, error } = await mailchannels.suppressions.list();
if (error) {
console.error("List suppressions failed:", error);
process.exit(1);
}
console.log(data);import os
import sys
import mailchannels
if not os.environ.get("MAILCHANNELS_API_KEY"):
sys.exit("Set MAILCHANNELS_API_KEY (parent or sub-account) before running")
# Retrieve suppression entries for the account.
response = mailchannels.Suppressions.list()
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
$api_key = getenv('MAILCHANNELS_API_KEY') or exit("Error: MAILCHANNELS_API_KEY is not set\n");
$client = new Client(apiKey: $api_key);
// Retrieve suppression entries for the account.
$response = $client->suppressions->list();
print_r($response->toArray());curl --request GET \
--url https://api.mailchannels.net/tx/v1/suppression-list \
--header 'X-Api-Key: <x-api-key>'{
"suppression_list": [
{
"recipient": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"notes": "<string>",
"sender": "<string>",
"source": "api",
"suppression_types": [
"transactional"
]
}
]
}{
"errors": [
"<string>"
]
}Retrieve Suppression List
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.
GET
/
suppression-list
Node.js
import { MailChannels } from "mailchannels-sdk";
const { MAILCHANNELS_API_KEY } = process.env;
if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY before running");
const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);
const { data, error } = await mailchannels.suppressions.list();
if (error) {
console.error("List suppressions failed:", error);
process.exit(1);
}
console.log(data);import os
import sys
import mailchannels
if not os.environ.get("MAILCHANNELS_API_KEY"):
sys.exit("Set MAILCHANNELS_API_KEY (parent or sub-account) before running")
# Retrieve suppression entries for the account.
response = mailchannels.Suppressions.list()
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
$api_key = getenv('MAILCHANNELS_API_KEY') or exit("Error: MAILCHANNELS_API_KEY is not set\n");
$client = new Client(apiKey: $api_key);
// Retrieve suppression entries for the account.
$response = $client->suppressions->list();
print_r($response->toArray());curl --request GET \
--url https://api.mailchannels.net/tx/v1/suppression-list \
--header 'X-Api-Key: <x-api-key>'{
"suppression_list": [
{
"recipient": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"notes": "<string>",
"sender": "<string>",
"source": "api",
"suppression_types": [
"transactional"
]
}
]
}{
"errors": [
"<string>"
]
}Headers
Query Parameters
Maximum string length:
255Available options:
api, unsubscribe_link, list_unsubscribe, hard_bounce, spam_complaint The date and/or time before which the suppression entries were created. Format: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ
The date and/or time after which the suppression entries were created. Format: YYYY-MM-DD or YYYY-MM-DDTHH:MM:SSZ
The maximum number of suppression entries to return. The default is 1000.
Required range:
1 <= x <= 1000The number of suppression entries to skip before returning results. The default is 0.
Required range:
x >= 0Response
Successfully retrieved all suppression entries associated with the account.
Maximum array length:
1000Show child attributes
Show child attributes
Was this page helpful?

