Node.js / TypeScript SDK
The official Render25 Node.js client library. Fully typed with TypeScript support out of the box, supporting ESM, CommonJS, and Edge runtimes.
Node.js 18+TypeScript 5+ESM & CJSBun, Deno & Next.js
Installation
bash
npm install render25Or using yarn, pnpm, or bun:
bash
yarn add render25
pnpm add render25
bun add render25Basic Usage
Initialize the client by passing your API key or automatically reading from process.env.RENDER25_API_KEY.
send-email.ts
import { Render25 } from "render25";
const render25 = new Render25(); // Automatically uses process.env.RENDER25_API_KEY
const { id } = await render25.emails.send({
from: "support@yourdomain.com",
to: "user@example.com",
subject: "Welcome to Render25!",
html: "<h1>Welcome aboard!</h1><p>Your transactional email was delivered instantly.</p>",
text: "Welcome aboard! Your transactional email was delivered instantly.",
});
console.log("Email dispatched with ID:", id);Note
Set
RENDER25_API_KEY in your environment variables. Never commit raw API keys to version control.CC, BCC & Custom Reply-To
Render25 allows you to specify multiple recipients, CC copies, secret BCC copies, and custom Reply-To routing.
advanced-send.ts
import { Render25 } from "render25";
const render25 = new Render25();
await render25.emails.send({
from: "support@yourdomain.com",
to: ["primary@example.com"],
cc: ["manager@example.com", "billing@example.com"],
bcc: ["compliance-archive@example.com"],
replyTo: "helpdesk@yourdomain.com",
subject: "Invoice #1042 Ready",
html: "<p>Your monthly invoice is ready for review.</p>",
});File Attachments
Attach PDF invoices, spreadsheets, images, or documents by passing a Node.js Buffer or a Base64 string.
send-with-attachment.ts
import { Render25 } from "render25";
import fs from "fs";
const render25 = new Render25();
await render25.emails.send({
from: "support@yourdomain.com",
to: "client@example.com",
subject: "Your Monthly Receipt & Statement",
html: "<p>Please find your receipt and statement attached below.</p>",
attachments: [
{
filename: "invoice_1042.pdf",
content: fs.readFileSync("./invoice.pdf"), // Buffer automatically encoded to Base64
contentType: "application/pdf",
},
{
filename: "report.csv",
content: Buffer.from("Date,Amount\n2026-08-01,$49.00").toString("base64"),
contentType: "text/csv",
}
]
});TypeScript Support
Full types and interfaces are included out of the box — no extra @types package needed.
types.ts
import { Render25, SendEmailOptions, SendEmailResponse } from "render25";
const client = new Render25();
const options: SendEmailOptions = {
from: "notifications@yourdomain.com",
to: "user@example.com",
subject: "System Alert",
html: "<p>All systems operational.</p>",
};
const response: SendEmailResponse = await client.emails.send(options);
console.log(response.id);Framework Examples
Next.js
App Router API Routes & Server Actions
Express
Use in Express route controllers
app/api/send/route.ts
import { Render25 } from "render25";
import { NextResponse } from "next/server";
const render25 = new Render25();
export async function POST(req: Request) {
try {
const { to, subject, html } = await req.json();
const data = await render25.emails.send({
from: "notifications@yourdomain.com",
to,
subject,
html,
});
return NextResponse.json(data);
} catch (error: any) {
return NextResponse.json({ error: error.message }, { status: 500 });
}
}