REST API Documentation
Tích hợp dịch vụ TempMail & Custom Domain vào ứng dụng của bạn bằng REST API.
🔑 Demo API Key:
🌐 Base URL:
tmp_demo_key_1234567890abcdef🌐 Base URL:
https://www.subhoatoc.biz/api/v1/
GET /api/v1/domains.php
Lấy danh sách các tên miền có sẵn trong hệ thống (bao gồm Custom Domain đã xác minh).
curl -X GET "https://www.subhoatoc.biz/api/v1/domains.php"
POST /api/v1/domains.php
Đăng ký tên miền tùy chỉnh (Custom Domain) mới và lấy thông tin xác minh DNS.
curl -X POST "https://www.subhoatoc.biz/api/v1/domains.php" \
-H "Content-Type: application/json" \
-d '{"action": "add", "domain_name": "domaincuaban.com"}'
POST /api/v1/inbox.php
Tạo hòm thư tạm thời mới (tùy chọn tên hoặc ngẫu nhiên với domain chỉ định).
curl -X POST "https://www.subhoatoc.biz/api/v1/inbox.php" \
-H "Content-Type: application/json" \
-d '{"name": "mytestuser", "domain": "tempmail.local"}'
GET /api/v1/inbox.php?email={email}
Lấy danh sách tất cả các tin nhắn gửi tới địa chỉ hòm thư.
curl -X GET "https://www.subhoatoc.biz/api/v1/inbox.php?email=mytestuser@tempmail.local"
GET /api/v1/message.php?id={message_id}
Xem chi tiết nội dung HTML/Text của một tin nhắn cụ thể.
curl -X GET "https://www.subhoatoc.biz/api/v1/message.php?id=1"
POST /api/v1/incoming.php
Webhook đẩy email trực tiếp vào hòm thư hệ thống.
curl -X POST "https://www.subhoatoc.biz/api/v1/incoming.php" \
-H "Content-Type: application/json" \
-d '{
"to": "mytestuser@tempmail.local",
"from": "Sender <sender@example.com>",
"subject": "Chào mừng bạn!",
"body_html": "<h1>Xin chào!</h1><p>Đây là email thử nghiệm API.</p>"
}'
Python Integration Example
import requests
BASE_URL = "https://www.subhoatoc.biz/api/v1"
# 1. Tạo hòm thư tạm mới
res = requests.post(f"{BASE_URL}/inbox.php", json={"name": "python_user"})
inbox_data = res.json()
email = inbox_data['inbox']['email']
print("Email của bạn là:", email)
# 2. Lấy danh sách tin nhắn
msgs = requests.get(f"{BASE_URL}/inbox.php", params={"email": email}).json()
print("Số tin nhắn:", msgs['message_count'])