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 posthawkposthawkInitialize the client, call send, and check the result. Every method returns { data, error } — no try/catch needed.
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);}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' }),});Pass React Email components via the react prop. The SDK renders them to HTML at send time. No manual rendering step needed.
Send later by adding scheduledFor. Full management API to list, cancel, reschedule, or send immediately with sendNow.
// 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'),});// Send a scheduled email immediatelyawait posthawk.scheduled.sendNow('id');// Create a newsletterconst { data: nl } = await posthawk.newsletters.create({ slug: 'weekly-digest', name: 'Weekly Digest', double_opt_in: true,});// Add a subscriberawait posthawk.newsletters.addSubscriber(nl.id, { email: 'user@example.com', name: 'Alex',});// Create and send an issueconst { data: issue } = await posthawk.newsletters.createIssue(nl.id, { subject: 'Issue #1: Getting Started', html: '<h1>Welcome!</h1><p>Your first issue.</p>',});await posthawk.newsletters.sendIssue(nl.id, issue.id);Full newsletter management API — create newsletters, add subscribers, draft issues, and send to all active subscribers in one call.
Queue up to 100 emails in one call with emails.batch, and manage the suppression list with suppressions so bounced and complained addresses never get hit again.
// Send up to 100 emails in a single callconst { data } = await posthawk.emails.batch([ { from: 'hi@you.com', to: 'a@example.com', subject: 'Hi', html: '<p>One</p>' }, { from: 'hi@you.com', to: 'b@example.com', subject: 'Hi', templateId: 't_welcome' },]);console.log(data.queued, data.failed);// Keep your sender reputation cleanawait posthawk.suppressions.create({ email: 'bounced@example.com' });const { data: list } = await posthawk.suppressions.list();Every Posthawk endpoint is a typed method on the client — no raw HTTP, no guessing at shapes.
posthawk.emailssend · get · batch
posthawk.scheduledlist · get · cancel · reschedule · sendNow
posthawk.broadcastscreate · list · send · cancel
posthawk.newslettersissues · subscribers · CRUD
posthawk.contactslist · create · update · import
posthawk.domainsverify · receiving · limits · webhook
posthawk.webhookscreate · update · test · delete
posthawk.suppressionslist · create · delete
posthawk.templatesrender
One command to add Posthawk to your project. Works with npm, pnpm, yarn, and bun.
Initialize with your API key. The SDK handles auth headers, serialization, and error wrapping.
Call posthawk.emails.send() with your content. Get back a typed response with delivery status.
Pass React Email components directly via the react prop. The SDK renders them to HTML automatically.
Uses native fetch — no bloated HTTP clients. Ships as ESM and CommonJS with full TypeScript declarations.
Schedule, list, cancel, and reschedule emails. Accepts Date objects or ISO 8601 strings.
Every method returns { data, error } — no try/catch needed. Type-safe discriminated unions.
Install the SDK and send your first email in under a minute.
I use analytics cookies to understand how you use the site and improve your experience. Privacy Policy