← Use Cases/Multi-Account Testing

Multi-Account & Parallel State Testing

Test complex user flows that require interacting across dozens or hundreds of accounts simultaneously. Whether it's validating refer-a-friend loops, multiplayer states, or bulk notification systems, disposable inboxes ensure completely isolated sessions.

What you'll need

  • A Startup, Growth, or Enterprise API key (high rate limits required)
  • Test runner capable of parallel execution (e.g., Jest, Playwright, or custom scripts)
  • WebSocket connectivity for parallel real-time listeners (optional, but recommended over polling)

Mass Inbox Provisioning

You can create hundreds of inboxes concurrently using the SDK. On the Enterprise plan, your rate limit allows up to 100 requests per second.

typescript
import { randomBytes } from "crypto";
import { FreecustomEmailClient } from "freecustom-email";

const fce = new FreecustomEmailClient({ apiKey: process.env.FCE_API_KEY! });

const genInbox = () => `user-${randomBytes(4).toString("hex")}@ditapi.info`;

async function provisionInboxes(count: number): Promise<string[]> {
  const tasks = Array.from({ length: count }).map(async () => {
    const inbox = genInbox();
    await fce.inboxes.register(inbox);
    return inbox;
  });

  // Execute concurrently
  return Promise.all(tasks);
}

// Provision 50 isolated inboxes in ~1 second
const accounts = await provisionInboxes(50);
console.log(accounts);

Real-time Bulk Listening (WebSockets)

Polling 50+ inboxes via REST would quickly exhaust your rate limits and become sluggish. The Node.js SDK makes it trivial to subscribe to hundreds of inboxes over a single WebSocket connection.

typescript
// 1. Listen for new emails globally
fce.ws.on("new_message", (event) => {
  console.log(`[NEW EMAIL] ${event.inbox}: ${event.message.subject}`);
  
  if (event.message.otp) {
    console.log(`Extracted OTP for ${event.inbox}: ${event.message.otp}`);
    // Emit to your test framework's event bus...
  }
});

// 2. Connect the WebSocket (automatically fetches a ticket)
await fce.ws.connect();

// 3. Subscribe to all the inboxes you just provisioned
accounts.forEach((inbox) => {
  fce.ws.subscribe(inbox);
});

Alternative: Webhooks

If you are testing asynchronous workflows spanning minutes or hours (e.g., drip campaigns, delayed welcome emails), keeping a WebSocket open is impractical. Instead, configure a webhook to receive POST notifications to your staging backend or CI listener.

bash
# Register a webhook for the inbox (Requires Growth/Enterprise plan)
curl -X POST "https://api2.freecustom.email/v1/webhooks" \
  -H "Authorization: Bearer fce_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "inbox": "user-a1b2c3d4@ditapi.info",
    "url": "https://ci-runner.your-app.com/fce-callbacks"
  }'