API 文档
两个接口就能集成临时邮箱:一个生成地址,一个轮询取信。
免费无需密钥不限流
Base URL:
https://tempmail.beer · 所有响应均为 JSON,UTF-8 编码。收信端由内置 SMTP 直接接收,无需第三方中转。1. 创建临时邮箱
POST /papi/inbox/new
生成一个新的临时邮箱地址,返回地址和用于取信的 token。请求体可选:
| 字段 | 类型 | 说明 |
|---|---|---|
domain | string | 可选。指定域名(须在可用域名列表内);不传则从共享域名池随机分配。 |
name | string | 可选。自定义 @ 前面的前缀;不传则随机。 |
# 生成一个随机临时邮箱 curl -X POST https://tempmail.beer/papi/inbox/new \ -H 'Content-Type: application/json' -d '{}' # 响应 { "address": "a1b2c3d4e@g7g7.net", "token": "c9ce9d4793234ea78c6bf97c87003434", "expires_at": "2026-08-16T18:00:00Z" }
2. 读取收件箱
GET /papi/inbox?token=<token>
用上一步拿到的 token 查询该邮箱收到的所有邮件(数组,最新在后)。
curl "https://tempmail.beer/papi/inbox?token=c9ce9d47...003434" # 响应(每封邮件) [ { "id": 5, "from": "noreply@example.com", "to": "a1b2c3d4e@g7g7.net", "subject": "Your code is 246810", "text_body": "your verification code is 246810", "html_body": "", "received_at": "2026-08-16T10:20:30Z" } ]
完整示例:等验证码
生成地址 → 拿去注册 → 每 2 秒轮询直到邮件到达 → 取出验证码。
ADDR_JSON=$(curl -s -X POST https://tempmail.beer/papi/inbox/new -d '{}') TOKEN=$(echo "$ADDR_JSON" | jq -r .token) ADDR=$(echo "$ADDR_JSON" | jq -r .address) # ... 把 $ADDR 填到目标网站注册 ... for i in $(seq 1 30); do CODE=$(curl -s "https://tempmail.beer/papi/inbox?token=$TOKEN" \ | grep -oE '[0-9]{4,8}' | head -1) [ -n "$CODE" ] && echo "验证码: $CODE" && break sleep 2 done
Python 示例
import requests, time, re B = "https://tempmail.beer" r = requests.post(f"{B}/papi/inbox/new", json={}).json() addr, token = r["address"], r["token"] print("邮箱:", addr) for _ in range(30): msgs = requests.get(f"{B}/papi/inbox", params={"token": token}).json() if msgs: body = msgs[-1].get("text_body","") + msgs[-1].get("subject","") m = re.search(r"\b\d{4,8}\b", body) if m: print("验证码:", m.group()); break time.sleep(2)
可用域名
调 GET /papi/me 可拿到当前所有共享域名列表(字段 shared)。想让临时地址落在你自己的域名下,登录账号后在首页点「自定义域」绑定并验证你的域名(一条 TXT + 一条 MX)。
提示:这套接口设计与常见临时邮箱一致,从其它服务迁移过来通常只需改 Base URL。