API 概述
基础信息
邮箱提取工具提供了一套完整的 RESTful API,用于查询和获取邮箱账号。 所有 API 请求都是基于 HTTP 协议,并使用 JSON 格式进行数据交换。
基础 URL
https://your-domain.com/api
响应格式
所有 API 响应都遵循以下格式:
{
"success": true,
"data": {},
"error": null
}
⚠️ 注意: 所有 API 调用都应该在服务端进行,不要在客户端中暴露敏感信息(如 API Key)。
获取库存信息
GET
/api/inventory
描述
获取当前邮箱的库存数量,包括 Outlook 和 Hotmail 邮箱数量。
请求
无需任何参数。
curl -X GET https://your-domain.com/api/inventory
响应
✓ 成功响应 (200)
{
"success": true,
"data": {
"hotmail": 24205,
"outlook": 6581
}
}
| 字段 | 类型 | 说明 |
|---|---|---|
| hotmail | number | Hotmail 邮箱库存数量 |
| outlook | number | Outlook 邮箱库存数量 |
✗ 错误响应 (500)
{
"success": false,
"error": "查询库存失败:网络错误"
}
查询余额
POST
/api/balance
描述
查询指定 API Key 账户的余额。
请求参数
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| card | string | 必填 | 您的 API Key |
请求示例
curl -X POST https://your-domain.com/api/balance \
-H "Content-Type: application/json" \
-d '{"card": "your_api_key"}'
响应
✓ 成功响应 (200)
{
"success": true,
"data": {
"num": 203
}
}
| 字段 | 类型 | 说明 |
|---|---|---|
| num | number | 账户余额 |
✗ 错误响应
// card 参数为空
{
"success": false,
"error": "card 参数不能为空"
}
// 网络或其他错误
{
"success": false,
"error": "查询余额接口失败:网络错误"
}
提取邮箱
POST
/api/extract
描述
提取指定类型和数量的邮箱账号。
请求参数
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| card | string | 必填 | 您的 API Key |
| shuliang | number | 必填 | 提取数量,范围: 1-2000 |
| leixing | string | 必填 | 邮箱类型,可选值: "outlook" 或 "hotmail" |
请求示例
curl -X POST https://your-domain.com/api/extract \
-H "Content-Type: application/json" \
-d '{
"card": "your_api_key",
"shuliang": 10,
"leixing": "outlook"
}'
响应
✓ 成功响应 (200)
{
"success": true,
"data": [
{
"email": "user1@outlook.com",
"password": "password123"
},
{
"email": "user2@outlook.com",
"password": "password456"
}
]
}
✗ 错误响应
// card 参数为空
{
"success": false,
"error": "card 参数不能为空"
}
// shuliang 参数超出范围
{
"success": false,
"error": "shuliang 参数必须在 1-2000 之间"
}
// leixing 参数无效
{
"success": false,
"error": "leixing 参数只能是 outlook 或 hotmail"
}
// 余额不足
{
"success": false,
"error": "余额不足,请充值"
}
// 卡密不存在
{
"status": -1,
"msg": "卡密不存在!!!"
}
// 库存不足(接口也可能返回 status/msg 格式)
{
"status": -1,
"msg": "库存不足!"
}
使用示例
JavaScript 示例
// 查询库存
async function getInventory() {
const response = await fetch('/api/inventory');
const result = await response.json();
if (result.success) {
console.log('Outlook:', result.data.outlook);
console.log('Hotmail:', result.data.hotmail);
}
}
// 查询余额
async function checkBalance(apiKey) {
const response = await fetch('/api/balance', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ card: apiKey })
});
const result = await response.json();
if (result.success) {
console.log('余额:', result.data.num);
}
}
// 提取邮箱
async function extractEmails(apiKey, quantity, type) {
const response = await fetch('/api/extract', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
card: apiKey,
shuliang: quantity,
leixing: type
})
});
const result = await response.json();
const isSuccess =
typeof result.success === 'boolean' ? result.success : result.status === 1;
if (isSuccess) {
console.log('提取成功:', result.data);
} else {
console.error('错误:', result.error || result.msg);
}
}
// 注意:某些时候接口会直接返回纯文本,每行类似:
// "user@x.com----pass----token"
// 前端上的 parse 逻辑会取第一个/第二个字段作为邮箱和密码。
Node.js / Python 示例
// Node.js (使用 axios)
const axios = require('axios');
const api = axios.create({
baseURL: 'https://your-domain.com'
});
async function extractEmails() {
try {
const response = await api.post('/api/extract', {
card: 'your_api_key',
shuliang: 100,
leixing: 'outlook'
});
console.log(response.data.data);
} catch (error) {
console.error(error.response.data);
}
}
错误处理最佳实践
async function safeApiCall(apiCall) {
try {
const response = await fetch(apiCall);
const data = await response.json();
if (!data.success) {
console.error('API 错误:', data.error);
return null;
}
return data.data;
} catch (error) {
console.error('网络错误:', error);
return null;
}
}
💡 建议:
- 始终在服务端进行 API 调用,不要在客户端暴露 API Key
- 实现请求重试机制,以处理临时网络问题
- 监控 API 响应时间和错误率
- 定期检查账户余额,避免提取失败
常见问题
Q: 如何获取 API Key?
A: 请联系管理员或访问账户设置页面获取您的 API Key。请妥善保管您的 API Key,不要公开分享。
Q: API 有速率限制吗?
A: 当前版本没有对单个 API Key 设置速率限制,但建议合理使用以避免对服务器造成压力。
Q: 提取的邮箱账号是否可以重复使用?
A: 不建议重复使用同一账号。每次提取都会消耗相应的余额。
Q: 如何处理 API 超时?
A: 建议设置合理的超时时间(建议 30 秒),并实现重试机制。某些大量提取操作可能需要较长时间。