API Documentation
Examples
const API_KEY = 'ib_live_<your-api-key>';
const BASE = 'https://api.inboxburn.com';
// Generate address
const { address, token: inboxToken } = await fetch(`${BASE}/api/generate`, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
}).then(r => r.json());
console.log('Address:', address);
// Poll inbox until email arrives
async function waitForEmail(address, inboxToken, maxWait = 60000) {
const start = Date.now();
while (Date.now() - start < maxWait) {
const { emails } = await fetch(`${BASE}/api/inbox/${address}`, {
headers: { 'X-Inbox-Token': inboxToken }
}).then(r => r.json());
if (emails.length > 0) return emails[0];
await new Promise(r => setTimeout(r, 3000));
}
return null;
}
const email = await waitForEmail(address, inboxToken);
console.log('Subject:', email?.subject);
// Get full email body
const full = await fetch(`${BASE}/api/email/${email.id}?address=${address}`, {
headers: { 'X-Inbox-Token': inboxToken }
}).then(r => r.json());
console.log('HTML:', full.body_html);