Node.js SDK
npm install vaartixWorks with Node.js 18 and later, in ESM and CommonJS, with TypeScript types included.
import { Vaartix } from 'vaartix';
// Reads VAARTIX_API_KEY from the environment if no key is passed.const vaartix = new Vaartix(process.env.VAARTIX_API_KEY);Errors never throw
Section titled “Errors never throw”Every method resolves to { data, error }. Exactly one is set:
const { data, error } = await vaartix.emails.send({ ... });if (error) { // error.type: 'validation_error', 'rate_limited', 'network_error', ... // error.statusCode: HTTP status, or null for network errors console.error(error.type, error.message); return;}console.log(data.id);Methods
Section titled “Methods”// Send one email (optionally idempotent)await vaartix.emails.send( { idempotencyKey: 'order-1042-receipt' },);
// Schedule, then cancelconst { data } = await vaartix.emails.send({ ...email, scheduledAt: '2026-11-01T09:00:00+05:30' });await vaartix.emails.cancel(data!.id);
// Up to 100 at onceawait vaartix.batch.send([email1, email2]);
// Read (full-access key)await vaartix.emails.get('em_7hq2kv9xr4m1c8d3');await vaartix.emails.list({ limit: 20 });Options
Section titled “Options”new Vaartix(apiKey, { baseUrl: 'https://api.vaartix.com', // default fetch: customFetch, // e.g. for testing});React Email support (passing react: <MyEmail />) is planned.