GPTMail API
使用 GPTMail API,可以透過 HTTPS 和 X-API-Key 請求標頭產生臨時信箱、列出和讀取郵件以及刪除郵件,適用於自動化測試、CI/CD 管線和 QA 工作流程。
如何取得 API Key
方式二:新增自有網域
公開網域通過 MX 驗證後:未登入時送出,贈送 API Key(20000 次請求);登入後送出,贈送 200 積分。每個網域只能領取一種獎勵。 重要:網域串接完成後,該網域後綴會成為本站所有使用者皆可使用的公開後綴,其他使用者也能在其下產生信箱地址。啟用後,請勿刪除、更換或修改將此網域指向本服務的 MX 記錄,否則後續檢查可能會將網域判定為設定錯誤。若之後的檢查發現 MX 記錄無效,網域將被停用。若 MX 記錄連續 3 次檢查皆無效,相關 API Key 也會一併停用。若之後 MX 記錄恢復有效,網域會自動重新啟用。
公開測試 Key
測試時可在 X-API-Key 請求標頭中使用下方顯示的公開 Key。它每天更換,所有使用者共用每日 20 萬 次的請求額度。
今日剩餘
距離重設
正在載入公開 Key 的即時額度…
下列 API 參考可複製為 Markdown,供 AI 工具、知識庫或 README 使用。
基礎網址: https://mail.chatgpt.org.uk
快速入門
X-API-Key: YOUR_KEY是最簡單的方式;快速測試時,可用上方顯示的每日公開 Key 取代YOUR_KEY。多數信箱端點需要
email參數,例如?email=demo@example.com。GPTMail API 回應採用 JSON,包含
success、data、error欄位,使用 API Key 時另附usage。Cloudflare 錯誤(包括速率限制回應)可能回傳 HTML,請先檢查 HTTP 狀態碼和 Content-Type,再解析 JSON。若你已知道本站目前支援的網域,就不必先呼叫產生信箱的端點。可在本機組出
prefix@domain後直接呼叫信箱 API,省下一次 API 請求。
速率限制與重試
GET 和 POST /api/generate-email 共用依來源 IP 計算的速率限制:每 10 秒最多 30 次請求。公開 API Key 與個人 API Key 皆適用;同一 IP 下的不同 Key 與用戶端會共用此限制。
超過此限制會回傳 HTTP 429,並在 10 秒內封鎖產生信箱的請求。請依 Retry-After 指定的時間等待後再重試;若回應中沒有此標頭,請至少等待 10 秒,之後再以逐步拉長的間隔重試。共用同一 IP 的用戶端應避免同時重試。
此規則不適用於收件匣清單與單封郵件讀取。API Key 的每日額度與總額度仍各自獨立計算;Key 額度用盡時,等待 10 秒並不會恢復額度。
核心端點
/api/generate-email產生臨時收件匣。最簡單的隨機流程請用 GET;若要明確指定 prefix 與 domain,請用 POST。
/api/emails?email=...取得某個信箱的郵件。
/api/email/{id}?email=...取得單封郵件,含純文字、HTML、原始標頭與中繼資料。
/api/email/{id}?email=...依 ID 刪除單封郵件。
/api/emails/clear?email=...刪除信箱內所有郵件。
/api/stats讀取全站統計資料。
範例流程
常見做法有兩種:讓服務幫你產生收件匣,或指定固定前綴。若你已知道目前支援的網域,也可以在本機組出信箱地址後直接查詢。
1) 產生隨機臨時電子郵件地址
curl 'https://mail.chatgpt.org.uk/api/generate-email' \
-H 'X-API-Key: PUBLIC_API_KEY'回應範例
{
"success": true,
"data": {
"email": "a3f9c2b1@example.com"
},
"usage": {
"daily_limit": 200000,
"used_today": 1,
"remaining_today": 199999,
"total_limit": 200000,
"total_usage": 1,
"remaining_total": 199999
}
}2) 以固定前綴產生(例如 demo@example.com)
curl -X POST 'https://mail.chatgpt.org.uk/api/generate-email' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: PUBLIC_API_KEY' \
-d '{"prefix":"demo"}'回應範例
{
"success": true,
"data": {
"email": "demo@example.com"
},
"usage": {
"daily_limit": 200000,
"used_today": 2,
"remaining_today": 199998
}
}3) 列出收件匣內郵件
若已知支援的網域,可略過步驟 1 直接查詢。
curl 'https://mail.chatgpt.org.uk/api/emails?email=demo@example.com' \
-H 'X-API-Key: PUBLIC_API_KEY'回應範例
{
"success": true,
"data": {
"emails": [
{
"id": "e5a7f3...",
"email_address": "demo@example.com",
"from_address": "noreply@github.com",
"subject": "Your code: 654321",
"content": "Your verification code is 654321",
"html_content": "...",
"has_html": true,
"timestamp": 1709654321,
"created_at": "2024-03-05T12:18:41Z"
}
],
"count": 1
}
}4) 讀取單封郵件 — 含純文字、HTML 本文與中繼資料
請將 EMAIL_ID 換成步驟 3 回傳的 id,並以 email 參數帶入該信箱地址(刪除郵件、下載附件時亦同):伺服器會直接從該信箱讀取郵件,不必依 id 搜尋。 使用 API Key 時可省略 email 參數,但帶入此參數可加快查詢速度。
curl 'https://mail.chatgpt.org.uk/api/email/EMAIL_ID?email=demo@example.com' \
-H 'X-API-Key: PUBLIC_API_KEY'回應範例
{
"success": true,
"data": {
"id": "e5a7f3...",
"email_address": "demo@example.com",
"from_address": "noreply@github.com",
"subject": "Your code: 654321",
"content": "Your verification code is 654321",
"html_content": "<p>Your code is 654321</p>",
"has_html": true,
"timestamp": 1709654321,
"raw_size": 2048,
"created_at": "2024-03-05T12:18:41Z"
}
}5) 依 ID 刪除單封郵件
使用 API Key 時可省略 email 參數,但帶入此參數可加快查詢速度。
curl -X DELETE 'https://mail.chatgpt.org.uk/api/email/EMAIL_ID?email=demo@example.com' \
-H 'X-API-Key: PUBLIC_API_KEY'回應範例
{
"success": true,
"data": {
"message": "Email deleted"
}
}6) 清空整個收件匣 — 刪除此地址的全部郵件
每次呼叫刪除一批郵件。只要回應中 "has_more" 為 true,就再次呼叫,直到它回傳 false。
curl -X DELETE 'https://mail.chatgpt.org.uk/api/emails/clear?email=demo@example.com' \
-H 'X-API-Key: PUBLIC_API_KEY'回應範例
{
"success": true,
"data": {
"message": "Deleted 3 emails",
"count": 3,
"has_more": false
}
}回應結構
成功回應通常如下。若以 API Key 驗證,請留意 usage 內的額度資訊。
{
"success": true,
"data": {
"email": "demo@example.com"
},
"usage": {
"daily_limit": 200000,
"used_today": 1,
"remaining_today": 199999,
"total_limit": 200000,
"total_usage": 1,
"remaining_total": 199999
}
}延伸統計
/api/statistics/24h回傳一個 24 小時的每小時分布視窗;可用 offset=1、2、... 查看更早視窗。/api/statistics/top-subjects回傳最常見的郵件主旨。/api/statistics/top-domains回傳最活躍的網域。/api/statistics/top-senders回傳最活躍的寄件者。