Quickstart
TypeScript quickstart
Create an inbox, wait for a verification email, and reply in the same thread.
The SDK has no dependencies and runs on Node 18+, Bun, Deno, Cloudflare Workers and browsers.
Install and set your key
npm install @send0/sdk
export SEND0_API_KEY=s0_live_…Create an inbox
import { Send0 } from "@send0/sdk";
const send0 = new Send0(); // reads SEND0_API_KEY
const inbox = await send0.inboxes.create({ name: "signup-agent", display_name: "Signup Agent" });
console.log(inbox.address); // signup-agent@send0.emailOmit name for a random address like agent-x7k2q9@send0.email. Addresses are unique and never reassigned, even after you delete the inbox.
Wait for the email
Use the address somewhere (a sign-up form, a test email from your own mailbox), then wait:
const msg = await send0.inboxes.wait(inbox.id, {
from: "*@github.com", // exact address or wildcard
timeout: 60, // seconds
});
if (!msg) throw new Error("No email within 60s");
console.log(msg.extracted?.otp); // "482913"
console.log(msg.extracted?.action_link); // "https://github.com/verify?..."
console.log(msg.extracted_text); // the new text, without quoted historywait() also returns a message that arrived up to a minute before you called it, so there's no race between triggering the email and starting to wait. See Waiting for email.
Reply in the thread
import { isDraft } from "@send0/sdk";
const reply = await send0.messages.reply(msg.id, { text: "Thanks, confirmed." });
if (isDraft(reply)) console.log("Waiting for human approval:", reply.id);
else console.log("Sent", reply.id, "in thread", reply.thread_id);The reply gets the right In-Reply-To, References and Re: subject, so it lands in the same conversation for the recipient.
Free accounts are reply-only: they can send to people who emailed the inbox first. That's exactly what a reply does. See Sending.
Read the conversation
const thread = await send0.threads.get(inbox.id, msg.thread_id);
for (const m of thread.messages) console.log(m.direction, m.from?.email, m.extracted_text);