이름으로 성별 분석 - 다중 요청

다중 이름 엔드포인트를 사용하면 한 번의 요청으로 최대 100개의 이름에 대한 성별을 분석할 수 있습니다. 대량 처리 및 고성능 통합에 유용합니다. 모든 파라미터는 JSON 형식의 POST 요청으로 전송됩니다. Authorization 헤더에서 Bearer 토큰 방식으로 인증해야 합니다.

각 이름에 country 필터를 추가하면 특정 국가에 맞는 성별 예측을 받을 수 있습니다. 지정한 국가에 대한 결과가 없는 경우, API는 전역 데이터 기준의 예측 결과를 반환합니다.

각 이름에 대해 선택적으로 id 필드를 지정할 수 있습니다. 이 값은 귀하의 데이터베이스에서 가져온 문자열이나 정수일 수 있습니다. API는 응답에서 동일한 id 값을 반환하므로 결과와 입력 데이터를 쉽게 매칭할 수 있습니다.

주의: 다중 요청은 AI 기반 추론 모델을 지원하지 않습니다. askToAI 같은 파라미터는 대량 작업에서 사용할 수 없습니다.

데이터에 중국어 등 비라틴 문자로 된 이름이 자주 포함되는 경우, 단일 요청과 askToAI 파라미터를 사용하는 것이 더 정확한 결과를 얻을 수 있습니다.

요청 URL

POST https://api.genderapi.io/api/name/multi/country

필수 HTTP 헤더

  • Content-Type: application/json
  • Authorization: Bearer YOUR_API_KEY

요청 본문 파라미터

필드 타입 필수 설명
data Object 배열 이름과 해당 선택적 파라미터를 포함하는 배열입니다. 요청당 최대 100개까지 가능합니다.
name String 예 (각 객체 내부) 성별을 분석할 이름입니다.
country String 아니오 성별 예측 정확도를 높이기 위한 두 글자 국가 코드 (ISO 3166-1 alpha-2). 예: TR (터키).
id String 또는 Integer 아니오 응답에서 동일한 id 가 반환되므로 결과를 귀하의 데이터베이스와 매칭할 수 있습니다.

요청 본문 예시

{
  "data": [
    { "name": "Andrea", "country": "DE", "id": "123" },
    { "name": "andrea", "country": "IT", "id": "456" },
    { "name": "james", "country": "US", "id": "789" }
  ]
}

요청 예시


cURL 예시

curl -X POST "https://api.genderapi.io/api/name/multi/country" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{"data":[{"name":"Andrea","country":"DE","id":"123"},{"name":"andrea","country":"IT","id":"456"},{"name":"james","country":"US","id":"789"}]}'

PHP cURL 예시

<?php
$url = "https://api.genderapi.io/api/name/multi/country";

$data = array(
    "data" => array(
        array(
            "name" => "Andrea",
            "country" => "DE",
            "id" => "123"
        ),
        array(
            "name" => "andrea",
            "country" => "IT",
            "id" => "456"
        ),
        array(
            "name" => "james",
            "country" => "US",
            "id" => "789"
        )
    )
);

$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/name/multi/country", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
  },
  body: JSON.stringify({
    data: [
      { name: "Andrea", country: "DE", id: "123" },
      { name: "andrea", country: "IT", id: "456" },
      { name: "james", country: "US", id: "789" }
    ]
  })
})
.then(response => response.json())
.then(data => console.log(data));

Python requests 예시

import requests

url = "https://api.genderapi.io/api/name/multi/country"

payload = {
    "data": [
        { "name": "Andrea", "country": "DE", "id": "123" },
        { "name": "andrea", "country": "IT", "id": "456" },
        { "name": "james", "country": "US", "id": "789" }
    ]
}

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": 3,
  "remaining_credits": 7265,
  "expires": 1717069765,
  "names": [
    {
      "name": "andrea",
      "q": "Andrea",
      "gender": "female",
      "country": "DE",
      "total_names": 644,
      "probability": 88,
      "id": "optional"
    },
    {
      "name": "andrea",
      "q": "andrea",
      "gender": "male",
      "country": "IT",
      "total_names": 13537,
      "probability": 98,
      "id": "optional"
    },
    {
      "name": "james",
      "q": "james",
      "gender": "male",
      "country": "US",
      "total_names": 45274,
      "probability": 100,
      "id": "optional"
    }
  ],
  "duration": "5ms"
}

응답 필드

필드 유형 설명
status Boolean 요청이 성공했는지 여부를 나타냅니다.
used_credits Integer 이 요청으로 사용된 크레딧 수입니다.
remaining_credits Integer 요청 이후 계정에 남아 있는 크레딧 수입니다.
expires Integer (timestamp) UNIX 타임스탬프로 표시된 패키지 만료 날짜입니다.
names 객체 배열 입력한 각 이름에 대한 결과 목록입니다.
names[].name String 소문자로 정규화된 이름입니다.
names[].q String 사용자가 보낸 원본 이름입니다 (대소문자 구분).
names[].gender Enum[String] 예측된 성별입니다: male, female 또는 null 중 하나입니다.
names[].country String 예측 시 고려된 국가 코드입니다.
names[].total_names Integer 이 예측에 사용된 이름 샘플의 수입니다.
names[].probability Integer 성별 예측의 신뢰도(%)입니다.
names[].id String / Integer 요청에 포함된 id 값이며 결과를 기존 데이터와 연결하는 데 사용됩니다.
duration String 요청 처리에 걸린 전체 시간입니다 (예: 5ms).
경고: 여러 개의 이름을 보낼 경우, JSON 배열이 올바르게 포맷되어 있고 100개를 초과하지 않도록 하세요. API의 결과와 사용자의 데이터를 일치시키기 위해 id 필드를 사용하세요.