📱 OpenInbox is now on Android & iOS! Get the app today.

OpenInbox on Telegram

Get a temp inbox right inside Telegram.

Open Telegram bot

Custom domains

Use your own domain on paid plans.

Learn More
Developer API • /golang

/golang Temp Email API

Generate disposable inboxes, receive verification emails, and extract OTP codes programmatically — all from /golang.

Why Use OpenInbox for /golang Email Testing?

Email-dependent test flows are notoriously fragile when tied to real mailboxes. OpenInbox gives /golang developers a clean, ephemeral inbox for every test run — with an API that returns emails in seconds, no IMAP or SMTP setup required.

  • Test email signup flows in /golang integration tests
  • Verify OTP delivery in CI/CD pipelines without a real inbox
  • Build email-dependent test fixtures that clean up automatically
  • Automate account creation in QA and staging environments
  • Validate transactional email content and formatting
  • Load-test email delivery at scale using the API

Quick Start — /golang

Install

installbash
npm install node-fetch   # or use native fetch in Node 18+

Create inbox & fetch emails

example.jsjavascript
const API_KEY = 'YOUR_API_KEY';
const BASE = 'https://api.openinbox.io/api';

// 1. Create a temporary inbox
const inbox = await fetch(`${BASE}/inbox`, {
  method: 'POST',
  headers: { 'X-API-KEY': API_KEY, 'Content-Type': 'application/json' },
}).then((r) => r.json());

console.log('Inbox email:', inbox.email);

// 2. Poll for emails (retry up to 10× with 3s delay)
let email;
for (let i = 0; i < 10; i++) {
  await new Promise((r) => setTimeout(r, 3000));
  const { emails } = await fetch(
    `${BASE}/inbound/api/emails?inboxEmail=${inbox.email}&limit=5`,
    { headers: { 'X-API-KEY': API_KEY } },
  ).then((r) => r.json());
  if (emails.length > 0) { email = emails[0]; break; }
}

console.log('Subject:', email?.subject);
console.log('Body:', email?.textBody?.slice(0, 200));

Key API Endpoints

POST/api/inboxCreate a new temporary inbox (no auth)
GET/api/inbound/api/emails?inboxEmail=List inbox emails (X-API-KEY)
GET/api/emails/:idGet a single email
View full API reference →

Frequently Asked Questions

How do I get an OpenInbox API key for /golang?

Sign up for OpenInbox and visit your account settings to generate an API key. Free accounts include limited API calls. Pro, Business, Premium, and 7-Day Pass plans unlock higher rate limits and additional features.

What is the base URL for the OpenInbox API?

All API requests go to https://api.openinbox.io/api/inbound/api. Authenticate with the X-API-KEY header. The API returns JSON for all operations.

How do I detect OTP codes in emails using /golang?

Fetch the email's textBody field and run a regex like /\b(\d{4,8})\b/ against it to pull out the numeric code.

Can I create multiple inboxes in a single /golang test run?

Yes — each POST /create call generates a new inbox. Pro, Business, Premium, and 7-Day Pass plans support parallel inbox creation without hitting rate limits, making them ideal for concurrent test suites.

Is the OpenInbox /golang API suitable for production use?

The API is production-grade. For staging/test environments, the free tier is usually sufficient. For high-volume automation, use a Pro, Business, or 7-Day Pass plan which provides higher rate limits and SLA guarantees.

Related Pages

Explore More

Your private inbox is one click away

Free, instant, no registration needed. Works with any service. Expires automatically after 1 hour.

View API Docs