E-posta ile Cinsiyet Öğrenme – Tekli İstek

Get Gender by Email (E-posta ile Cinsiyet Öğren) endpoint’i, bir kişinin e-posta adresini analiz ederek cinsiyetini belirlemenizi sağlar. Tüm parametreler bir POST isteğiyle JSON formatında gönderilir. Yetkilendirme için Authorization başlığında Bearer token yöntemi ile kimlik doğrulama yapmanız gerekir.

İstek URL’si

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

Gerekli HTTP Başlıkları

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

İstek Gövdesi Parametreleri

Parametre Tip Gerekli Açıklama
email String Evet Analiz edilecek e-posta adresi. API, cinsiyeti belirlemeden önce muhtemel adı e-posta adresinden çıkaracaktır.
country String Hayır Tahmin doğruluğunu artırmak için iki harfli ülke kodu (ISO 3166-1 alpha-2). Örneğin: TR Türkiye için.
askToAI Boolean Hayır true olarak ayarlanırsa, API veritabanında bulunamayan isimler için cinsiyeti bir yapay zeka modeline soracaktır.

İstek Örnekleri


cURL Örneği

curl -X POST "https://api.genderapi.io/api/email" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{"email": "michael.smith@example.com", "country": "US", "askToAI": true}'

PHP cURL Örneği

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

$data = array(
    "email" => "michael.smith@example.com",
    "country" => "US",
    "askToAI" => true
);

$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 Örneği

fetch("https://api.genderapi.io/api/email", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
  },
  body: JSON.stringify({
    email: "michael.smith@example.com",
    country: "US",
    askToAI: true
  })
})
.then(response => response.json())
.then(data => console.log(data));

Python requests Örneği

import requests

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

payload = {
    "email": "michael.smith@example.com",
    "country": "US",
    "askToAI": True
}

headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
}

response = requests.post(url, headers=headers, json=payload)

print(response.json())

JSON Yanıt Örneği

{
  "status": true,
  "used_credits": 1,
  "remaining_credits": 4999,
  "expires": 1743659200,
  "q": "michael.smith@example.com",
  "name": "Michael",
  "gender": "male",
  "country": "US",
  "total_names": 10345,
  "probability": 97,
  "duration": "5ms"
}

Yanıt Alanları

Alan Tip Açıklama
status Boolean İsteğin başarılı olup olmadığını belirtir.
used_credits Integer Bu istek için kullanılan kredi sayısı.
remaining_credits Integer Bu istekten sonra hesabınızda kalan kredi.
expires Integer (timestamp) Paketin UNIX zaman damgası (timestamp) olarak bitiş tarihi.
q String Gönderdiğiniz giriş (e-posta adresi).
name String E-posta adresinden çıkarılan isim.
gender Enum[String] Tahmin edilen cinsiyet. Olası değerler: male, female veya null.
country String Tahmin sırasında dikkate alınan ülke kodu.
total_names Integer Bu tahmin için kullanılan örnek sayısı.
probability Integer Cinsiyet tahmini için güven yüzdesi.
duration String İsteğin işlenme süresi (ör. 5ms).