根据邮箱判断性别 · 单条请求

根据电子邮箱判断性别

从一个电子邮箱地址中提取最可能的名字,并返回结合国家/地区信息的性别预测。

POSThttps://api.genderapi.io/api/email

请求概览

从邮箱地址到性别预测

GenderAPI 分析邮箱地址中 @ 之前的部分,提取最可能的名字并据此预测性别。如果您知道用户所在地区,请提供国家/地区信息。

方法POST
内容类型application/json
身份验证Bearer token
额度消耗1 次查询
HDR

必需的 HTTP 请求头

为请求授权

Content-Typeapplication/json
AuthorizationBearer YOUR_API_KEY

JSON 请求体

参数

参数类型是否必填说明
emailstring必填需要分析的电子邮箱地址。GenderAPI 会先提取最可能的名字,再进行性别预测。
countrystring可选ISO 3166-1 alpha-2 国家/地区代码,例如 CN 或 US,用于提供地域信息。
askToAIboolean可选设为 true 时,如果提取出的姓名在数据库中没有结果,则启用 AI 回退。
AI 回退

askToAI 会在姓名提取后判断,并且仅当提取出的姓名在数据库中没有结果时启用。邮箱接口不接受 forceToGenderize。

代码示例

发送邮箱查询请求

cURL
curl -X POST "https://api.genderapi.io/api/email" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"email":"michael.smith@example.com","country":"US","askToAI":true}'
JavaScript
const response = await fetch("https://api.genderapi.io/api/email", {
  method: "POST",
  headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_KEY" },
  body: JSON.stringify({ email: "michael.smith@example.com", country: "US", askToAI: true })
});
const data = await response.json();
Python
import requests

response = requests.post(
  "https://api.genderapi.io/api/email",
  headers={"Authorization": "Bearer YOUR_API_KEY"},
  json={"email": "michael.smith@example.com", "country": "US", "askToAI": True}
)
print(response.json())

200 响应

提取的姓名与性别预测

JSON
{
  "status": true,
  "used_credits": 1,
  "remaining_credits": 4999,
  "expires": 1743659200,
  "q": "michael.smith@example.com",
  "name": "Michael",
  "gender": "male",
  "country": "US",
  "total_names": 10345,
  "probability": 97,
  "duration": "5ms"
}

响应字段

字段类型说明
statusboolean请求是否成功完成。
used_creditsinteger本次请求消耗的额度。
remaining_creditsinteger请求完成后的剩余额度。
expiresinteger套餐到期时间,采用 UNIX 时间戳。
qstring请求中提交的原始邮箱地址。
namestring从邮箱地址中提取的名字。
genderstring | null预测值:male、female 或 null。
countrystring预测时采用的国家/地区代码。
total_namesinteger支持该预测的样本数量。
probabilityinteger预测置信度百分比。
durationstring服务器处理时间。

请使用完整且有效的邮箱地址

姓名提取取决于邮箱地址结构。通用邮箱、别名或不含可识别姓名的本地部分可能无法返回结果;使用预测前请检查 name、gender 和 probability。

下一篇指南

批量分析多个邮箱地址

邮箱批量请求一次请求处理多个邮箱地址 →姓名单条请求直接提交已知名字 →