rootmail

Tooling

Node SDK

@rootmail/node — the whole API, fully typed, one import.

The official Node client wraps every endpoint with end-to-end TypeScript types, maps snake_case JSON to camelCase, normalizes errors into one RootMailError, and adds sub-tenant scoping.

terminal
pnpm add @rootmail/node
init.ts
import { RootMail } from "@rootmail/node";

const mail = new RootMail({
  apiKey: process.env.ROOTMAIL_API_KEY!,
  // baseUrl defaults to https://service.gateml.io
});

Resources

Each API area is a resource on the client:

mail.messagesresourcecreate, get, list, audit, proof, recordEvent
mail.templatesresourcecreate, get, list, update, remove
mail.contactsresourcecreate, get, unsubscribe
mail.listsresourceaudiences + membership
mail.campaignsresourcecreate, send, analytics
mail.sequencesresourcecreate, enroll, enrollments, analytics
mail.threadsresourcelist, get, reply
mail.subTenantsresourceclient domains + verify
mail.webhooksresourceendpoints + deliveries
mail.deliverability / mail.analyticsresourcereputation + the funnel
mail.suppressions / mail.importsresourcedo-not-send list + migration
mail.compliance / mail.retentionresourceproof + retention
mail.assistantresourcethe AI agent

Sub-tenant scoping

scoped.ts
const scoped = mail.withSubTenant("tnt_123");
await scoped.messages.create({ to, subject, html }); // sends as that client
tipSet idempotencyKey on any create call to make it safe to retry.