Quickstart
From zero to your first send in three steps.
1. Install the SDK
The Node SDK wraps the REST API with full TypeScript types β covering sending, sub-tenancy, sequences, deliverability, analytics, compliance exports, and the AI assistant. (Any HTTP client works too.)
terminal
pnpm add @rootmail/node2. Get an API key
Create a key in your dashboard under API keys. Keys are scoped to a workspace (live or test) and are shown once β keep them server-side.
3. Send your first email
send.ts
import { RootMail } from "@rootmail/node";
const mail = new RootMail({ apiKey: process.env.ROOTMAIL_API_KEY! });
await mail.send({
to: "ada@example.com",
subject: "Welcome aboard",
html: "<h1>You're in π</h1><p>Thanks for signing up.</p>",
});Send with a template
Author reusable templates in the dashboard, then send by slug with variables.
template.ts
await mail.send({
to: "ada@example.com",
template: "welcome",
variables: { name: "Ada", action_url: "https://acme.com/start" },
});Send on behalf of your customers
Sub-tenancy lets you send from each customer's own verified domain, with reputation isolated per tenant β the same API, scoped by one call.
subtenant.ts
// Send from a customer's own verified domain β isolated reputation
const customer = mail.withSubTenant("tnt_123");
await customer.send({
to: "guest@example.com",
subject: "Your booking is confirmed",
html: "<h1>See you soon!</h1>",
});Prefer the terminal?
The @rootmail/cli drives the same API from your shell or CI β send, inspect deliverability, migrate a suppression list, or ask the assistant.
terminal
npm i -g @rootmail/cli
export ROOTMAIL_API_KEY=rm_live_β¦
rootmail send --to ada@example.com --template welcome
rootmail deliverability # reputation score + rates
rootmail import:suppressions export.csv # migrate from another provider
rootmail assistant "why did my last email bounce?"Next steps
- Subscribe to delivery events (delivered, bounced, openedβ¦) with webhooks.
- Automate drips with sequences and bulk sends with campaigns.
- Track a deliverability score and an open/click analytics funnel β via
mail.deliverability.get()andmail.analytics.get(). - Migrate in minutes β import suppressions & contacts with
mail.imports. - Export Ed25519-signed proof bundles and set data-retention policies for compliance.
- See the full plan comparison on the pricing page.