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, or change the send time. Accepts Date objects or ISO strings.
// 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'),});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.
We use analytics cookies to understand how you use our site and improve your experience. Privacy Policy