SDK Quickstart
Use the Node.js or Python SDK.
SDK Quickstart
Node.js
Install
npm install lumboxCreate Inbox → Wait for OTP → Reply
import { Lumbox } from "lumbox";
const client = new Lumbox({
apiKey: "ak_your_key_here",
baseUrl: "http://localhost:3000", // or https://api.lumbox.co
});
// Create a disposable inbox
const inbox = await client.inboxes.create({ name: "github-signup" });
console.log(`Email: ${inbox.address}`);
// → github-signup-a7x@lumbox.co
// ... use inbox.address to sign up on a platform ...
// Wait for the verification email (blocks up to 60s)
const email = await client.inboxes.waitForEmail(inbox.id, {
from: "github.com",
timeout: 60,
});
console.log(`Got email: ${email.subject}`);
// Or just get the OTP code directly
const otp = await client.inboxes.getOtp(inbox.id, {
from: "github.com",
timeout: 60,
});
console.log(`OTP: ${otp.code}`);
// → "847291"
// Send a reply
await client.inboxes.reply(inbox.id, {
emailId: email.id,
text: "Thanks for the code!",
});
// Clean up
await client.inboxes.delete(inbox.id);Search Across Inboxes
const results = await client.emails.search({
query: "invoice",
from: "stripe.com",
});
for (const email of results.data) {
console.log(`${email.from_address}: ${email.subject}`);
}Custom Domain
// Add domain
const domain = await client.domains.add({ domain: "mycompany.com" });
console.log("Configure these DNS records:", domain.dns_records);
// After configuring DNS...
const verified = await client.domains.verify(domain.id);
console.log(`Status: ${verified.status}`); // → "ACTIVE"
// Create inbox on custom domain
const inbox = await client.inboxes.create({
name: "support",
domain: "mycompany.com",
local_part: "support",
});
// → support@mycompany.comPython
Install
pip install lumboxCreate Inbox → Wait for OTP
from lumbox import Lumbox
client = Lumbox(
api_key="ak_your_key_here",
base_url="http://localhost:3000",
)
# Create inbox
inbox = client.inboxes.create(name="github-signup")
print(f"Email: {inbox['address']}")
# Wait for OTP (blocks up to 60s)
otp = client.inboxes.get_otp(
inbox["id"],
from_address="github.com",
timeout=60,
)
print(f"OTP: {otp['code']}")
# Send an email
client.inboxes.send(
inbox["id"],
to="someone@example.com",
subject="Hello from my agent",
text="This email was sent by an AI agent.",
)
# Clean up
client.inboxes.delete(inbox["id"])With LangChain
from lumbox.langchain import LumboxToolkit
toolkit = LumboxToolkit(api_key="ak_your_key_here")
tools = toolkit.get_tools()
# Returns LangChain Tool objects for: create_inbox, wait_for_email, get_otp, etc.Plain HTTP (curl)
No SDK needed — the REST API is straightforward:
API="http://localhost:3000"
KEY="ak_your_key_here"
# Create inbox
curl -X POST "$API/v1/inboxes" \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{"name":"test"}'
# Wait for OTP (blocks up to 30s)
curl "$API/v1/inboxes/inb_abc123/otp?timeout=30&from=github.com" \
-H "X-API-Key: $KEY"
# Send email
curl -X POST "$API/v1/inboxes/inb_abc123/send" \
-H "X-API-Key: $KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "someone@example.com",
"subject": "Hello",
"text": "Sent by an AI agent"
}'