Virtual Mailbox SandboxPolling Sync

Virtual Email & SMS Web Inbox

Inspect test emails, OTP verification codes, magic links, itemized receipts with Cloudinary attachments, and SMS messages dispatched in your sandbox session.

No messages found

Send a test email/SMS or trigger an auth signup to see messages here.

No message selected

Select a message from the sidebar to inspect rendered HTML, verify security headers, extract OTP codes, or download Cloudinary attachments.

Virtual Inbox Architecture & Capabilities

Playground API provides a completely zero-configuration, in-memory & cloud-backed virtual communication sandbox. When your backend or frontend sends transactional emails, verification SMS, or password reset instructions, messages are captured in real-time inside your session sandbox instead of delivering to real telecom or email networks.

Automated OTP Extraction

Regex-powered OTP parser automatically identifies 4-8 digit numeric verification codes and magic links in both emails and SMS.

Cloudinary CDN Storage

Email attachments are automatically uploaded and namespaced to playground_api/emails/attachments/<session> and cleaned up on sandbox reset.

Real-Time SSE Sync

Subscribed to Server-Sent Events (/stream/notifications) so the web inbox auto-updates instantly as messages are sent.

Built-in Transactional Templates

You can reference built-in templates by passing the template property when calling POST /api/v1/emails/send along with variable substitutions in data:

Template IDDescriptionInterpolated Variables
welcome-verificationSignup welcome email with 6-digit verification code & link{{name}}, {{otp}}, {{verification_link}}, {{expires_in_minutes}}
password-resetSecure password reset instructions with security details{{name}}, {{otp}}, {{reset_link}}, {{ip_address}}, {{device}}
invoice-receiptItemized transaction receipt with attachment download{{name}}, {{invoice_id}}, {{amount}}, {{plan_name}}, {{payment_method}}
2fa-codeHigh-priority two-factor authentication security code{{name}}, {{otp}}, {{device}}, {{location}}

Code Examples & Test Automation

Dispatching Emails with Attachments (TypeScript SDK)

typescript
1
// 1. Send transactional email using TypeScript SDK
2
import { PlaygroundClient } from 'playground-api';
3
4
const client = new PlaygroundClient({
5
identityToken: 'your_sandbox_identity_token'
6
});
7
8
const email = await client.emails.send({
9
to: 'developer@example.com',
10
template: 'welcome-verification',
11
data: {
12
name: 'Alex Rivera',
13
otp: '948201',
14
verification_link: 'https://myapp.com/verify?code=948201',
15
expires_in_minutes: 15
16
},
17
attachments: [
18
{
19
name: 'receipt_invoice_902.pdf',
20
content: 'JVBERi0xLjQKJ...', // Base64 encoded or CDN URL
21
type: 'application/pdf'
22
}
23
]
24
});
25
26
console.log('Email dispatched to virtual sandbox:', email.id);
27
console.log('Extracted OTP code:', email.otp_code);

Automated E2E Signup OTP Verification (Playwright)

typescript
1
// 2. Fetch Sandbox Inbox in Automated E2E Tests (Playwright/Cypress)
2
import { test, expect } from '@playwright/test';
3
4
test('verify user signup OTP code', async ({ request }) => {
5
// Trigger signup on your frontend app
6
const signupRes = await request.post('http://localhost:3000/api/auth/register', {
7
data: { name: 'E2E User', username: 'e2e_user', email: 'e2e@example.com' }
8
});
9
expect(signupRes.ok()).toBeTruthy();
10
11
// Query Playground API Virtual Inbox
12
const inboxRes = await request.get('https://playground.nileslabs.com/api/v1/inbox?type=email&to=e2e@example.com');
13
const inboxJson = await inboxRes.json();
14
15
const welcomeEmail = inboxJson.data[0];
16
expect(welcomeEmail).toBeDefined();
17
18
// Extract 6-digit OTP code directly from API payload
19
const otpCode = welcomeEmail.otp_code;
20
console.log('Automated OTP retrieved:', otpCode);
21
22
// Submit OTP to complete verification flow
23
const verifyRes = await request.post('http://localhost:3000/api/auth/verify-email', {
24
data: { email: 'e2e@example.com', otp: otpCode }
25
});
26
expect(verifyRes.ok()).toBeTruthy();
27
});

Inbox & Communication REST Endpoints

POST/api/v1/emails/send
Send virtual transactional email
GET/api/v1/emails
List all sent emails for current session
POST/api/v1/sms/send
Send simulated SMS message
GET/api/v1/inbox
List unified email & SMS messages
DELETE/api/v1/inbox
Clear all inbox messages & clean up Cloudinary assets