Posthawk
SDK

Node.js
SDK

The official Posthawk SDK for Node.js, Next.js, React, and Express. Full TypeScript support, zero dependencies, and built-in React Email integration. Send your first email in under a minute.

$ npm install posthawkposthawk
Simple API

Send emails with
four lines of code

Initialize the client, call send, and check the result. Every method returns { data, error } — no try/catch needed.

TypeScript
import { Posthawk } from 'posthawk';const posthawk = new Posthawk('ck_live_...');const { data, error } = await posthawk.emails.send({  from: 'hello@yourdomain.com',  to: 'user@example.com',  subject: 'Welcome!',  html: '<h1>Hello!</h1>',});if (error) {  console.error(error.message);} else {  console.log('Sent!', data.jobId);}
React Email
import { Posthawk } from 'posthawk';import { WelcomeEmail } from './emails/welcome';const posthawk = new Posthawk('ck_live_...');const { data, error } = await posthawk.emails.send({  from: 'hello@yourdomain.com',  to: 'user@example.com',  subject: 'Welcome aboard!',  react: WelcomeEmail({ name: 'Alex' }),});
React Email

Components, not
HTML strings

Pass React Email components via the react prop. The SDK renders them to HTML at send time. No manual rendering step needed.

Scheduling

Schedule, cancel,
and reschedule

Send later by adding scheduledFor. Full management API to list, cancel, or change the send time. Accepts Date objects or ISO strings.

TypeScript
// Schedule for laterconst { data } = await posthawk.emails.send({  from: 'hello@yourdomain.com',  to: 'user@example.com',  subject: 'Reminder',  text: "Don't forget your meeting!",  scheduledFor: '2026-03-15T09:00:00Z',  timezone: 'America/New_York',});// Manage scheduled emailsconst list = await posthawk.scheduled.list();await posthawk.scheduled.cancel('id');await posthawk.scheduled.reschedule('id', {  scheduledFor: new Date('2026-04-01T10:00:00Z'),});
Getting started

Up and running
in minutes

01

Install the package

One command to add Posthawk to your project. Works with npm, pnpm, yarn, and bun.

02

Create a client

Initialize with your API key. The SDK handles auth headers, serialization, and error wrapping.

03

Send your first email

Call posthawk.emails.send() with your content. Get back a typed response with delivery status.

React Email Support

Pass React Email components directly via the react prop. The SDK renders them to HTML automatically.

Zero Dependencies

Uses native fetch — no bloated HTTP clients. Ships as ESM and CommonJS with full TypeScript declarations.

Schedule Emails

Schedule, list, cancel, and reschedule emails. Accepts Date objects or ISO 8601 strings.

Never Throws

Every method returns { data, error } — no try/catch needed. Type-safe discriminated unions.

Start sending emails

Install the SDK and send your first email in under a minute.

Cookie Preferences

We use analytics cookies to understand how you use our site and improve your experience. Privacy Policy