# Node.js SDK

Use the published Node.js client for sending and reading email, and verifying webhook signatures.

Source: https://docs.ravenrelay.joshlab.site/node-sdk

Agent index: https://docs.ravenrelay.joshlab.site/llms.txt
OpenAPI: https://docs.ravenrelay.joshlab.site/openapi.json

## Package availability

> @ravenrelay/node is published on npm starting with version 0.1.0. Install it with npm install @ravenrelay/node. Requires Node.js 22.9 or later; keep this client and API keys on the server. The repository contains security hardening prepared for 0.1.1; those changes require a new npm release.

## Create a client

TypeScript · Node.js SDK

```
import { RavenRelay } from '@ravenrelay/node';

const raven = new RavenRelay({
  apiKey: process.env.RAVENRELAY_API_KEY!,
  baseUrl: 'https://api-production-1c6a.up.railway.app',
  timeoutMs: 10000,
});

const accepted = await raven.emails.send({
  from: 'hello@example.com',
  to: 'user@example.net',
  subject: 'Welcome',
  text: 'Hello from RavenRelay',
}, { idempotencyKey: 'welcome-user-123' });

const email = await raven.emails.get(accepted.id);
const page = await raven.emails.list({ status: 'sent' });
```

Set baseUrl explicitly to your deployment. The client accepts a custom fetch implementation and request timeout. It throws RavenRelayError with status, code and message for API errors, and does not automatically retry sends.
