TempMail API Documentation

Overview

The TempMail API allows you to programmatically manage temporary email addresses and incoming emails. All API endpoints follow RESTful principles and respond in JSON format.

Base URL

http://t-email.org/api/v1

Note: API requests are subject to rate limits (30 requests/minute). Check the X-RateLimit-Remaining field in response headers to monitor your remaining requests.

Endpoints

Get Emails

GET /emails?email={email}&limit={limit}&page={page}

Description

Get all emails for a specific temporary email address.

Parameters

Parameter Type Required Description
email string Yes Temporary email address
limit integer No Number of emails per page (default: 20, max: 100)
page integer No Page number (default: 1)

Example Response

{
    "success": true,
    "data": {
        "emails": [
            {
                "id": 123,
                "temp_email_id": 456,
                "message_id": "<[email protected]>",
                "from": "[email protected]",
                "subject": "Test Email Subject",
                "is_read": false,
                "is_starred": false,
                "received_at": "2023-04-28T14:22:33.000000Z"
            }
        ],
        "pagination": {
            "total": 5,
            "per_page": 20,
            "current_page": 1,
            "last_page": 1
        }
    }
}

Get Email Details

GET /messages/{id}?email={email}

Description

Get detailed content of a specific email message.

Parameters

Parameter Type Required Description
id integer Yes Email message ID
email string Yes Temporary email address

Get Domains

GET /domains

Description

Get a list of all available domains.

Example Response

{
    "success": true,
    "data": [
        {
            "id": 1,
            "name": "tempmail.example.com"
        },
        {
            "id": 2,
            "name": "disposable.example.org"
        }
    ]
}

Error Codes

Status Code Error Type Description
400 Bad Request Invalid request parameters
404 Not Found Email or message not found
429 Too Many Requests Request limit exceeded
500 Server Error Server error

Example Usage (JavaScript)

// Example of fetching emails
async function getEmails(tempEmail) {
    try {
        const response = await fetch(`http://t-email.org/api/v1/emails?email=${tempEmail}&limit=10`);
        const data = await response.json();
        
        if (data.success) {
            console.log('Emails:', data.data.emails);
        } else {
            console.error('Error:', data.message);
        }
    } catch (error) {
        console.error('API error:', error);
    }
}