ईमेल से जेंडर पहचानें – मल्टीपल रिक्वेस्ट

Multiple Email एन्डपॉइंट आपको एक ही रिक्वेस्ट में 50 ईमेल एड्रेस तक के जेंडर का विश्लेषण करने की सुविधा देता है। यह बल्क प्रोसेसिंग और हाई-परफॉरमेंस इंटीग्रेशन के लिए उपयोगी है। सभी पैरामीटर POST रिक्वेस्ट के जरिए JSON फॉर्मेट में भेजे जाते हैं। आपको Authorization हेडर में Bearer टोकन विधि से प्रमाणित (authenticate) करना होगा।

API हर ईमेल एड्रेस से संभावित पहला नाम निकालता है और हर एक का जेंडर निर्धारित करता है। आप प्रत्येक रिकॉर्ड के लिए एक वैकल्पिक country फिल्टर और कस्टम id फ़ील्ड भी भेज सकते हैं ताकि परिणाम को अपनी डेटाबेस प्रविष्टियों से मिलाया जा सके।

Request URL

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

आवश्यक HTTP हेडर

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

रिक्वेस्ट बॉडी पैरामीटर

Field Type Required विवरण
data Objects की Array हाँ ईमेल और उनके वैकल्पिक पैरामीटर की सूची। एक रिक्वेस्ट में अधिकतम 50।
email String हाँ (हर ऑब्जेक्ट में) वह ईमेल एड्रेस जिसका विश्लेषण करना है। API संभावित पहला नाम निकालेगा।
country String नहीं दो-अक्षर का देश कोड (ISO 3166-1 alpha-2) जिससे prediction की सटीकता बढ़ती है। उदाहरण: TR (तुर्की के लिए)।
id String या Integer नहीं आपकी अपनी डेटाबेस एंट्री से परिणाम को जोड़ने के लिए वैकल्पिक ID। वही id response में वापस मिलेगा।

रिक्वेस्ट बॉडी का उदाहरण

{
  "data": [
    { "email": "andrea.schmidt@example.com", "country": "DE", "id": "123" },
    { "email": "andrea.rossi@example.it", "country": "IT", "id": "456" },
    { "email": "james.brown@example.com", "country": "US", "id": "789" }
  ]
}

रिक्वेस्ट उदाहरण


cURL उदाहरण

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

PHP cURL उदाहरण

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

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

Python requests उदाहरण

import requests

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

payload = {
    "data": [
        { "email": "andrea.schmidt@example.com", "country": "DE", "id": "123" },
        { "email": "andrea.rossi@example.it", "country": "IT", "id": "456" },
        { "email": "james.brown@example.com", "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 Response का उदाहरण

{
  "status": true,
  "used_credits": 3,
  "remaining_credits": 7265,
  "expires": 1717069765,
  "names": [
    {
      "name": "Andrea",
      "q": "andrea.schmidt@example.com",
      "gender": "female",
      "country": "DE",
      "total_names": 644,
      "probability": 88,
      "id": "123"
    },
    {
      "name": "Andrea",
      "q": "andrea.rossi@example.it",
      "gender": "male",
      "country": "IT",
      "total_names": 13537,
      "probability": 98,
      "id": "456"
    },
    {
      "name": "James",
      "q": "james.brown@example.com",
      "gender": "male",
      "country": "US",
      "total_names": 45274,
      "probability": 100,
      "id": "789"
    }
  ],
  "duration": "5ms"
}

Response Fields

Field Type विवरण
status Boolean क्या रिक्वेस्ट सफल थी या नहीं, यह दर्शाता है।
used_credits Integer इस रिक्वेस्ट में उपयोग किए गए क्रेडिट्स की संख्या।
remaining_credits Integer रिक्वेस्ट के बाद खाते में बची हुई क्रेडिट्स की संख्या।
expires Integer (timestamp) पैकेज की समाप्ति तारीख (UNIX timestamp)।
names Objects की Array प्रत्येक ईमेल इनपुट के लिए परिणामों की सूची।
names[].name String ईमेल से निकाला गया पहला नाम।
names[].q String आपका भेजा गया मूल ईमेल।
names[].gender Enum[String] अनुमानित जेंडर: male, female या null
names[].country String prediction के दौरान विचार किया गया देश कोड।
names[].total_names Integer इस prediction के लिए उपयोग किए गए सैंपल्स की संख्या।
names[].probability Integer prediction की विश्वास (confidence) प्रतिशतता।
names[].id String / Integer वही id जो आपने अनुरोध में भेजा था, अपने रिकॉर्ड से मिलाने के लिए।
duration String रिक्वेस्ट के प्रोसेसिंग का कुल समय (जैसे 5ms)।