- A ByteSend API key, exported as
BYTESEND_API_KEY - A verified domain to send from
BYTESEND_API_KEY from the environment automatically, so you don’t need to pass it in code.
Node.js
package.json
send.js
SDK methods return
{ data, error } instead of throwing, so always check error before using data.TypeScript
package.json
send.ts
React Email (TypeScript)
Pass a React Email component asreact and the SDK renders it to HTML for you, so no separate render step is needed.
package.json
tsconfig.json
emails/welcome.tsx
send.tsx
React Email (JavaScript)
The same project without TypeScript.tsx runs .jsx files directly, so no Babel setup is needed.
package.json
emails/welcome.jsx
send.jsx
Next.js (App Router)
Send from a route handler, and receive webhooks in another. Keep your API key on the server and never import the SDK in a client component.app/api/welcome/route.ts
app/api/bytesend-webhook/route.ts
Express
server.ts
Safe retries and batches
Pass an idempotency key to make retries safe: sending the same payload with the same key returns the original response instead of sending twice.Python
send.py
Go
main.go

