Về trang chủ
API Reference

REST API để tích hợp TempMail vào ứng dụng của bạn. Không cần xác thực — hoàn toàn miễn phí.

Base URL
Domains
GET /api/domains Lấy danh sách domain khả dụng
Response
JSON{
  "domains": ["hungsmoke.site", "example.com"]
}
Ví dụ
cURLcurl 
POST /api/domains/add Thêm domain mới (quét MX tự động)
Request Body
FieldTypeRequiredDescription
domain string required Domain muốn thêm, ví dụ yourdomain.com
Response — Thành công
JSON{
  "ok": true,
  "domain": "yourdomain.com",
  "mx": [{ "priority": 10, "exchange": "mail.yourserver.com" }],
  "warning": null
}
Response — MX chưa cấu hình (HTTP 422)
JSON{
  "error": "mx_not_found",
  "message": "Không tìm thấy MX record cho yourdomain.com",
  "guide": {
    "type":     "MX",
    "host":     "@",
    "value":    "1.2.3.4",
    "priority": 10,
    "ttl":      300
  }
}
Mailbox
POST /api/new Tạo địa chỉ email ngẫu nhiên
Response
JSON{
  "address":   "happyfox1234@hungsmoke.site",
  "expiresAt": 0,
  "ttl":       0
}
POST /api/custom Tạo địa chỉ email tuỳ chỉnh
Request Body
FieldTypeRequiredDescription
username string required 1-40 ký tự, chỉ dùng a-z 0-9 . _ -
domain string required Phải là domain có trong hệ thống
Response
JSON{
  "address":   "myname@hungsmoke.site",
  "expiresAt": 0,
  "ttl":       0
}
Thử ngay
@
GET /api/inbox/:address Đọc toàn bộ mail của một địa chỉ email
Path Params
ParamTypeDescription
addressstringĐịa chỉ email đầy đủ, ví dụ foo@hungsmoke.site
Response
JSON{
  "messages": [
    {
      "id":          "uuid-v4",
      "receivedAt": "2026-03-29T10:00:00.000Z",
      "from":        "sender@example.com",
      "to":          "foo@hungsmoke.site",
      "subject":     "Hello World",
      "text":        "Nội dung thuần văn bản",
      "html":        "<p>Nội dung HTML</p>",
      "attachments": []
    }
  ],
  "expiresAt": 0
}
Thử ngay
GET /api/mail/:address/:id Đọc nội dung một email theo ID
Path Params
ParamTypeDescription
addressstringĐịa chỉ email
idstringUUID của mail — lấy từ /api/inbox
Response
JSON{
  "id":          "uuid-v4",
  "receivedAt": "2026-03-29T10:00:00.000Z",
  "from":        "sender@example.com",
  "subject":     "Hello World",
  "text":        "...",
  "html":        "..."
}
Thử ngay
💡 Chạy /api/inbox trước để lấy id