邮箱服务 v3.0 开发者 API

专为 AI 终端及自动化脚本提供的调用接口参考,构建您的自托管邮局系统。

🔐 认证说明 (Authentication)

受保护的接口需要提供 API Key。您可以在 WebUI 控制面板的「API Key 管理」中生成用于 AI 调用的专属 Key。

Authorization: Bearer <Your_API_Key>
📥 邮箱管理与收件 (DuckMail 兼容)
方法接口路径认证参数说明与功能
POST /api/v1/accounts API Key 创建邮箱。Body: {style: "random|name|custom", length: 10, domain: "...", local: "...", note: "备注", group: "分组名"}
POST /api/v1/token API Key 获取邮箱 Token。Body: {address: "...", password: "..."}
GET /api/v1/messages?token=xxx API Key 获取邮件列表。使用邮箱创建时返回的 Token 鉴权。也可用 address=xxx 查询。
GET /api/v1/messages/{id} API Key 获取邮件详情。返回邮件 HTML 与文字内容。
GET /api/v1/extract-code/{email} API Key 智能提取验证码。针对特定邮箱地址获取最新邮件里的验证码。
GET /api/v1/domains API Key 获取可用收件域名列表
📤 发送邮件与系统管理
方法接口路径认证参数说明与功能
POST /api/send API Key 发送外域邮件。Body: {to: "...", subject: "...", html: true, body: "...", from: "..."}
GET /api/sent API Key 已发邮件记录。Query Params: limit=50
GET /api/emails API Key 查询服务器统揽全部邮件
POST /api/domains API Key 绑定新的托管域名。Body: {domain: "example.com"}
DELETE /api/domains/{domain} API Key 删除并解绑域名
GET /api/system API Key 获取系统资源占用状态数据 (CPU/RAM/Disk/Network)。
📬 邮箱账户管理 (新增)
方法接口路径认证参数说明与功能
GET /api/accounts API Key 列出所有邮箱账户。返回 address, token, note, group_name, pinned, mail_count 等字段。
DELETE /api/accounts/{address} API Key 删除邮箱账户。同时删除该地址的所有收件。
PATCH /api/accounts/{address} API Key 更新邮箱属性。Body: {note: "...", group: "...", pinned: true/false}
POST /api/admin/password API Key 修改管理密码。Body: {password: "new_password"}(最少4位)
GET /api/dns-check/{domain} API Key DNS 配置检测。检查指定域名的 MX/A/SPF 记录是否正确指向本服务器。
🚀 (新增) 高级控制面板 API
方法接口路径认证参数说明与功能
GET /api/keys API Key 获取所有已生成的 API Keys
POST /api/keys API Key 生成新的 API Key。Body: {description: "描述用途"}
DELETE /api/keys/{id} API Key 注销指定的 API Key
POST /api/backgrounds API Key 上传自定义壁纸。限制 5 个内容,需受 Multipart Form 处理,含体积控制。
GET /api/backgrounds API Key 获取现有壁纸库列表。返回带 URL 与类型的数组。