Send and track email from an Express server.
An Express app needs three things from Notix: a client created once at startup, a route that sends, and a webhook route that proves each delivery event came from Notix. The one Express-specific trap is the body parser, which has to stay off the webhook route.
Send an email from Express.
import express from "express";
import { Notix } from "notix-js";
const app = express();
const notix = new Notix(process.env.NOTIX_API_KEY!);
app.post("/orders/:id/receipt", express.json(), async (req, res) => {
const { data, error } = await notix.emails.send(
{ from: "Acme <receipts@acme.com>", to: req.body.email, subject: "Your receipt", html: "<p>Thanks.</p>" },
{ idempotencyKey: `order-${req.params.id}-receipt` },
);
if (error) return res.status(502).json({ error });
res.json({ id: data?.emailId });
});
app.listen(3000);
curl -X POST https://app.usenotix.dev/api/v1/emails \
-H "Authorization: Bearer $NOTIX_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "from": "Acme <receipts@acme.com>", "to": "maria@example.com", "subject": "Your receipt for order 4471", "html": "<p>Thanks for your order, Maria.</p>" }'
The from address must be on a domain you have verified in Notix. Step by step: the Node.js quickstart and the longer guide to sending email from Express.
One API key, kept on the server.
Create an API key on the API keys page of the Notix console and store it as NOTIX_API_KEY in the process environment (a .env file loaded at startup works). Read it only in code that runs on the server, never in anything shipped to a browser.
A Send only key is enough for code that only sends: if it leaks, it cannot read your contacts or delete a domain.
NOTIX_API_KEY=notix_xxxxxxxxxxxx
NOTIX_WEBHOOK_SECRET=whsec_xxxxxxxxxxxx
Verify delivery events over the raw body.
Notix signs every webhook call with the webhook's signing secret: an HMAC-SHA256 of the X-Notix-Timestamp header, a dot and the raw body, sent in X-Notix-Signature. The SDKs check the signature and refuse a call more than 5 minutes old.
Mount express.raw on the webhook route, not express.json: a parsed and re-serialised body no longer matches the signature.
app.post("/webhooks/notix", express.raw({ type: "application/json" }), (req, res) => {
const webhooks = notix.webhooks(process.env.NOTIX_WEBHOOK_SECRET!);
try {
const event = webhooks.constructEvent(req.body.toString("utf8"), { headers: req.headers });
if (event.type === "email.bounced") {
// Mark the address in your own records.
}
res.send("ok");
} catch {
res.status(400).send("invalid signature");
}
});
Questions, answered.
Why does my webhook signature check fail in Express?
What if the same request runs twice?
Why is my send refused with a from-address error?
Keep reading.
Send email from Express
A route that sends with notix-js, the raw-body webhook receiver, and the same idempotency and error handling as the Node guide.
DocsNode.js
Send an email from Node.js with the notix-js SDK.
IntegrationsIntegrations
Notix inside the frameworks, platforms and AI coding tools you already use, from Next.js and Laravel to Supabase, Vercel and Cursor.
ProductEmail API
One JSON API for transactional and marketing email: send, batch, schedule, webhooks, typed SDKs.
NotixPricing
A free plan with no card, and Pro at $15 a month for 50,000 emails. Only sent volume is metered.
Send your first email in five minutes.
Verify a domain, copy an API key, make one call. The free plan does not ask for a card.