Tài liệu API

Tích hợp địa chỉ email dùng một lần vào ứng dụng và quy trình làm việc của bạn

https://dustmail.net/api/v1

🔑 Xác thực

Mọi yêu cầu API đều cần khóa API. Gửi khóa của bạn qua tiêu đề Authorization hoặc tiêu đề X-API-Key .

Tạo khóa API trong Bảng điều khiển. Mỗi khóa bắt đầu bằng dm_live_.

bash
# Using Authorization header (recommended)
curl https://dustmail.net/api/v1/inbox \
  -H "Authorization: Bearer dm_live_your_api_key"

# Using X-API-Key header
curl https://dustmail.net/api/v1/inbox \
  -H "X-API-Key: dm_live_your_api_key"

Giới hạn tốc độ

Miễn phí
100
yêu cầu / ngày
Premium
không giới hạn
POST/api/v1/inbox

Tạo một hộp thư email tạm thời mới. Trả về thông tin hộp thư, gồm địa chỉ email được tạo và thời gian hết hạn. Khóa Premium cũng có thể yêu cầu tên người dùng tùy chỉnh, chọn trong các miền dùng chung đã cấu hình hoặc chọn miền tùy chỉnh đã xác minh do người dùng Premium sở hữu sau khi xác minh DNS TXT + MX.

Nội dung yêu cầu

Tham sốKiểuMô tả
usernametùy chọnstringTên người dùng tùy chỉnh cho địa chỉ email. Yêu cầu khóa API Premium.
domaintùy chọnstringMiền hộp thư được yêu cầu. Khóa miễn phí dùng miền dùng chung chính, còn khóa Premium có thể chọn miền dùng chung đã cấu hình hoặc miền tùy chỉnh đã xác minh thuộc chủ sở hữu khóa API.

Ví dụ

bash
curl -X POST https://dustmail.net/api/v1/inbox \
  -H "Authorization: Bearer dm_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"username":"swift.fox4291","domain":"brand.example"}'

Phản hồi

json
{
  "success": true,
  "data": {
    "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "email": "[email protected]",
    "domain": "brand.example",
    "created_at": "2026-03-30T12:00:00.000Z",
    "expires_at": "2027-03-30T12:00:00.000Z"
  },
  "meta": {
    "plan": "premium",
    "rate_limit": { "limit": null, "used": 1 },
    "available_domains": ["dustmail.net", "<configured-shared-domain>", "brand.example"]
  }
}
GET/api/v1/inbox

Liệt kê mọi hộp thư đang hoạt động gắn với tài khoản của bạn. Trả về tối đa 50 hộp thư kèm số lượng email.

Ví dụ

bash
curl https://dustmail.net/api/v1/inbox \
  -H "Authorization: Bearer dm_live_your_api_key"

Phản hồi

json
{
  "success": true,
  "data": [
    {
      "id": "a1b2c3d4-...",
      "email": "[email protected]",
      "domain": "dustmail.net",
      "created_at": "2026-03-30T12:00:00.000Z",
      "expires_at": "2026-03-30T12:30:00.000Z",
      "email_count": 3
    }
  ],
  "meta": {
    "total": 1,
    "plan": "free",
    "rate_limit": { "limit": 100, "used": 2 }
  }
}
GET/api/v1/inbox/:id

Lấy thông tin hộp thư và tất cả email đã nhận. Trả về tối đa 100 email mới nhất với nội dung đầy đủ (văn bản và HTML).

Tham số đường dẫn

Tham sốKiểuMô tả
idbắt buộcuuidID hộp thư được trả về khi tạo

Ví dụ

bash
curl https://dustmail.net/api/v1/inbox/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
  -H "Authorization: Bearer dm_live_your_api_key"

Phản hồi

json
{
  "success": true,
  "data": {
    "inbox": {
      "id": "a1b2c3d4-...",
      "email": "[email protected]",
      "domain": "dustmail.net",
      "created_at": "2026-03-30T12:00:00.000Z",
      "expires_at": "2026-03-30T12:30:00.000Z"
    },
    "emails": [
      {
        "id": "e1f2a3b4-...",
        "from": "[email protected]",
        "subject": "Verify your email address",
        "text": "Click the link below to verify...",
        "html": "<html>...</html>",
        "received_at": "2026-03-30T12:05:30.000Z"
      }
    ]
  },
  "meta": {
    "email_count": 1,
    "rate_limit": { "limit": 100, "used": 3 }
  }
}

Ví dụ mã

javascript
// Node.js / JavaScript
const response = await fetch(
  'https://dustmail.net/api/v1/inbox/YOUR_INBOX_ID',
  { headers: { 'Authorization': 'Bearer dm_live_your_api_key' } }
);
const { data } = await response.json();
console.log(data.emails); // Array of received emails
python
# Python
import requests

resp = requests.get(
    "https://dustmail.net/api/v1/inbox/YOUR_INBOX_ID",
    headers={"Authorization": "Bearer dm_live_your_api_key"}
)
emails = resp.json()["data"]["emails"]
print(f"Received {len(emails)} emails")
DELETE/api/v1/inbox/:id

Xóa (vô hiệu hóa) một hộp thư. Bạn chỉ có thể xóa các hộp thư thuộc tài khoản của mình. Hộp thư sẽ không còn được API trả về sau khi xóa.

Ví dụ

bash
curl -X DELETE https://dustmail.net/api/v1/inbox/a1b2c3d4-... \
  -H "Authorization: Bearer dm_live_your_api_key"

Phản hồi

json
{
  "success": true,
  "message": "Inbox deleted"
}