REST API SPECIFICATION

Tài Liệu Tích Hợp API Mail Tạm

REST API cho phép các tool nuôi nick, script tự động hoá MMO gọi trực tiếp để lấy danh sách email và mã xác thực (OTP) siêu tốc.

💡 Bạn cần tài khoản để sử dụng API Token
Đăng nhập hoặc đăng ký tài khoản nhân viên để nhận API Token được phân quyền theo từng domain.
Đăng Nhập / Đăng Ký
📧

Danh Sách Endpoints Mail Tạm

Tất cả request trả về dữ liệu chuẩn JSON.

GET/api/public/temp-mail/domains
Public / No Token

Lấy danh sách các tên miền (domain) mail tạm đang hoạt động trên hệ thống.

cURL Example:
curl -X GET "https://poimail.net/api/public/temp-mail/domains"
Response JSON:
{
  "status": true,
  "data": [
    { "domain": "poimail.net", "enabled": true }
  ]
}
x-api-token required

Lấy danh sách email đã nhận và mã OTP được tự động trích xuất cho hộp thư được chỉ định.

cURL Example:
curl -X GET "https://poimail.net/api/[email protected]" \
     -H "x-api-token: otp_usr_YOUR_API_TOKEN"
Response JSON:
{
  "status": true,
  "data": {
    "docs": [
      {
        "_id": "670560a8f7c9e83120ab1234",
        "to": "[email protected]",
        "from": "[email protected]",
        "fromName": "TikTok Security",
        "subject": "Your TikTok verification code is 849201",
        "otpCode": "849201",
        "receivedAt": "2026-10-09T10:15:30.000Z"
      }
    ],
    "total": 1,
    "limit": 50,
    "page": 1
  }
}
GET/api/email/{id}
x-api-token required

Lấy chi tiết toàn bộ nội dung HTML và nội dung Text của 1 email theo ID.

cURL Example:
curl -X GET "https://poimail.net/api/email/670560a8f7c9e83120ab1234" \
     -H "x-api-token: otp_usr_YOUR_API_TOKEN"
Response JSON:
{
  "status": true,
  "data": {
    "_id": "670560a8f7c9e83120ab1234",
    "to": "[email protected]",
    "from": "[email protected]",
    "fromName": "TikTok Security",
    "subject": "Your TikTok verification code is 849201",
    "otpCode": "849201",
    "bodyHtml": "<div>Mã xác thực của bạn là: <b>849201</b></div>",
    "bodyText": "Mã xác thực của bạn là: 849201",
    "receivedAt": "2026-10-09T10:15:30.000Z"
  }
}

🐍 Code Mẫu Python (Polling Tự Động Lấy OTP)

Ví dụ script Python tự động tạo mail và lắng nghe mã OTP trong vòng 60 giây:

import time
import requests

BASE_URL = "https://poimail.net"
API_TOKEN = "otp_usr_YOUR_API_TOKEN"

# Địa chỉ email tạm bạn muốn nhận mã
TEMP_EMAIL = "[email protected]"

headers = {
    "x-api-token": API_TOKEN
}

def wait_for_otp(email, timeout=60, poll_interval=3):
    print(f"[*] Đang lắng nghe mã OTP gửi tới: {email}...")
    start_time = time.time()
    
    while time.time() - start_time < timeout:
        try:
            res = requests.get(
                f"{BASE_URL}/api/email",
                headers=headers,
                params={"email": email}
            ).json()
            
            if res.get("status") and res.get("data", {}).get("docs"):
                emails = res["data"]["docs"]
                if len(emails) > 0:
                    latest = emails[0]
                    otp = latest.get("otpCode")
                    subject = latest.get("subject")
                    print(f"[+] Nhận được email: {subject}")
                    if otp:
                        print(f"[+] >>> MÃ OTP LÀ: {otp} <<<")
                        return otp
        except Exception as e:
            print("Lỗi kết nối:", e)
            
        time.sleep(poll_interval)
        
    print("[-] Hết thời gian chờ (Timeout).")
    return None

if __name__ == "__main__":
    otp = wait_for_otp(TEMP_EMAIL)