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.domains.customTracking.list();
if (error) {
console.error("List custom tracking domains 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 custom tracking domains registered under the account.
response = mailchannels.CustomTrackingDomains.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 custom tracking domains registered under the account.
$response = $client->customTrackingDomains->list();
print_r($response->toArray());curl --request GET \
--url https://api.mailchannels.net/tx/v1/custom-tracking-domains \
--header 'X-Api-Key: <x-api-key>'{
"custom_tracking_domains": [
{
"created_at": "2023-11-07T05:31:56Z",
"hostname": "<string>",
"name": "<string>",
"scope": "click",
"status": "active"
}
],
"total": 123
}{
"errors": [
"<string>"
]
}Retrieve Custom Tracking Domains
Retrieve all custom tracking domains registered under your account. Optional filters include domain name, status, scope, limit and offset.
GET
/
custom-tracking-domains
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.domains.customTracking.list();
if (error) {
console.error("List custom tracking domains 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 custom tracking domains registered under the account.
response = mailchannels.CustomTrackingDomains.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 custom tracking domains registered under the account.
$response = $client->customTrackingDomains->list();
print_r($response->toArray());curl --request GET \
--url https://api.mailchannels.net/tx/v1/custom-tracking-domains \
--header 'X-Api-Key: <x-api-key>'{
"custom_tracking_domains": [
{
"created_at": "2023-11-07T05:31:56Z",
"hostname": "<string>",
"name": "<string>",
"scope": "click",
"status": "active"
}
],
"total": 123
}{
"errors": [
"<string>"
]
}Headers
Query Parameters
Filter by custom tracking domain label
Filter by status
Available options:
active, disabled Filter by scope
Available options:
click, open, unsubscribe The maximum number of domains to return. The default is 100.
Required range:
1 <= x <= 1000The number of domains to skip before returning results. The default is 0.
Required range:
x >= 0Was this page helpful?

