send0
SDK

TypeScript SDK

Official TypeScript SDK for send0 with full type safety. Python and Go SDKs also available.

Also available: Python SDK | Go SDK

Installation

npm install send0

Requirements: Node.js >= 18.0.0

  • Zero runtime dependencies — uses native fetch
  • Dual ESM + CJS output
  • Full TypeScript types included

Quick start

import { Send0 } from 'send0';

const send0 = new Send0('sk_live_...');

// Send an email
const email = await send0.emails.send({
  from: 'hello@yourdomain.com',
  to: 'user@example.com',
  subject: 'Welcome!',
  html: '<p>Hello from send0</p>',
});

console.log(email.id); // em_xxxx
console.log(email.status); // 'queued'

Available resources

ResourceDescription
send0.emailsSend, get, list, cancel emails
send0.contactsCreate, update, list, delete contacts
send0.templatesManage email templates
send0.domainsDomain verification and management

Static utilities

// Verify webhook signatures
Send0.webhooks.verify();

Error handling

import { Send0, Send0APIError, Send0RateLimitError } from 'send0';

try {
  await send0.emails.send({ ... });
} catch (err) {
  if (err instanceof Send0RateLimitError) {
    console.log(`Retry after ${err.retryAfter}s`);
  } else if (err instanceof Send0APIError) {
    console.log(err.code, err.message, err.statusCode);
  }
}

Test mode

Use an sk_test_ key during development. Test-mode sends are accepted, queued, and surfaced in the dashboard exactly like production — but are never delivered to real inboxes. All webhook events still fire, so you can develop and test your full integration without any external side effects.

Template support with JSX

Build email templates as React-like components with full type safety.

// emails/welcome.tsx
/** @jsxImportSource send0 */
import { Template, Text, Button } from 'send0/components';

export default function Welcome({ name }: { name: string }) {
  return (
    <Template preview={`Welcome, ${name}!`}>
      <Text>Hello {name},</Text>
      <Text>Welcome to our platform.</Text>
      <Button href="https://app.example.com">Get Started</Button>
    </Template>
  );
}