Quickstart
Create an inbox and send your first email with the AgenticEmail SDK.
This guide takes you from an API key to a sent email in two steps. Make sure you have installed the SDK and set AGENTICEMAIL_API_KEY as shown in the Introduction.
1. Create an inbox
An inbox is a real, addressable mailbox your agent can send from and receive to. Create one at runtime with a single call.
const inbox = await client.inboxes.create({
username: "support-agent",
// omit `domain` to use the shared sending domain,
// or pass a verified custom domain you have added
});
console.log(inbox.address); // support-agent@inbox.agenticemail.com
inbox = client.inboxes.create(username="support-agent")
print(inbox.address) # support-agent@inbox.agenticemail.com
2. Send an email
Send from the inbox you just created. Attachments, HTML, and threading are all supported.
const message = await client.messages.send({
inboxId: inbox.id,
to: "customer@example.com",
subject: "Thanks for reaching out",
text: "Hi there - an agent will follow up shortly.",
});
console.log(message.id);
message = client.messages.send(
inbox_id=inbox.id,
to="customer@example.com",
subject="Thanks for reaching out",
text="Hi there - an agent will follow up shortly.",
)
print(message.id)
3. Read messages
List inbound messages for an inbox. Each message is returned as parsed JSON - no MIME handling required.
const { messages } = await client.messages.list({ inboxId: inbox.id });
for (const m of messages) {
console.log(m.from, m.subject, m.text);
}
To react to incoming mail the instant it arrives instead of polling, set up a webhook or WebSocket in Receiving email.