이메일로 성별 가져오기 - 단일 요청
이메일로 성별 가져오기 엔드포인트를 사용하면 이메일 주소를 분석하여 사람의 성별을 확인할 수 있습니다.
모든 매개변수는 JSON 형식의 POST 요청으로 전송됩니다.
인증은 Authorization 헤더에 Bearer 토큰 방식으로 해야 합니다.
요청 URL
POST https://api.genderapi.io/api/email
필수 HTTP 헤더
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
요청 본문 매개변수
매개변수 |
타입 |
필수 여부 |
설명 |
email |
String |
예 |
분석할 이메일 주소입니다. API는 먼저 이메일에서 추정 이름을 추출한 후 성별을 결정합니다.
|
country |
String |
아니오 |
예측 정확도를 높이기 위한 두 자리 국가 코드입니다
(ISO 3166-1 alpha-2).
예시: TR (터키)
|
askToAI |
Boolean |
아니오 |
true 로 설정하면, 추출된 이름이 데이터베이스에서 발견되지 않았을 경우 AI 모델에 성별 예측을 요청합니다.
|
요청 예시
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}'
PHP cURL 예시
<?php
$url = "https://api.genderapi.io/api/email";
$data = array(
"email" => "michael.smith@example.com",
"country" => "US",
"askToAI" => true
);
$payload = json_encode($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"Authorization: Bearer YOUR_API_KEY"
));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
JavaScript fetch 예시
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
})
})
.then(response => response.json())
.then(data => console.log(data));
Python requests 예시
import requests
url = "https://api.genderapi.io/api/email"
payload = {
"email": "michael.smith@example.com",
"country": "US",
"askToAI": True
}
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
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"
}
응답 필드
필드 |
타입 |
설명 |
status |
Boolean |
요청이 성공했는지 여부를 나타냅니다. |
used_credits |
Integer |
이 요청으로 사용된 크레딧 수입니다. |
remaining_credits |
Integer |
요청 후 계정에 남은 크레딧 수입니다. |
expires |
Integer (timestamp) |
패키지 만료일 (UNIX 타임스탬프 형식). |
q |
String |
입력한 이메일 쿼리입니다. |
name |
String |
이메일에서 추출된 이름입니다. |
gender |
Enum[String] |
예측된 성별입니다. 가능한 값: male , female , 또는 null . |
country |
String |
예측 시 사용된 국가 코드입니다. |
total_names |
Integer |
이 예측에 사용된 샘플 수입니다. |
probability |
Integer |
성별 예측의 신뢰도 백분율입니다. |
duration |
String |
요청 처리에 걸린 시간 (예: 5ms ). |