REST · JSON HTTP Basic
每次请求带 HTTP Basic:用户名是你的完整邮箱地址,密码是创建邮箱时显示的那串密码(在「我的邮箱」里可以重置)。没有密码的邮箱无法调用接口。
# curl 自动处理编码 curl -u "xxxxxx@cheatshop.asia:你的邮箱密码" \ https://cheatshop.asia/api/me
查询当前邮箱的信息和收信总数。
{
"address": "xxxxxx@cheatshop.asia",
"created_at": 1793183599886,
"message_count": 0
}
邮件列表,按时间倒序。limit 默认 20、最大 100;offset 用于翻页。
{
"total": 42,
"limit": 20,
"offset": 0,
"messages": [
{
"id": "4e8cd2ba-0c11-4836-90b4-904abed38bee",
"from": "someone <someone@example.com>",
"subject": "验证码",
"received_at": 1793183599886,
"is_read": false,
"attachments": 1
}
]
}
单封邮件的完整内容,含纯文本、HTML 和附件清单。
{
"id": "4e8cd2ba-...",
"to": "xxxxxx@cheatshop.asia",
"from": "someone <someone@example.com>",
"subject": "验证码",
"received_at": 1793183599886,
"size": 6451,
"text": "你的验证码是 123456",
"html": "<p>你的验证码是 <b>123456</b></p>",
"attachments": [
{
"index": 0,
"filename": "analytics.settings",
"mime": "application/octet-stream",
"size": 127,
"url": "/api/messages/4e8cd2ba-.../attachments/0"
}
]
}
下载附件,返回原始二进制,响应头带 Content-Disposition 和原文件名。
curl -u "xxxxxx@cheatshop.asia:你的邮箱密码" \ -OJ "https://cheatshop.asia/api/messages/4e8cd2ba-.../attachments/0"
公开接口,不需要认证,用来探活。
{ "ok": true, "service": "cf-mail" }
| 状态码 | 含义 | 处理 |
|---|---|---|
| 200 | 成功 | — |
| 401 | 未认证 / 密码错误 / 邮箱未设密码 | 检查 Basic 头 |
| 404 | 邮件或附件不存在,或不属于这个邮箱 | 确认 id 与归属 |
| 500 | 服务端异常 | 稍后重试 |
· 接口只返回你自己名下邮箱的邮件,越权访问会返回 404。
· 所有响应带 Access-Control-Allow-Origin: *,浏览器里可直接 fetch。
· 邮箱密码在创建或重置时明文显示一次,忘记就在「我的邮箱」点「重置密码」。