Email content and domain endpoints
Reusable templates
Domains
A Domain is a Resend-verified sending domain that owns one or more email accounts and holds the
shared daily cap.
GET /api/email-domains
Domains with their accounts and today’s usage (daily_sent_total, the sum of the accounts' sends
for the current UTC day). An account whose dailySentDate is an earlier day reports
daily_sent_count: 0.
POST /api/email-domains
Creates a domain. Supply the resendDomainId obtained from
GET /api/email-domains/resend-domains.
PATCH /api/email-domains/{id} / DELETE /api/email-domains/{id}
Update dailyCap, isActive, warmupStatus, or remove the domain.
GET /api/email-domains/resend-domains
Lists verified domains from Resend, so the UI can offer real domain ids rather than free text.
Sending accounts
EmailSendingDomain — a concrete From address under a parent domain. Called an "email account" in
the UI.
POST /api/sending-domains
Creates an account: domainId, domain, fromName, fromEmail, resendDomainId, dailyCap,
isActive, isVerified. The fromEmail host must match the parent Domain.name exactly.
PATCH /api/sending-domains/{id} / DELETE /api/sending-domains/{id}
Only active accounts under an active domain, under both daily caps, are eligible for a send. See Email deliverability.
Unsubscribe
GET /api/unsubscribe?token=<base64url>
Public — no authentication. Renders the confirmation page. token is the EmailCampaignTarget id
encoded as base64url.
POST /api/unsubscribe
The RFC 8058 one-click endpoint referenced by the List-Unsubscribe-Post header.
- Effect
-
Sets
TargetEmails.newsletterOptOutwithnewsletterOptOutAt, which suppresses the address across every campaign in the workspace, and publishesContact.Unsubscribeto the CRM queue withlegal_basis=LEGITIMATE_INTEREST_OTHERand the explanation constant fromlib/constants.ts.
Suppression is per address, not per campaign — an unsubscribe from one campaign stops all of them.
Daily reset
There is no HTTP endpoint. The Inngest function sendingDomainDailyResetCron runs at 00:00 UTC,
zeroes dailySentCount and clears dailySentDate on every account. totalSentCount is never reset.
The daily cap already ignores counters from an earlier UTC day, so the reset is a backstop. See
Cron jobs.