Quickstart
Send your first email with the TypeScript SDK.
Create an API key
In the dashboard, open your project's Development environment and create an API key. Development
keys start with coss_test_: emails sent with them are recorded but never delivered, so you can
experiment freely. See Environments and API keys.
export COSS_API_KEY=coss_test_...Install the SDK
npm install cossThe SDK is not published to npm yet. Until it is, use it from the COSS repository.
Send an email
The client reads COSS_API_KEY from the environment when you don't pass apiKey.
import { } from "coss";
const = new ();
const { , } = await ..({
: "Acme <onboarding@acme.com>",
: "user@example.com",
: "Hello from COSS",
: "<p>It works!</p>",
});
if () {
.(., .);
} else {
.(., data.);}Every method returns { data, error } and never throws for API or network failures.
Follow delivery
Each recipient has its own delivery status. Fetch the email again, or subscribe to webhooks to be told when it changes.
const { : } = await ..("email_01k7c8m4q2f3e9v6t5r1n0p8yz");
for (const of ?. ?? []) {
.(., .);
}When you are ready to deliver real email, verify a domain and switch to a key from the Production environment.