📡 TrashInbox API

Complete API documentation for integrating disposable email functionality into your applications

GET

Retrieve Inbox Emails

Fetches all emails for a specific disposable inbox. Returns emails in reverse chronological order (newest first).

https://junkinbox.cc/api/inbox/{inbox-name}/emails

Parameters

inbox-name string

The name of the inbox (part before @junkinbox.cc). Can contain letters, numbers, hyphens, dots, and underscores.

Example Request

# Get emails from [email protected] curl "https://junkinbox.cc/api/inbox/demo/emails" \ -H "Accept: application/json"

Response

Success (200)

{ "inbox": "demo", "emails": [ { "id": "64f7e1234567890abcdef123", "from": "[email protected]", "subject": "Confirm your account", "body": "Click the link below to verify your email address...", "html": "<html><body>Click <a href='...'>here</a></body></html>", "createdAt": "2025-08-10T17:30:00Z" } ] }

Response Fields

inbox string

The inbox name that was requested

emails array

Array of email objects (empty if no emails)

emails[].id string

Unique identifier for the email

emails[].from string

Sender's email address

emails[].subject string

Email subject line

emails[].body string

Plain text content of the email

emails[].html string

HTML content of the email (if available)

emails[].createdAt string

ISO 8601 timestamp when email was received

🔐 Authentication

The TrashInbox API is completely open and free. No API keys, tokens, or authentication required.

# No authentication needed - just make the request curl "https://junkinbox.cc/api/inbox/mytest/emails"

Why no authentication? TrashInbox is designed for disposable, temporary email addresses. Since all emails are public and auto-delete after 24 hours, there's no sensitive data to protect.

⏱️ Rate Limits

API requests are limited to prevent abuse:

Limit 100 requests

Per 15-minute window per IP address

Rate limit headers are included in every response:

HTTP/2 200 ratelimit-policy: 100;w=900 ratelimit-limit: 100 ratelimit-remaining: 87 ratelimit-reset: 743

If you exceed the rate limit, you'll receive a 429 Too Many Requests response.

💻 Code Examples

JavaScript (Node.js)

// Fetch emails from inbox async function getEmails(inboxName) { try { const response = await fetch( `https://junkinbox.cc/api/inbox/${inboxName}/emails` ); if (!response.ok) { throw new Error(`HTTP ${response.status}: ${response.statusText}`); } const data = await response.json(); console.log(`Found ${data.emails.length} emails in ${data.inbox}`); return data.emails; } catch (error) { console.error('Error fetching emails:', error); return []; } } // Usage const emails = await getEmails('demo'); emails.forEach(email => { console.log(`From: ${email.from}`); console.log(`Subject: ${email.subject}`); console.log(`Received: ${email.createdAt}`); });

Python

import requests import json from datetime import datetime def get_emails(inbox_name): """Fetch emails from TrashInbox API""" url = f"https://junkinbox.cc/api/inbox/{inbox_name}/emails" try: response = requests.get(url, timeout=10) response.raise_for_status() data = response.json() print(f"Found {len(data['emails'])} emails in {data['inbox']}") return data['emails'] except requests.exceptions.RequestException as e: print(f"Error fetching emails: {e}") return [] # Usage emails = get_emails('demo') for email in emails: print(f"From: {email['from']}") print(f"Subject: {email['subject']}") print(f"Received: {email['createdAt']}") print("-" * 40)

PHP

[ 'timeout' => 10, 'header' => 'Accept: application/json' ] ]); $response = file_get_contents($url, false, $context); if ($response === FALSE) { echo "Error fetching emails\n"; return []; } $data = json_decode($response, true); echo "Found " . count($data['emails']) . " emails in " . $data['inbox'] . "\n"; return $data['emails']; } // Usage $emails = getEmails('demo'); foreach ($emails as $email) { echo "From: " . $email['from'] . "\n"; echo "Subject: " . $email['subject'] . "\n"; echo "Received: " . $email['createdAt'] . "\n"; echo str_repeat('-', 40) . "\n"; } ?>

❌ Error Handling

HTTP Status Codes

200 OK
Request successful
404 Not Found
Invalid endpoint
429 Too Many Requests
Rate limit exceeded
500 Internal Server Error
Server issue

Error Response Format

{ "error": "Too Many Requests", "message": "Rate limit exceeded. Try again later.", "code": 429 }

🎯 Common Use Cases

Email Verification Testing

Test signup flows by sending verification emails to TrashInbox addresses and checking for delivery.

Automated Testing

Integrate with CI/CD pipelines to test email-dependent features without sending emails to real users.

Development & Debugging

Monitor what emails your application is sending during development without cluttering real inboxes.

QA Testing

Create multiple test accounts with disposable emails for comprehensive testing scenarios.

Need help? Contact us or visit the main site