बुनियादी उपयोग
अपना पहला GenderAPI request भेजें
एक input value भेजकर predicted gender, probability, country और usage information पाएँ। Name के लिए base endpoint और उपलब्ध data email या username होने पर उसका dedicated endpoint इस्तेमाल करें।
key query parameter से API key जोड़ें। Production keys अपने server पर रखें—private key को browser code या public repository में expose न करें।
वर्तमान GenderAPI अनुबंध को OpenAPI, Swagger या Postman प्रारूप में उपयोग करें।
Name से gender
First name या full name
Input first name या full name हो तो base endpoint इस्तेमाल करें।
https://api.genderapi.io/apicurl "https://api.genderapi.io/api?name=Alice&key=YOUR_API_KEY"वैकल्पिक पैरामीटर
| Parameter | Type | Description |
|---|---|---|
country | string | IN या US जैसा two-letter country code। |
askToAI | boolean | true होने पर database में name न मिलने पर AI fallback से analysis माँगा जाता है। |
forceToGenderize | boolean | ऐसे unusual inputs का prediction try करता है जो human name जैसे न दिखें। |
Email से gender
Email address
Email endpoint gender detection से पहले address से संभावित name extract करता है।
https://api.genderapi.io/api/emailcurl "https://api.genderapi.io/api/email?email=alice.smith%40example.com&country=IN&askToAI=true&key=YOUR_API_KEY"forceToGenderize इस endpoint में उपलब्ध नहीं है क्योंकि name internally extract होता है।Username से gender
Social username
ऐसे usernames, handles और nicknames के लिए यह endpoint इस्तेमाल करें जिनमें recognizable name हो सकता है।
https://api.genderapi.io/api/usernamecurl "https://api.genderapi.io/api/username?username=sparkling_unicorn&country=IN&askToAI=true&forceToGenderize=true&key=YOUR_API_KEY"JSON response
GenderAPI response को समझें
तीनों endpoints एक core response structure इस्तेमाल करते हैं।
{
"status": true,
"used_credits": 1,
"remaining_credits": 4999,
"expires": 1743659200,
"q": "Alice",
"name": "alice",
"gender": "female",
"country": "US",
"total_names": 325,
"probability": 98,
"duration": "4ms"
}Response fields की जानकारी
| Field | Type | Description |
|---|---|---|
status | boolean | Request सफलतापूर्वक पूरा हुआ या नहीं। |
used_credits | integer | इस request में इस्तेमाल हुए API credits। |
remaining_credits | integer | Request के बाद बचे API credits। |
expires | integer | Package expiry time का UNIX timestamp। |
q | string | Original name, email या username query। |
name | string | Normalized या input से निकाला गया first name। |
gender | string | Predicted gender: male, female या "null"। |
country | string | सबसे संभावित ISO 3166-1 alpha-2 country code। |
total_names | integer | Prediction के पीछे उपलब्ध name records की संख्या। |
probability | integer | प्रतिशत में prediction probability। |
duration | string | Request का server processing time। |
Input values को हमेशा URL-encode करें
Spaces और special characters आपके HTTP client से encode होने चाहिए। उदाहरण के लिए raw space की जगह sparkling%20unicorn इस्तेमाल करें।
आगे बढ़ें