Skip to content

SDKs

@all2cf/send is public on npm and verified from clean npm and pnpm installations. Both package managers use the same npm Registry package.

Terminal window
npm install @all2cf/send
# or
pnpm add @all2cf/send
import { CFsend } from "@all2cf/send";
const send = new CFsend(process.env.ALL2CF_SEND_KEY, {
baseUrl: process.env.ALL2CF_SEND_URL,
});
await send.emails.send({
from: "hello@example.com",
to: "customer@example.net",
subject: "Your receipt",
html: "<h1>Paid</h1>",
});

The client returns { data, error } rather than hiding API failures. Set ALL2CF_SEND_URL and ALL2CF_SEND_KEY, or pass an explicit URL to the constructor. A custom fetch and timeout are supported.

  • emails.send/get/list/cancel/update/retry and attachment reads
  • batch.send with idempotency and validation mode
  • templates, webhooks, API keys, domains and logs
  • suppressions, topics and subscription preferences
const { data, error } = await send.emails.send({
from: "hello@example.com",
to: "customer@example.net",
subject: "Welcome",
template: { id: "welcome", environment: "production", variables: { name: "Mina" } },
idempotencyKey: "welcome-user-42",
});
if (error) throw new Error(`${error.name}: ${error.message}`);

Python, PHP, Go, Java, .NET, Ruby and Rust source packages follow the same public REST contract and require the customer Runtime URL and key. They remain source previews until each named registry shows the released package and a clean-install send is recorded. Do not use a Business Mail package or a shared All2CF endpoint.