Skip to content
DocsSDKs

SDKs

The plain HTTP API is the canonical surface. The Node SDK is a thin convenience wrapper; you can always drop down to fetch.

Choose an integration

Use the surface that matches how your product already sends mail. The API remains the source of truth; the Node SDK and SMTP submission feed the same delivery pipeline.

REST API

Best for product events, idempotency keys, templates, tags, and explicit retries.

Node SDK

Best when your service is already Node-based and you want typed helpers around REST.

SMTP

Best for legacy systems that already speak authenticated SMTP over STARTTLS.

One operational view
REST, SDK, and SMTP sends use the same logs, webhook events, suppression checks, and delivery reason codes.

Available packages

The source packages currently shipped in this repository are listed below. They are not published to public package registries yet, so the commands build the workspace packages rather than installing from npm, PyPI, Rubygems, Packagist, NuGet, Cargo, Hex, or Go modules.

sendix-node
npm
Node.js
npm install sendix-node
@sendix/cli
Source package
Node.js CLI
pnpm --filter @sendix/cli build

Node.js SDK

The Node SDK is published on npm as sendix-node. It requires Node 18 or newer and uses the same REST API documented in API reference.

npm install sendix-node
import { Sendix } from 'sendix-node';

const sendix = new Sendix({
  apiKey: process.env.SENDIX_API_KEY!,
});

const { id } = await sendix.emails.send({
  from: '[email protected]',
  to: '[email protected]',
  subject: 'Welcome to your workspace',
  html: '<h1>Welcome</h1><p>Your account is ready.</p>',
  text: 'Welcome. Your account is ready.',
  idempotency_key: 'welcome-user-123',
});

console.log('Queued email', id);

The same client exposes the live Deliverability Guardian scorecard through sendix.stats.deliverability(7 | 30 | 90). It returns observed provider, domain-authentication, and recommended-action data for the authenticated workspace.

const guardian = await sendix.stats.deliverability(30);

console.log(guardian.status, guardian.reputation.score);
for (const alert of guardian.alerts) {
  console.log(alert.severity, alert.title, alert.detail);
}

Webhook helper

Use verifyWebhookSignature with the raw request body. JSON-parsing the body before verification changes the bytes and invalidates the HMAC.

import express from 'express';
import { verifyWebhookSignature } from 'sendix-node';

const app = express();

app.post('/webhooks/sendix', express.raw({ type: 'application/json' }), async (req, res) => {
  const ok = await verifyWebhookSignature(
    req.body.toString('utf8'),
    req.header('x-sendix-signature') ?? '',
    process.env.SENDIX_WEBHOOK_SECRET!,
  );

  if (!ok) return res.status(401).send('invalid signature');

  const event = JSON.parse(req.body.toString('utf8'));
  console.log(event.type, event.data);
  return res.status(204).end();
});

Other languages

Python, Go, Rust, .NET, Ruby, PHP, and Elixir clients are not published as Sendix SDKs today. Use the REST API directly from those runtimes until a package appears in this table.

const res = await fetch('https://sendix.dev/api/v1/emails', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.SENDIX_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    from: '[email protected]',
    to: '[email protected]',
    subject: 'Welcome to your workspace',
    text: 'Welcome. Your account is ready.',
  }),
});

if (!res.ok) throw new Error(await res.text());
console.log(await res.json());

Errors and retries

API failures throw SendixError. The SDK retries 429 and 5xx responses with exponential backoff and honors Retry-After.

import { Sendix, SendixError } from 'sendix-node';

try {
  await sendix.emails.send({ /* message */ });
} catch (error) {
  if (error instanceof SendixError) {
    console.error(error.status, error.code, error.message, error.requestId);

    if (error.status === 429) {
      // The SDK already retried. Queue locally and try again later.
    }
    if (error.code === 'domain_auth_broken') {
      // Fix DNS authentication before retrying.
    }
    return;
  }
  throw error;
}