📧 邮箱接码 API

简单易用的邮箱验证码获取接口

API 基础地址:http://localhost:3005/api/v1

🔄 完整使用流程

1 获取邮箱 - 调用 /get-email 获取一个可用的邮箱地址和JWT
2 获取验证码 - 使用JWT调用 /get-verification-code 获取验证码
3 标记已使用 - 调用 /mark-email-used 将邮箱标记为已使用

1. 获取可用邮箱

GET
/get-email

描述

随机获取一个未使用的邮箱地址和对应的JWT令牌

请求示例

curl -X GET "http://localhost:3005/api/v1/get-email"

响应示例

成功响应 (200)
{ "success": true, "data": { "address": "lliottchum@augment.jhun.edu.kg", "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "status": "未使用" }, "message": "获取邮箱成功" }
无可用邮箱 (404)
{ "success": false, "error": "No available emails", "message": "暂无可用邮箱" }

2. 获取验证码

POST
/get-verification-code

描述

使用邮箱的JWT令牌获取验证码

请求参数

{ "jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }

请求示例

curl -X POST "http://localhost:3005/api/v1/get-verification-code" \ -H "Content-Type: application/json" \ -d '{"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}'

响应示例

成功响应 (200)
{ "success": true, "data": { "codes": [ { "code": "130471", "subject": "Welcome to Augment Code", "source": "support@augmentcode.com", "created_at": "2025-08-25 07:45:12" } ], "total": 1, "raw_emails": [...] }, "message": "获取到 1 个验证码" }

3. 标记邮箱为已使用

POST
/mark-email-used

描述

将邮箱标记为已使用,避免重复分配

请求参数

{ "address": "lliottchum@augment.jhun.edu.kg" }

请求示例

curl -X POST "http://localhost:3005/api/v1/mark-email-used" \ -H "Content-Type: application/json" \ -d '{"address": "lliottchum@augment.jhun.edu.kg"}'

响应示例

成功响应 (200)
{ "success": true, "data": { "address": "lliottchum@augment.jhun.edu.kg", "status": "使用" }, "message": "邮箱已标记为已使用" }

4. 查询邮箱状态

GET
/email-status/{address}

描述

查询指定邮箱的使用状态

请求示例

curl -X GET "http://localhost:3005/api/v1/email-status/lliottchum@augment.jhun.edu.kg"

响应示例

成功响应 (200)
{ "success": true, "data": { "address": "lliottchum@augment.jhun.edu.kg", "status": "使用" }, "message": "获取邮箱状态成功" }

🚀 完整使用示例

# 1. 获取邮箱 response1=$(curl -s "http://localhost:3005/api/v1/get-email") address=$(echo $response1 | jq -r '.data.address') jwt=$(echo $response1 | jq -r '.data.jwt') # 2. 获取验证码 response2=$(curl -s -X POST "http://localhost:3005/api/v1/get-verification-code" \ -H "Content-Type: application/json" \ -d "{\"jwt\": \"$jwt\"}") code=$(echo $response2 | jq -r '.data.codes[0].code') # 3. 标记邮箱为已使用 curl -s -X POST "http://localhost:3005/api/v1/mark-email-used" \ -H "Content-Type: application/json" \ -d "{\"address\": \"$address\"}" echo "邮箱: $address" echo "验证码: $code"

📝 注意事项