Prerequisites
Before you start, you need:- A Sendbaze API key
- A verified domain. A test key works without one, and so does the shared test address for emails to yourself.
Guide
1
Install
Get the Sendbaze SDK. It is a zero-dependency client built on
fetch and runs on Node.js 20+, Bun, Deno, Cloudflare Workers and Vercel Edge.2
Set your API key
Store the key in an environment variable in your
.env file..env
3
Send an email
send.ts
4
Try it
Run the file and check the Logs page. With a live key the email arrives within seconds; with a test key it appears in the logs with a test badge and is never delivered.
Examples
Handle errors
Every non-2xx response throws aSendbazeError with a stable code that matches the errors reference. Network failures throw SendbazeConnectionError, which is safe to retry with the same idempotency key.
Send with a template
Attach a file
Send a React component
Prefer components to HTML strings? Install@react-email/render react react-dom, then pass react instead of html. The SDK renders the HTML and a plain-text part before sending. See React Email.
Look up a message
SDK reference
Every resource the SDK covers: emails, templates, domains, suppressions, webhooks, SMS and usage.