Skip to main content

TypeScript SDK

The simpleemailapi package provides a fully typed, backend-first SDK for Node.js workflows.

Installation

npm install simpleemailapi

Usage

Initialize the client with your API key and use the client.send method.
import { createClient } from 'simpleemailapi';

const client = createClient({ apiKey: 'sea_live_...' });

const result = await client.send({
  from: '[email protected]', // Must be verified
  to: ['[email protected]'],
  subject: 'Welcome aboard!',
  text: 'Thanks for signing up.', // inferred from 'body' in proto but 'text' is common alias, let's stick to proto 'body' for accuracy
  body: 'Thanks for signing up.',
  html: '<p>Thanks for signing up.</p>'
});

console.log('Email ID:', result.id);
The from address must belong to a domain you have verified.

Client Configuration

The createClient function accepts the following options:
apiKey
string
required
Your API Key, starting with sea_live_.
baseUrl
string
API endpoint URL. Defaults to https://api.simpleemailapi.dev.

arguments

The client.send method accepts an object with the following properties:
from
string
required
Sender email address. Must be from a verified domain.
to
string[]
required
List of primary recipient email addresses.
subject
string
required
Email subject line.
body
string
Plain text content of the email.
html
string
HTML content of the email.
cc
string[]
List of CC recipient email addresses.
bcc
string[]
List of BCC recipient email addresses.
attachments
Attachment[]
List of files to attach.
replyTo
string
Reply to a previous email using its id from our response. We automatically resolve threading headers.
inReplyTo
string
Raw Message-ID for threading (advanced). Use replyTo for simpler threading with our email IDs.
references
string[]
List of message IDs for threading context.
headers
Record<string, string>
Custom headers. // Proto has metadata, effectively custom headers/metadata.
metadata
Record<string, string>
Custom key-value metadata.
scheduledAt
Date
Schedule the email for future delivery.
All emails are queued for reliable delivery with automatic retries. Use webhooks or event streaming to track delivery status.