Update a domain
PATCH /domains/:id — toggle open and click tracking.
/domains/:idUpdates a domain’s settings. Send any subset of the body fields below; omitted fields are left unchanged. Returns a slim acknowledgement with the domain id. Requires a key with full access. See Open and click tracking.
open_trackingbooleanoptionalEnable or disable the open-tracking pixel for mail sent from this domain. Applied whenever enabled; the pixel is served from your tracking_subdomain when one is configured and verified, otherwise from a shared MailBlastr-hosted host.
click_trackingbooleanoptionalEnable or disable link rewriting for click tracking on this domain. Applied whenever enabled; rewritten links pass through your tracking_subdomain when one is configured and verified, otherwise through a shared MailBlastr-hosted host.
tracking_subdomainstringoptionalA custom subdomain for click and open tracking (e.g. links produces a CNAME for links.yourdomain.com). This value can only be changed after it has first been specified, never removed — this preserves links in already-sent email. After changing it, the new DNS record must be verified; until then the previous value is used, and all previously used records remain active and are included in the response.
tlsstringoptionalThe domain’s TLS preference. opportunistic (default) encrypts the connection when the receiving server supports TLS and otherwise sends unencrypted; enforced records a preference that delivery should require TLS.
capabilitiesobjectoptionalUpdate the domain capabilities. sending is always enabled and cannot be disabled. Set receiving (enabled | disabled) to toggle whether the domain also receives mail; omitting it keeps the current value.
import { MailBlastr } from 'mailblastr';
const mb = new MailBlastr('mb_xxxxxxxxx');
const { data, error } = await mb.domains.update('d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e', {
"open_tracking": true,
"click_tracking": true
});
console.log({ data, error });Response:
{
"object": "domain",
"id": "d91a7c4e-1f2b-4a8c-9e3d-7b5f0a2c1d6e"
}object and id. To read the updated domain object, follow up with `GET /domains/:id`.Errors: not_found if the domain does not exist or is not yours, invalid_access if the key lacks full access. See Errors.