ระบุเพศจากอีเมล - คำขอหลายรายการ

ปลายทางสำหรับอีเมลหลายรายการ ช่วยให้คุณสามารถวิเคราะห์เพศจากที่อยู่อีเมลได้สูงสุด 50 รายการในคำขอเดียว
เหมาะสำหรับการประมวลผลจำนวนมากและการรวมระบบที่มีประสิทธิภาพสูง
พารามิเตอร์ทั้งหมดจะถูกส่งผ่านคำขอ POST ในรูปแบบ JSON
คุณต้องใช้การตรวจสอบสิทธิ์ด้วยโทเค็น Bearer ในส่วนหัว Authorization

API จะดึงชื่อแรกที่น่าจะเป็นจากแต่ละที่อยู่อีเมลและระบุเพศให้แต่ละรายการ
คุณสามารถส่ง country (รหัสประเทศ) และ id (รหัสอ้างอิง) เป็นพารามิเตอร์เพิ่มเติมสำหรับแต่ละระเบียน
เพื่อให้สามารถจับคู่ผลลัพธ์กับฐานข้อมูลของคุณได้

URL สำหรับคำขอ

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

HTTP Headers ที่จำเป็น

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

พารามิเตอร์ในเนื้อหาคำขอ

ฟิลด์ ประเภท จำเป็น คำอธิบาย
data Array of Objects ใช่ อาร์เรย์ของอีเมลแต่ละรายการพร้อมพารามิเตอร์เพิ่มเติม (ถ้ามี) จำกัดสูงสุด 50 รายการต่อคำขอ
email String ใช่ (ในแต่ละอ็อบเจกต์) ที่อยู่อีเมลที่ต้องการวิเคราะห์ API จะดึงชื่อแรกจากอีเมลนั้น
country String ไม่จำเป็น รหัสประเทศแบบสองตัวอักษร (ISO 3166-1 alpha-2) เพื่อเพิ่มความแม่นยำในการทำนาย เช่น TH สำหรับประเทศไทย
id String หรือ Integer ไม่จำเป็น รหัสที่คุณกำหนดไว้เพื่อตรงกับระเบียนในฐานข้อมูลของคุณ ระบบจะส่งคืนรหัสเดิมในผลลัพธ์

ตัวอย่างเนื้อหาคำขอ

{
  "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

{
  "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"
}

ฟิลด์ในผลลัพธ์

ฟิลด์ ประเภท คำอธิบาย
status Boolean แสดงว่าคำขอสำเร็จหรือไม่
used_credits Integer จำนวนเครดิตที่ใช้ไปในการร้องขอครั้งนี้
remaining_credits Integer เครดิตที่เหลืออยู่ในบัญชีของคุณ
expires Integer (timestamp) วันที่หมดอายุของแพ็กเกจในรูปแบบ UNIX timestamp
names Array of objects รายการผลลัพธ์สำหรับแต่ละอีเมลที่ส่ง
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