Node.js
import { MailChannels } from "mailchannels-sdk";
const { MAILCHANNELS_API_KEY, TRACKING_HOSTNAME } = process.env;
if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY before running");
if (!TRACKING_HOSTNAME) throw new Error("Set TRACKING_HOSTNAME (e.g. click.example.com)");
const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);
// Permanently delete a custom tracking domain by hostname and scope.
const { success, error } = await mailchannels.domains.customTracking.delete(TRACKING_HOSTNAME, "click");
if (!success) {
console.error("Delete custom tracking domain failed:", error);
process.exit(1);
}
console.log("Custom tracking domain deleted");import os
import sys
import mailchannels
if not os.environ.get("MAILCHANNELS_API_KEY"):
sys.exit("Set MAILCHANNELS_API_KEY before running")
hostname = os.environ.get("TRACKING_HOSTNAME")
if not hostname:
sys.exit("Set TRACKING_HOSTNAME (e.g. click.example.com)")
# Permanently delete a custom tracking domain by hostname and scope.
response = mailchannels.CustomTrackingDomains.delete(hostname, "click")
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
use MailChannels\Enum\CustomTrackingScope;
$api_key = getenv('MAILCHANNELS_API_KEY') or exit("Error: MAILCHANNELS_API_KEY is not set\n");
$hostname = getenv('TRACKING_HOSTNAME') or exit("Error: TRACKING_HOSTNAME is not set\n");
$client = new Client(apiKey: $api_key);
// Permanently delete a custom tracking domain by hostname and scope.
$response = $client->customTrackingDomains->delete($hostname, CustomTrackingScope::Click);
echo "HTTP Status: " . $response->statusCode . "\n";curl --request DELETE \
--url https://api.mailchannels.net/tx/v1/custom-tracking-domains/{hostname}/{scope} \
--header 'X-Api-Key: <x-api-key>'{
"errors": [
"<string>"
]
}Delete Custom Tracking Domain
Permanently delete an existing custom tracking domain for the given hostname and scope. The domain can be re-registered if needed. WARNING: Any tracking links or unsubscribe URLs in previously sent emails using this domain will stop working immediately.
DELETE
/
custom-tracking-domains
/
{hostname}
/
{scope}
Node.js
import { MailChannels } from "mailchannels-sdk";
const { MAILCHANNELS_API_KEY, TRACKING_HOSTNAME } = process.env;
if (!MAILCHANNELS_API_KEY) throw new Error("Set MAILCHANNELS_API_KEY before running");
if (!TRACKING_HOSTNAME) throw new Error("Set TRACKING_HOSTNAME (e.g. click.example.com)");
const mailchannels = new MailChannels(MAILCHANNELS_API_KEY);
// Permanently delete a custom tracking domain by hostname and scope.
const { success, error } = await mailchannels.domains.customTracking.delete(TRACKING_HOSTNAME, "click");
if (!success) {
console.error("Delete custom tracking domain failed:", error);
process.exit(1);
}
console.log("Custom tracking domain deleted");import os
import sys
import mailchannels
if not os.environ.get("MAILCHANNELS_API_KEY"):
sys.exit("Set MAILCHANNELS_API_KEY before running")
hostname = os.environ.get("TRACKING_HOSTNAME")
if not hostname:
sys.exit("Set TRACKING_HOSTNAME (e.g. click.example.com)")
# Permanently delete a custom tracking domain by hostname and scope.
response = mailchannels.CustomTrackingDomains.delete(hostname, "click")
print(response)<?php
require_once __DIR__ . '/vendor/autoload.php';
use MailChannels\Client;
use MailChannels\Enum\CustomTrackingScope;
$api_key = getenv('MAILCHANNELS_API_KEY') or exit("Error: MAILCHANNELS_API_KEY is not set\n");
$hostname = getenv('TRACKING_HOSTNAME') or exit("Error: TRACKING_HOSTNAME is not set\n");
$client = new Client(apiKey: $api_key);
// Permanently delete a custom tracking domain by hostname and scope.
$response = $client->customTrackingDomains->delete($hostname, CustomTrackingScope::Click);
echo "HTTP Status: " . $response->statusCode . "\n";curl --request DELETE \
--url https://api.mailchannels.net/tx/v1/custom-tracking-domains/{hostname}/{scope} \
--header 'X-Api-Key: <x-api-key>'{
"errors": [
"<string>"
]
}Was this page helpful?
⌘I

