Node.js SDK
Configure the OpenSES client for self-hosted environments.
Requirements
- Node.js 18 or newer
- An OpenSES project API key beginning with
opk_live_oropk_test_ - A verified sender domain
- An active Amazon SES connection
Configuration
import { OpenSES } from '@openses/openses';
const client = new OpenSES({
apiKey: process.env.OPENSES_API_KEY,
baseUrl: 'https://email.mycompany.com',
});OpenSES is currently available for self-hosted deployments only. The hosted API origin is reserved for a future hosted service, so production SDK users should set baseUrl to their own OpenSES API origin.
Resend-compatible client
Transactional Resend integrations can switch the package import while keeping the familiar client and response contract:
import { Resend } from '@openses/openses';
const resend = new Resend(process.env.OPENSES_API_KEY, {
baseUrl: 'https://email.mycompany.com',
});
const { data, error } = await resend.emails.send({
from: 'Acme <noreply@acme.com>',
to: 'user@example.com',
subject: 'Welcome',
html: '<h1>Welcome</h1>',
});See Migrate from Resend for supported fields and known differences.
| Option | Type | Description |
|---|---|---|
apiKey | string | Project API key. Defaults to OPENSES_API_KEY. |
baseUrl | string | Your self-hosted OpenSES API origin. Required while the hosted service is unavailable. |
fetch | typeof fetch | Optional compatible fetch implementation. |
Per-request options
Every email method accepts a final RequestOptions parameter.
const controller = new AbortController();
await client.emails.get('em_123', {
signal: controller.signal,
headers: {
'X-Request-ID': crypto.randomUUID(),
},
});RequestOptions can also override apiKey and baseUrl for one call.
Module formats
The package ships ESM and CommonJS builds with TypeScript declarations and source maps.
import { OpenSES } from '@openses/openses';const { OpenSES } = require('@openses/openses');