SDKs
TypeScript and JavaScript
Configure and use the official @fluxdigest/sdk package.
Package not yet published
@fluxdigest/sdk is the planned official package name. Installation becomes
available when the developer platform enters private beta.
Requirements
- Node.js 20 or newer;
- ESM-compatible server, serverless, or edge runtime;
- a test or live FluxDigest API key;
- TypeScript 5.5 or newer for the best type experience.
Install
npm install @fluxdigest/sdkConfigure
import { FluxDigest } from "@fluxdigest/sdk";
const fluxdigest = new FluxDigest({
apiKey: process.env.FLUXDIGEST_API_KEY,
timeout: 30_000,
maxRetries: 2,
});Available client options:
| Option | Type | Default | Purpose |
|---|---|---|---|
apiKey | string | Required | Test or live server credential |
timeout | number | 30000 | Per-request timeout in milliseconds |
maxRetries | number | 2 | Maximum automatic retry attempts |
baseUrl | string | Production URL | Sandbox, regional, or test endpoint |
fetch | typeof fetch | Global fetch | Custom transport implementation |
Resource clients
The client exposes one property per public resource:
fluxdigest.workspaces
fluxdigest.subscribers
fluxdigest.newsletters
fluxdigest.campaigns
fluxdigest.segments
fluxdigest.forms
fluxdigest.templates
fluxdigest.media
fluxdigest.analytics
fluxdigest.operations
fluxdigest.webhookEndpoints
fluxdigest.webhooksRequest options
All request methods accept optional transport controls as their final argument:
const controller = new AbortController();
await fluxdigest.subscribers.list(
{ workspaceId: "ws_123", limit: 50 },
{
signal: controller.signal,
timeout: 10_000,
maxRetries: 1,
},
);Mutation request options also accept idempotencyKey:
await fluxdigest.campaigns.send(
"cmp_123",
{ workspaceId: "ws_123" },
{ idempotencyKey: "digest-2026-W35" },
);Pagination
Read a single page when building paginated interfaces:
const page = await fluxdigest.subscribers.list({
workspaceId: "ws_123",
limit: 50,
});
console.log(page.data, page.pagination.nextCursor);Use an async iterator for background jobs:
for await (const subscriber of fluxdigest.subscribers.listAutoPaging({
workspaceId: "ws_123",
status: "active",
})) {
await indexSubscriber(subscriber);
}Error handling
import {
FluxDigestError,
FluxDigestRateLimitError,
FluxDigestValidationError,
} from "@fluxdigest/sdk";
try {
await fluxdigest.subscribers.create({
workspaceId: "ws_123",
email: "not-an-email",
name: "Invalid example",
});
} catch (error) {
if (error instanceof FluxDigestValidationError) {
console.error(error.param, error.code);
} else if (error instanceof FluxDigestRateLimitError) {
console.error(error.retryAfter);
} else if (error instanceof FluxDigestError) {
console.error(error.requestId);
}
}Browser protection
The SDK can eventually support OAuth access tokens in browser runtimes. It
rejects fd_live_ and fd_test_ API keys in browsers because bundled secrets
can be extracted by anyone using the application.

