リクエストの概要
ユーザー名から可能性のある名前へ
GenderAPIは、提出されたハンドル内に名前に関するシグナルを検出し、データベースの証拠、国別コンテキスト、および必要に応じてAIのフォールバックを用いて性別を予測します。
Input
→sparkling_unicorn抽出されたシグナル
→SparklingPrediction
女性 · 92%MethodPOST
コンテンツタイプapplication/json
Authenticationベアラーティケット
AIオプションAvailable
HDR
必須HTTPヘッダー
リクエストを認可
Content-Typeapplication/jsonAuthorizationBearer YOUR_API_KEYJSON リクエストボディ
パラメータ
| Parameter | Type | Requirement | Description |
|---|---|---|---|
username | string | 必須 | 分析するユーザー名、ソーシャルハンドル、表示名、またはニックネーム |
country | string | 任意 | 地域コンテキストのために、ISO 3166-1 alpha-2国コード(例:USまたはTR) |
askToAI | boolean | 任意 | trueの場合、抽出された名前がデータベースに結果がない場合にAIフィールドを活用する |
forceToGenderize | boolean | 任意 | trueの場合、通常の名前とは似ていないエイリアスまたは入力に対して予測を試みる |
信頼性は重要である:弱いまたは人間ではない名前シグナルに対する強制結果は、信頼性が低い可能性がある。行動前に評価する。
probability行動前に評価する。コード例
ユーザー名のリクエストを送信
cURL
curl -X POST "https://api.genderapi.io/api/username" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"username":"sparkling_unicorn","country":"US","askToAI":true,"forceToGenderize":true}'JavaScript
const response = await fetch("https://api.genderapi.io/api/username", {
method: "POST",
headers: { "Content-Type": "application/json", "Authorization": "Bearer YOUR_API_KEY" },
body: JSON.stringify({ username: "sparkling_unicorn", country: "US", askToAI: true, forceToGenderize: true })
});Python
import requests
response = requests.post(
"https://api.genderapi.io/api/username",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"username": "sparkling_unicorn", "country": "US", "askToAI": True, "forceToGenderize": True}
)
print(response.json())200レスポンス
抽出されたシグナル and prediction
JSON
{
"status": true, "used_credits": 1, "remaining_credits": 4999,
"expires": 1743659200, "q": "sparkling_unicorn",
"name": "Sparkling", "gender": "female", "country": "US",
"total_names": 9876, "probability": 92, "duration": "6ms"
}レスポンスフィールド
| Field | Type | Description |
|---|---|---|
status | boolean | リクエストが成功したかどうか |
used_credits | integer | このリクエストで消費されたクレジット |
remaining_credits | integer | リクエスト後の残りのクレジット |
expires | integer | パッケージの有効期限をUNIXタイムスタンプで表す |
q | string | リクエストで送信された元のユーザー名。 |
name | string | ユーザー名から抽出された可能性のある名前。 |
gender | string | null | 予測値:男性、女性、またはnull。 |
country | string | 予測に使用された国コード。 |
total_names | integer | 予測を支持するサンプルの数。 |
probability | integer | 予測の信頼度(パーセンテージ)。 |
duration | string | サーバー処理時間。 |
ユーザー名を間接的なシグナルとして扱う
ユーザー名はブランド、キャラクター、またはコンセプトを表す場合もあり、人間を表すものではない可能性がある。抽出された結果が意味のあるものかどうかを確認し、用途に応じて適切な確率閾値を設定する。name
次に進むガイド