批量请求概览
处理最多50个邮箱地址
发送一个data数组。GenderAPI 从每个地址中提取一个可能的姓名并返回匹配的预测;您的可选id使数据库关联确定性。
MethodPOST
Maximum50 个邮箱
AuthenticationBearer Token
结果格式names[]
50 个邮箱 max→姓名提取→支持国家识别的结果
HDR
所需的HTTP头信息
授权批量请求
Content-Typeapplication/jsonAuthorizationBearer YOUR_API_KEYJSON请求体
参数
| Field | Type | Requirement | Description |
|---|---|---|---|
data | object[] | 必填 | 包含1到50个邮件记录的数组。 |
data[].email | string | 必填 | GenderAPI提取可能的姓氏的邮箱地址。 |
data[].country | string | 可选 | 作为区域上下文使用的ISO 3166-1 alpha-2国家代码。 |
data[].id | string | integer | 可选 | 您的记录标识符,与对应结果一起原样返回。 |
记录匹配
使用唯一id每个项目,GenderAPI 都会返回该项目的结果,使您可以更新正确的数据库记录,而无需仅依赖数组位置。
请求数据体
构建电子邮件数组
JSON
{
"data": [
{ "email": "andrea.schmidt@example.com", "country": "DE", "id": "123" },
{ "email": "andrea.rossi@example.it", "country": "IT", "id": "456" },
{ "email": "james.brown@example.com", "country": "US", "id": "789" }
]
}代码示例
发送多邮箱请求
cURL
curl -X POST "https://api.genderapi.io/api/email/multi/country" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"data":[{"email":"andrea.schmidt@example.com","country":"DE","id":"123"},{"email":"james.brown@example.com","country":"US","id":"789"}]}'JavaScript
const data = [
{ email: "andrea.schmidt@example.com", country: "DE", id: "123" },
{ email: "james.brown@example.com", country: "US", id: "789" }
];
const response = await fetch("https://api.genderapi.io/api/email/multi/country", {
method: "POST", headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_KEY" },
body: JSON.stringify({ data })
});200 响应
提取的姓名和预测结果
JSON
{
"status": true, "used_credits": 3, "remaining_credits": 7265,
"expires": 1717069765,
"names": [
{ "name": "Andrea", "q": "andrea.schmidt@example.com", "gender": "female", "country": "DE", "total_names": 644, "probability": 88, "id": "123" },
{ "name": "James", "q": "james.brown@example.com", "gender": "male", "country": "US", "total_names": 45274, "probability": 100, "id": "789" }
], "duration": "5ms"
}响应字段
| Field | Type | Description |
|---|---|---|
status | boolean | 批量请求是否成功完成。 |
used_credits | integer | 所有提交邮件中消耗的信用额度。 |
remaining_credits | integer | 请求后剩余的信用额度。 |
expires | integer | 套餐过期时间,以UNIX时间戳表示。 |
names | object[] | 提交邮件的有序结果集合。 |
names[].name | string | 从邮箱地址中提取的姓名。 |
names[].q | string | 请求中原始提交的邮箱。 |
names[].gender | string | null | 预测值:男、女或空值。 |
names[].country | string | 该结果所考虑的国家代码。 |
names[].total_names | integer | 支持该结果的样本数量。 |
names[].probability | integer | 预测置信度,以百分比表示。 |
names[].id | string | integer | 用于记录关联的输入标识符。 |
duration | string | 服务器处理总时间。 |
每个请求的记录数不得超过50条
验证每个地址,并将较大的数据集拆分为不超过50条的批次。在应用结果前检查提取的name and probability内容
下一步指南