नाम से जेंडर · एकल अनुरोध

नाम से gender पता करें

Country context, probability scoring और optional AI fallback के साथ एक first name analyze करें।

POSThttps://api.genderapi.io/api

Request overview

हर request में एक name भेजें

First name के साथ JSON object submit करें और Bearer token से authenticate करें। Regional naming patterns prediction सुधार सकते हों तो country code जोड़ें।

MethodPOST
Content typeapplication/json
AuthenticationBearer token
Credit cost1 lookup
HDR

जरूरी HTTP headers

Request authorize करें

Content-Typeapplication/json
AuthorizationBearer YOUR_API_KEY
API key को server-side environment variables में रखें। Credential safety के लिए authentication guide पढ़ें।

JSON request body

Parameters

ParameterTypeRequirementDescription
namestringजरूरीAnalyze करने के लिए first name। Titles या prefixes के बिना clean name value भेजें।
countrystringवैकल्पिकRegional context के लिए IN या US जैसा ISO 3166-1 alpha-2 country code।
askToAIbooleanवैकल्पिकtrue होने पर database में name न मिलने पर AI fallback इस्तेमाल करें।
forceToGenderizebooleanवैकल्पिकtrue होने पर nicknames या typical name जैसे न दिखने वाले inputs के लिए result try करें।
AI fallback के बारे में

askToAI केवल database में result न मिलने पर लागू होता है। Unusual inputs पर forced predictions कम reliable हो सकते हैं, इसलिए probability को महत्वपूर्ण signal मानें।

Code examples

Single request भेजें

ये examples Bearer authentication से वही request भेजते हैं।

cURL
curl -X POST "https://api.genderapi.io/api" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"name":"Priya","country":"IN","askToAI":true}'
JavaScript
const response = await fetch("https://api.genderapi.io/api", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
  },
  body: JSON.stringify({ name: "Priya", country: "IN", askToAI: true })
});

const data = await response.json();
Python
import requests

response = requests.post(
  "https://api.genderapi.io/api",
  headers={"Authorization": "Bearer YOUR_API_KEY"},
  json={"name": "Priya", "country": "IN", "askToAI": True}
)
print(response.json())

200 response

Prediction result

JSON
{
  "status": true,
  "used_credits": 1,
  "remaining_credits": 4999,
  "expires": 1743659200,
  "q": "Priya",
  "name": "Priya",
  "gender": "female",
  "country": "IN",
  "total_names": 10234,
  "probability": 98,
  "duration": "4ms"
}

Response fields की जानकारी

FieldTypeDescription
statusbooleanRequest सफलतापूर्वक पूरा हुआ या नहीं।
used_creditsintegerइस request में इस्तेमाल हुए credits।
remaining_creditsintegerRequest के बाद उपलब्ध credits।
expiresintegerPackage expiry का UNIX timestamp।
qstringRequest में भेजा गया original name।
namestringGenderAPI द्वारा analyze किया गया name।
genderstring | nullPredicted value: male, female या null।
countrystringPrediction में इस्तेमाल हुआ country code।
total_namesintegerPrediction को support करने वाले samples की संख्या।
probabilityintegerप्रतिशत में prediction probability।
durationstringServer processing time।

Clean और correctly encoded input भेजें

Titles या prefixes के बिना first name इस्तेमाल करें। JSON clients encoding automatically संभालते हैं, लेकिन request body बनाने से पहले external input हमेशा validate करें।

अगली गाइड

Multiple names analyze करें

Multiple name requestएक request में कई names process करें →प्रमाणीकरणAPI key security फिर से देखें →