Integration
Node.js Email API with the NoticeAPI SDK
The NoticeAPI Node SDK is a zero-dependency, TypeScript-first wrapper around the REST API. Use it in Express, Fastify, background workers, queues, and scripts that need email without hand-rolling fetch calls.
import express from "express";
import { NoticeAPI, NoticeAPIError } from "noticeapi";
const app = express();
const notice = new NoticeAPI(process.env.NOTICEAPI_KEY!);
app.use(express.json());
app.post("/send-receipt", async (req, res) => {
try {
const { email, orderId } = req.body;
const result = await notice.emails.send(
{
from: "Acme Billing <[email protected]>",
to: email,
subject: `Receipt #${orderId}`,
html: "<p>Your receipt is ready.</p>",
},
{ idempotencyKey: `receipt-${orderId}` },
);
res.json({ id: result.id });
} catch (error) {
if (error instanceof NoticeAPIError) {
res.status(error.status).json({ code: error.code, message: error.message });
return;
}
throw error;
}
});Zero-dependency package
Install noticeapi from npm. It targets Node 18+ and uses the built-in fetch implementation.
Framework agnostic
Use the same client from Express, Fastify, workers, queues, CLI scripts, and server-rendered apps.
Attachments and idempotency
REST sends support attachments and retry-safe idempotency keys for receipts, invoices, and reports.
More than single sends
The SDK mirrors email lookup, batch sends, suppressions, templates, audiences, contacts, and broadcasts.
How it works
From test send to production traffic.
Install noticeapi
Run npm install noticeapi in any Node 18+ project.
Create the client
Initialize NoticeAPI with your ntc_ key from a server environment variable.
Send and handle errors
Catch NoticeAPIError to read the HTTP status and stable error code.
Use adjacent APIs
Add templates, batch sends, suppressions, audiences, or broadcasts as your app needs them.
Trust
Typed SDK, same REST contract
The SDK mirrors the HTTP API one-to-one. Anything you learn in the REST docs maps directly to a method, and non-2xx responses throw typed NoticeAPIError objects.
Implementation links
Build with the shipped docs.
FAQ
Questions developers ask before switching email.
Which Node versions are supported?
The SDK targets Node 18 and newer because it relies on the built-in fetch API.
Can I send attachments from Node?
Yes. Use notice.emails.send with attachment objects that include filename and base64 content.
Does the SDK support broadcasts?
Yes. The shipped SDK includes audiences, contacts, broadcasts, suppressions, templates, send, batch, and email lookup methods.
Start free. Send production after your domain is ready.
Free includes 3,000 production emails per month, a 100/day production cap, and one verified sending domain.