import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.domains.trackingDomains.create(
'd91cd9bd-1176-453e-8fc1-35364d380206',
{
subdomain: 'links',
},
);
{
"object": "tracking_domain",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "track",
"full_name": "links.example.com",
"status": "not_started",
"created_at": "2026-03-10T12:00:00.000Z",
"records": [
{
"record": "Tracking",
"type": "CNAME",
"name": "links.example.com",
"value": "<proxy-target>",
"ttl": "Auto",
"status": "not_started"
}
]
}
Create a custom domain for click and open tracking.
import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.domains.trackingDomains.create(
'd91cd9bd-1176-453e-8fc1-35364d380206',
{
subdomain: 'links',
},
);
{
"object": "tracking_domain",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "track",
"full_name": "links.example.com",
"status": "not_started",
"created_at": "2026-03-10T12:00:00.000Z",
"records": [
{
"record": "Tracking",
"type": "CNAME",
"name": "links.example.com",
"value": "<proxy-target>",
"ttl": "Auto",
"status": "not_started"
}
]
}
npm install resend@6.10.0-preview-tracking-domains.0
links results in
links.example.com for the verified domain example.com).import { Resend } from 'resend';
const resend = new Resend('re_xxxxxxxxx');
const { data, error } = await resend.domains.trackingDomains.create(
'd91cd9bd-1176-453e-8fc1-35364d380206',
{
subdomain: 'links',
},
);
{
"object": "tracking_domain",
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "track",
"full_name": "links.example.com",
"status": "not_started",
"created_at": "2026-03-10T12:00:00.000Z",
"records": [
{
"record": "Tracking",
"type": "CNAME",
"name": "links.example.com",
"value": "<proxy-target>",
"ttl": "Auto",
"status": "not_started"
}
]
}
Was this page helpful?