tinysend

TypeScript SDK — tinysend developers

The official SDK is tinysend on npm (currently 0.5.0) — a typed client covering the full API. Zero dependencies, fetch-based, works in Node.js, Bun, Deno, Cloudflare Workers, and browsers.

npm install tinysend
import { Tinysend } from 'tinysend';

const ts = new Tinysend('sk_...');

const list = await ts.lists.create({ name: 'Weekly Update' });
await ts.subscribers.create(list.id, {
  email: 'user@example.com',
  verified: true,
  tags: ['from:web'],
  metadata: { plan: 'pro' },
  org: 'Acme',
  job_title: 'Engineer',
});

const post = await ts.posts.create(list.id, {
  subject: 'Hello World',
  body_html: '<p>Welcome!</p>',
});
await ts.posts.send(list.id, post.id);

Resources

  • ts.lists — create, update, delete newsletters; waitlist join and invite
  • ts.subscribers — add (with tags, metadata, org, job_title written onto the contact), update, import, export
  • ts.posts — create, update, send broadcasts
  • ts.contacts — your audience across newsletters, with tags, metadata, activity, and delivery history
  • ts.mailboxes — inbound mailboxes and their emails
  • ts.sender — who emails come from: tinysend default or your own domain
  • ts.siteDomains — custom domain for your archive site
  • ts.webhooks — manage webhooks, inspect deliveries
  • ts.automations, ts.invites, ts.stats, ts.usage, ts.settings

Every method maps 1:1 to the REST API — the SDK is verified against the live openapi spec on every release, so it never drifts.

Errors

import { TinysendError } from 'tinysend';

try {
  await ts.lists.get('nonexistent');
} catch (err) {
  if (err instanceof TinysendError) {
    console.log(err.status, err.code, err.message); // 404 'not_found' 'list not found'
  }
}

Source and issues: github.com/tiny-send/tinysend-node. Sending from CI instead? Use the GitHub action.

Questions?

Contact us at hi@tinysend.com.