批量请求概览
处理最多50个用户名
发送一个data数组。GenderAPI 会从每个用户名中提取潜在的名称信号,并返回带有您可选记录的结果id.
MethodPOST
Maximum50 个用户名
AuthenticationBearer 认证令牌
AI 选项不支持
批量用户名结果需要仔细审核。
用户名可能包含品牌、幻想词汇或无关词语。批量请求不接受askToAI or forceToGenderize. 为更可靠地处理异常输入,使用单次请求.
HDR
所需的HTTP头
授权批量请求
Content-Typeapplication/jsonAuthorizationBearer YOUR_API_KEYJSON请求体
参数
| Field | Type | Requirement | Description |
|---|---|---|---|
data | object[] | 必填 | 包含 1 到 50 个用户名记录的数组。 |
data[].username | string | 必填 | 要分析的用户名或账号;支持下划线和数字。 |
data[].country | string | 可选 | 作为区域上下文使用的 ISO 3166-1 alpha-2 国家代码。 |
data[].id | string | integer | 可选 | 您的标识符,将以原样形式返回对应结果。 |
输入指导
拉丁字符用户名通常能提供更清晰的名称信号。使用唯一值并在更新记录前进行评估。id提取的name and probability值
请求体
构建用户名数组
JSON
{
"data": [
{ "username": "anna_smith88", "country": "US", "id": "123" },
{ "username": "michael_bauer", "country": "DE", "id": "456" },
{ "username": "giulia_rossi", "country": "IT", "id": "789" }
]
}代码示例
发送多个用户名请求
cURL
curl -X POST "https://api.genderapi.io/api/username/multi/country" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"data":[{"username":"anna_smith88","country":"US","id":"123"},{"username":"michael_bauer","country":"DE","id":"456"}]}'JavaScript
const data = [
{ username: "anna_smith88", country: "US", id: "123" },
{ username: "michael_bauer", country: "DE", id: "456" }
];
const response = await fetch("https://api.genderapi.io/api/username/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": "Anna", "q": "anna_smith88", "gender": "female", "country": "US", "total_names": 1234, "probability": 92, "id": "123" },
{ "name": "Michael", "q": "michael_bauer", "gender": "male", "country": "DE", "total_names": 5678, "probability": 89, "id": "456" }
], "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条记录内
将较大的输入拆分为批次。用户名是间接信号,因此需验证提取的姓名,并建立可接受的概率阈值后再应用结果。
下一个参考