Node.js SDK
The jetemail package is the official Node.js SDK for JetEmail transactional email (MIT license, Node.js 18+, uses nativefetch, no runtime dependencies).
Create a transactional API key in the dashboard: Outbound → Keys → Add API key. Use that key with the SDK.
Installation
import) and CommonJS (require) builds.
Quick start
const { JetEmail } = require('jetemail'); instead of the import.
Use a from address on a verified domain (see Getting started).
Constructor
Error if apiKey is missing. The client exposes two services:
client.email.send(options)
Send a single email. Options use the same field names as the REST API (snake_case, e.g. reply_to).
{ id: string; response: string }.
The SDK validates from, to, subject, and html/text locally before making the request and throws a plain Error if any is missing (see Error handling).
client.batch.send(emails)
Send up to 100 emails in one request. Each element uses the same fields as a single send. Returns summary (total, successful, failed) and results per message (success with id and response, or error with error and the original email).
Error before any request is made.
Error handling
API errors throwJetEmailError, which has statusCode (HTTP status), message, and response (the parsed error body, { message?: string; error?: string }, when the API returned JSON).
apiKey) throw a plain Error rather than JetEmailError. Network failures from fetch are not wrapped and surface as-is.
Common status codes: 400 invalid request, 401 bad/missing API key, 500 server error.
TypeScript
Exported types:JetEmail, JetEmailConfig, SendEmailOptions, SendEmailResponse, SendBatchResponse, BatchEmailResult, BatchEmailSuccess, BatchEmailError, Attachment, EmailHeaders, EmailRecipient, JetEmailError, plus the Emails and Batch service classes.
For additional examples, see the README on npm. REST details: API reference.