Api doc

Api doc

0mail.pro API Documentation

Current Version: 1.0 | Last Updated: May 16, 2025

Introduction

Welcome to the 0mail.pro API! This API allows you to programmatically manage temporary email addresses, retrieve messages, and more. It's designed to be straightforward and easy to integrate into your applications.

Key Information:

  • Base URL: https://0mail.pro/api/
  • Your API Key: llkUl92d8KTHuEr7nHaKYrmRZKB9mWs

    Important: Keep your API key confidential. It authenticates your requests.
  • Available Generic Domains:

    • Free Tier: ExampleFree1.com, ExampleFree2.com, (and others as available)
    • Premium Tier: ExamplePremium1.com, (and others as available)

    These generic names are used in documentation examples. The actual available domains can be fetched using the "Get Domains" endpoint.

Authentication

All API requests are authenticated using an API key. You must include your apiKey as a path parameter in the request URL for most endpoints.

Example: https://0mail.pro/api/domains/YOUR_API_KEY/all

HTTP Verbs

The API uses standard HTTP verbs:

  • GET: To retrieve resources.
  • POST: To create or update resources.

Response Format

All API responses are in JSON format. A typical successful response includes a status field (boolean) and a data or message field.

{
    "status": true,
    "data": { /* ... relevant data ... */ }
}
{
    "status": true,
    "message": "Operation was successful."
}

HTTP Status Codes

The API uses standard HTTP status codes to indicate the success or failure of a request:

  • 200 OK: The request was successful.
  • 201 Created: The resource was successfully created.
  • 400 Bad Request: The request was malformed.
  • 401 Unauthorized: Authentication failed.
  • 403 Forbidden: Authenticated but no permission.
  • 404 Not Found: Resource not found.
  • 500 Internal Server Error: Server-side error.
Copy Functionality: The "Copy" buttons below require Javascript to be enabled. If they don't work, you can manually select and copy the content.

1. Domain Operations

1.1. Get Available Domains

Retrieves a list of currently available domains, which can be filtered by type (free, premium, or all).

HTTP Method: GET

Endpoint Structure: /domains/{apiKey}/{type}

Full URL Example: https://0mail.pro/api/domains/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z/all

Parameters:

ParameterTypeLocationRequiredDescription
apiKeyStringPathYesYour unique API key.
typeStringPathYesType of domains to fetch. Valid options: free, premium, all.

Example Requests:

Fetching all domains:

https://0mail.pro/api/domains/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z/all

Fetching only free domains:

https://0mail.pro/api/domains/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z/free

Fetching only premium domains:

https://0mail.pro/api/domains/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z/premium

Example Success Response (200 OK):

{
    "status": true,
    "data": {
        "domains": [
            {
                "domain": "ExampleFree1.com",
                "type": "Free"
            },
            {
                "domain": "ExampleFree2.com",
                "type": "Free"
            },
            {
                "domain": "ExamplePremium1.com",
                "type": "Premium"
            }
        ]
    }
}

2. Email Address Operations

2.1. Create Email Address

Creates a new temporary email address. The system automatically generates a unique username and assigns an available domain.

HTTP Method: POST

Endpoint Structure: /emails/{apiKey}

Full URL Example: https://0mail.pro/api/emails/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z

Parameters (Path):

ParameterTypeLocationRequiredDescription
apiKeyStringPathYesYour unique API key.

Example Request:

https://0mail.pro/api/emails/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z

Example Success Response (201 Created):

{
    "status": true,
    "data": {
        "email": "[email protected]",
        "domain": "ExampleFree1.com",
        "ip": "YOUR_REQUEST_IP_ADDRESS",
        "fingerprint": "a_unique_browser_or_session_fingerprint",
        "expire_at": "2025-12-31T23:59:59.000000Z",
        "created_at": "2025-05-16T10:30:00.000000Z",
        "id": 789,
        "email_token": "unique_generated_token_for_this_email"
    }
}

2.2. Update Email Address

Allows changing the username and/or domain of an existing temporary email address.

HTTP Method: POST

Endpoint Structure: /emails/{apiKey}/{current_email}/{new_username}/{new_domain}

Parameters (Path):

ParameterTypeLocationRequiredDescription
apiKeyStringPathYesYour unique API key.
current_emailStringPathYesThe full current email address (e.g., [email protected]).
new_usernameStringPathYesThe desired new username.
new_domainStringPathYesThe desired new domain (e.g., ExampleFree2.com or ExamplePremium1.com).

Example Request:

https://0mail.pro/api/emails/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z/[email protected]/mynewcoolname/ExamplePremium1.com

Example Success Response (200 OK):

{
    "status": true,
    "data": {
        "email": "[email protected]",
        "domain": "ExamplePremium1.com",
        "ip": "YOUR_REQUEST_IP_ADDRESS",
        "fingerprint": "updated_fingerprint_if_applicable",
        "expire_at": "2025-12-31T23:59:59.000000Z",
        "created_at": "2025-05-16T10:30:00.000000Z",
        "id": 790,
        "email_token": "potentially_new_email_token"
    }
}

2.3. Delete Email Address

Permanently deletes a temporary email address and all its associated messages.

HTTP Method: POST

Endpoint Structure: /emails/{apiKey}/{email_to_delete}

Parameters (Path):

ParameterTypeLocationRequiredDescription
apiKeyStringPathYesYour unique API key.
email_to_deleteStringPathYesThe full email address to be deleted (e.g., [email protected]).

Example Request:

https://0mail.pro/api/emails/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z/[email protected]

Example Success Response (200 OK):

{
    "status": true,
    "message": "Email has been successfully deleted."
}

3. Message Operations

3.1. Get Messages for an Email

Retrieves a list of all messages received by a specific email address.

HTTP Method: GET

Endpoint Structure: /messages/{apiKey}/{email_address}

Parameters (Path):

ParameterTypeLocationRequiredDescription
apiKeyStringPathYesYour unique API key.
email_addressStringPathYesThe email address for which to retrieve messages (e.g., [email protected]).

Example Request:

https://0mail.pro/api/messages/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z/[email protected]

Example Success Response (200 OK):

{
    "status": true,
    "mailbox": "[email protected]",
    "messages": [
        {
            "id": "msg_unique_id_1",
            "subject": "Your Weekly Newsletter",
            "from": "Newsletter Sender ",
            "from_email": "[email protected]",
            "to": "[email protected]",
            "receivedAt": "2025-05-16T12:30:00Z",
            "is_seen": false,
            "html": true,
            "content": "

Hello! Here is your newsletter.

",
            "attachments": [
                {
                    "name": "report.pdf",
                    "extension": "pdf",
                    "size": 204800,
                    "url": "https://0mail.pro/api/d/msg_unique_id_1/report.pdf"
                }
            ]
        },
        {
            "id": "msg_unique_id_2",
            "subject": "Quick Update",
            "from": "[email protected]",
            "from_email": "[email protected]",
            "to": "[email protected]",
            "receivedAt": "2025-05-15T09:15:00Z",
            "is_seen": true,
            "html": false,
            "content": "Just a quick update, project is on track.",
            "attachments": []
        }
    ]
}

3.2. Get a Specific Message

Retrieves the full details of a single message by its unique message ID.

HTTP Method: GET

Endpoint Structure: /messages/{apiKey}/message/{messageId}

Parameters (Path):

ParameterTypeLocationRequiredDescription
apiKeyStringPathYesYour unique API key.
messageIdStringPathYesThe unique ID of the message to retrieve (e.g., msg_unique_id_1).

Example Request:

https://0mail.pro/api/messages/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z/message/msg_unique_id_1

Example Success Response (200 OK):

{
    "status": true,
    "data": {
        "id": "msg_unique_id_1",
        "subject": "Your Weekly Newsletter",
        "from": "Newsletter Sender ",
        "from_email": "[email protected]",
        "to": "[email protected]",
        "receivedAt": "2025-05-16T12:30:00Z",
        "is_seen": true,
        "html": true,
        "content": "

Hello! Here is your newsletter.

",
        "attachments": [
            {
                "name": "report.pdf",
                "extension": "pdf",
                "size": 204800,
                "url": "https://0mail.pro/api/d/msg_unique_id_1/report.pdf"
            }
        ]
    }
}

3.3. Delete a Specific Message

Permanently deletes a single message by its unique message ID.

HTTP Method: POST

Endpoint Structure: /messages/{apiKey}/message/{messageId}

Parameters (Path):

ParameterTypeLocationRequiredDescription
apiKeyStringPathYesYour unique API key.
messageIdStringPathYesThe unique ID of the message to delete (e.g., msg_unique_id_1).

Example Request:

https://0mail.pro/api/messages/XQYiXW0nqFdjQEZchg8AMvThdOVOJ1z/message/msg_unique_id_1

Example Success Response (200 OK):

{
    "status": true,
    "message": "Message was deleted successfully."
}

4. Attachment & Utility Operations

4.1. Download Attachment

Downloads an email attachment. The direct URL is provided within message details.

HTTP Method: GET

Endpoint Structure: /d/{message_hash_id}/{filename}

Parameters (Path):

ParameterTypeLocationRequiredDescription
message_hash_idStringPathYesThe message ID (e.g., msg_unique_id_1).
filenameStringPathYesThe name of the file (e.g., report.pdf).

Example Request (using URL from message details):

https://0mail.pro/api/d/msg_unique_id_1/report.pdf

Example Success Response:

A 200 OK response with the file content. The browser will typically initiate a download.

4.2. Token to Email (Session Recovery)

Allows direct access to an email inbox using an email_token.

HTTP Method: GET

Endpoint Structure (Note: relative to main site URL): /token/{email_token}

Full URL Example: https://0mail.pro/token/unique_generated_token_for_this_email

Parameters (Path):

ParameterTypeLocationRequiredDescription
email_tokenStringPathYesThe email_token from email creation/update.

Example Request:

https://0mail.pro/token/unique_generated_token_for_this_email

Example Success Response:

User's browser is typically redirected (e.g., via a 302 Found) to the web inbox.