EZMinBOX
API v1.0 Docs
Hệ thống ổn định

EZMinBOX Developers

Tích hợp dịch vụ email tạm thời vào ứng dụng của bạn chỉ với vài dòng mã. Công cụ mạnh mẽ cho automation, testing và privacy.

Giới thiệu

Chào mừng bạn đến với tài liệu hướng dẫn tích hợp **EZMinBOX API**. Hệ thống của chúng tôi cung cấp giải pháp email tạm thời (disposable email) tốc độ cao, bảo mật và dễ sử dụng thông qua giao thức REST API chuẩn.

Tốc độ cực nhanh

Tin nhắn được nhận và hiển thị trong chưa đầy 1 giây qua Webhooks và Polling.

Bảo mật & Riêng tư

Toàn bộ dữ liệu được xóa tự động sau 24h. Hỗ trợ xác thực Bearer mạnh mẽ.

Xác thực

Tất cả các yêu cầu API phải bao gốm API Key của bạn trong Header Authorization. Bạn có thể tìm thấy mã này trong phần cài đặt của Dashboard.

http
Authorization: Bearer ez_live_xxxxxxxxxxxxxxxxxxxxxxxx
Lưu ý quan trọng: Không bao giờ chia sẻ API Key của bạn công khai. Sử dụng các biến môi trường (Environment Variables) để lưu trữ khóa này trong mã nguồn của bạn.
auth API
GET/api/auth/me

Lấy thông tin tài khoản

Trả về thông tin chi tiết của người dùng hiện tại đang được xác thực qua session hoặc API Key.

Code Sample

curl
curl -X GET "https://ezminbox.com/api/auth/me" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Example

json
{
  "userId": "user_12345",
  "email": "user@example.com",
  "username": "john_doe",
  "role": "user",
  "isPremium": true,
  "webhookUrl": "https://your-domain.com/webhook"
}
account API
POST/api/accounts

Tạo Hộp thư mới

Tạo một địa chỉ email tạm thời mới. Bạn cần cung cấp địa chỉ mong muốn (bao gồm domain) và mật khẩu.

Parameters

NameTypeRequiredDescription
addressstringYesĐịa chỉ email đầy đủ (vd: hello@ezminbox.com)
passwordstringYesMật khẩu bảo mật cho tài khoản email

Code Sample

curl
curl -X POST "https://ezminbox.com/api/accounts" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "address": "test_account@ezminbox.com",
  "password": "secure_pass_99"
}'

Response Example

json
{
  "id": "acc_556677",
  "address": "test_account@ezminbox.com",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "createdAt": "2024-03-11T..."
}
GET/api/accounts/me

Thông tin hòm thư hiện tại

Lấy thông tin của hòm thư đang được sử dụng trong session.

Code Sample

curl
curl -X GET "https://ezminbox.com/api/accounts/me" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Example

json
{
  "id": "acc_556677",
  "address": "test_account@ezminbox.com",
  "expiresAt": "2024-03-12T..."
}
message API
GET/api/messages

Danh sách Email

Lấy tất cả các email hiện có trong hộp thư đang đăng nhập.

Code Sample

curl
curl -X GET "https://ezminbox.com/api/messages" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Example

json
[
  {
    "id": "msg_xyz789",
    "from_name": "Facebook",
    "from_address": "security@facebookmail.com",
    "subject": "Your login code: 678902",
    "intro": "Hi user, your login code is 678902...",
    "otpCode": "678902",
    "createdAt": "2024-03-11T..."
  }
]
GET/api/messages/[id]

Chi tiết Email

Lấy nội dung chi tiết của một email cụ thể (bao gồm HTML và Plain text).

Code Sample

curl
curl -X GET "https://ezminbox.com/api/messages/[id]" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Example

json
{
  "id": "msg_xyz789",
  "subject": "Your login code: 678902",
  "bodyHtml": "<html>...</html>",
  "bodyText": "Hi user, your login code is 678902...",
  "otpCode": "678902"
}
DELETE/api/messages/[id]

Xóa Email

Xóa một email khỏi danh sách.

Code Sample

curl
curl -X DELETE "https://ezminbox.com/api/messages/[id]" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Example

json
{
  "success": true
}
domain API
GET/api/domains

Danh sách Domain Hệ thống

Lấy danh sách các tên miền có sẵn để tạo email.

Code Sample

curl
curl -X GET "https://ezminbox.com/api/domains" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Example

json
[
  {
    "id": "dom_1",
    "domain": "ezminbox.com"
  },
  {
    "id": "dom_2",
    "domain": "tempmail.io"
  }
]
GET/api/domains/user

Tên miền riêng (PRO)

Liệt kê các tên miền riêng mà bạn đã thêm vào hệ thống.

Code Sample

curl
curl -X GET "https://ezminbox.com/api/domains/user" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Example

json
[
  {
    "id": "udom_1",
    "domain": "my-custom-work.com",
    "status": "ACTIVE"
  }
]
POST/api/domains/user

Thêm Tên miền riêng

Thêm một tên miền mới để bắt đầu quá trình xác thực DNS.

Parameters

NameTypeRequiredDescription
domainstringYesTên miền bạn sở hữu

Code Sample

curl
curl -X POST "https://ezminbox.com/api/domains/user" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "domain": "company.com"
}'

Response Example

json
{
  "id": "udom_2",
  "verificationToken": "token_123...",
  "status": "PENDING"
}
setting API
POST/api/user/apiKey

Làm mới API Key

Tạo một API Key mới (Key cũ sẽ bị vô hiệu hóa ngay lập tức).

Code Sample

curl
curl -X POST "https://ezminbox.com/api/user/apiKey" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response Example

json
{
  "apiKey": "ez_new_key_..."
}
POST/api/user/webhook

Cập nhật Webhook

Cấu hình URL để nhận thông báo email thời gian thực.

Parameters

NameTypeRequiredDescription
webhookUrlstringYesURL bắt đầu bằng https://

Code Sample

curl
curl -X POST "https://ezminbox.com/api/user/webhook" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "webhookUrl": "https://my-app.com/api/webhook"
}'

Response Example

json
{
  "success": true,
  "webhookUrl": "https://my-app.com/api/webhook"
}

Webhooks (PRO)

Webhooks cho phép nhận thông báo theo thời gian thực mỗi khi có email mới gửi tới địa chỉ của bạn. Đây là cách tối ưu nhất để xây dựng automation mà không cần liên tục gửi request polling.

Cấu trúc Payload (POST JSON)

json
{
  "event": "message.received",
  "data": {
    "id": "msg_550e8400",
    "from": "security@google.com",
    "subject": "Your verification code: 998822",
    "otp": "998822",
    "bodyText": "Hello, your code is 998822...",
    "receivedAt": "2024-03-11T12:00:00Z"
  }
}

Extract OTP

Auto-Detect

EZMinBOX tự động nhận diện và trích xuất mã OTP từ email đến. Mã OTP được trả về trong trường otpCode của mọi API response — bạn không cần parse email thủ công.

Định dạng hỗ trợ

  • Mã 4-8 chữ số (vd: 1234, 667890)
  • Mã bao gồm chữ và số (Alpha-numeric)
  • Nhận diện từ Subject hoặc Body
  • Hỗ trợ đa ngôn ngữ (EN, VI, ...)

Lợi ích

  • Không cần parse HTML/text thủ công
  • Giảm tải xử lý cho Client
  • Tăng tốc độ automation workflow
  • Hiển thị trực tiếp trên Dashboard

Extract OTP Workflow

1

Tạo hộp thư tạm

POST /api/accounts → Nhận email address + token

2

Sử dụng email để đăng ký dịch vụ

Dùng email vừa tạo để nhận mã xác thực OTP từ bất kỳ dịch vụ nào

3

Polling danh sách email

GET /api/messages → Kiểm tra email mới, field otpCode sẽ chứa mã OTP

4

Lấy OTP từ response

Đọc otpCode trực tiếp — không cần regex hay parse HTML!

cURL — Lấy chi tiết email + OTP

bash
curl https://ezminbox.com/api/messages/msg_xyz789 \
  -H "Authorization: Bearer ez_live_aBcDeFgH..."

# Response:
# {
#   "id": "msg_xyz789",
#   "accountId": "acc_556677",
#   "from_name": "Facebook",
#   "from_address": "security@facebookmail.com",
#   "to_address": "user@checkmap.store",
#   "subject": "Your login code: 482910",
#   "bodyHtml": "<p>Your verification code is <b>482910</b></p>",
#   "bodyText": "Your verification code is 482910",
#   "otpCode": "482910",
#   "hasAttachments": false,
#   "createdAt": "2026-03-12T01:00:00.000Z"
# }

Node.js — Auto-polling OTP

javascript
const API_URL = "https://ezminbox.com";
const API_KEY = "ez_live_aBcDeFgH...";

async function waitForOTP(maxAttempts = 30, interval = 2000) {
  for (let i = 0; i < maxAttempts; i++) {
    const res = await fetch(`${API_URL}/api/messages`, {
      headers: { "Authorization": `Bearer ${API_KEY}` }
    });
    const messages = await res.json();
    
    // Tìm message có OTP
    const otpMessage = messages.find(msg => msg.otpCode);
    if (otpMessage) {
      console.log("✅ OTP found:", otpMessage.otpCode);
      return otpMessage.otpCode;
    }
    
    console.log(`⏳ Attempt ${i + 1}/${maxAttempts} - waiting...`);
    await new Promise(r => setTimeout(r, interval));
  }
  throw new Error("Timeout: No OTP received");
}

// Usage
const otp = await waitForOTP();
console.log("Mã OTP:", otp); // "482910"

Python — Extract OTP

python
import requests, time

API_URL = "https://ezminbox.com"
API_KEY = "ez_live_aBcDeFgH..."
headers = {"Authorization": f"Bearer {API_KEY}"}

def wait_for_otp(max_attempts=30, interval=2):
    for i in range(max_attempts):
        res = requests.get(f"{API_URL}/api/messages", headers=headers)
        messages = res.json()
        
        for msg in messages:
            if msg.get("otpCode"):
                print(f"✅ OTP found: {msg['otpCode']}")
                return msg["otpCode"]
        
        print(f"⏳ Attempt {i+1}/{max_attempts} - waiting...")
        time.sleep(interval)
    
    raise TimeoutError("No OTP received")

# Usage
otp = wait_for_otp()
print(f"Mã OTP: {otp}")  # "482910"
Pro tip: Kết hợp với Webhooks thay vì polling để nhận OTP ngay lập tức khi có email mới. Field otp cũng được gửi trong Webhook payload.

Mã lỗi & Giới hạn

HTTP Status Codes

200
OK
Yêu cầu thành công
401
Unauthorized
API Key không hợp lệ hoặc thiếu
403
Forbidden
Gói tài khoản không được cấp quyền
404
Not Found
Tài nguyên không tồn tại
429
Rate Limit
Vượt quá số lượng yêu cầu cho phép

Giới hạn tốc độ

Hệ thống áp dụng giới hạn 100 request/phút cho mỗi API Key. Nếu vượt quá giới hạn, hệ thống sẽ trả về lỗi HTTP 429.

PRO Member120 req/min
Free UserNo API Access