Geschlechtserkennung per E-Mail – Mehrfach-Anfrage
Der Multiple Email-Endpunkt ermöglicht es dir, das Geschlecht von bis zu 50 E-Mail-Adressen in einer einzigen Anfrage zu analysieren. Das ist nützlich für Massenverarbeitung und leistungsstarke Integrationen. Alle Parameter werden per POST-Anfrage als JSON gesendet. Du musst die Authentifizierung mit der Bearer-Token-Methode im Authorization-Header durchführen.
Die API extrahiert jeweils den wahrscheinlichsten Vornamen aus jeder E-Mail-Adresse und bestimmt für jede das Geschlecht.
Du kannst außerdem einen optionalen country
-Filter und ein benutzerdefiniertes id
-Feld für jeden Datensatz übergeben, um die Ergebnisse mit deiner Datenbank abzugleichen.
Request URL
POST https://api.genderapi.io/api/email/multi/country
Erforderliche HTTP-Header
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
Request-Body-Parameter
Feld | Typ | Erforderlich | Beschreibung |
---|---|---|---|
data | Array von Objekten | Ja | Array von E-Mails und ihren optionalen Parametern. Maximal 50 Einträge pro Anfrage. |
String | Ja (in jedem Objekt) | Die zu analysierende E-Mail-Adresse. Die API extrahiert den wahrscheinlichsten Vornamen. | |
country | String | Nein |
Ein zweistelliger Ländercode (ISO 3166-1 alpha-2)
zur Verbesserung der Vorhersagegenauigkeit. Beispiel: TR für die Türkei.
|
id | String oder Integer | Nein |
Optionale ID, die du zur Zuordnung mit deinen eigenen Datenbankeinträgen vergeben kannst.
Die gleiche id wird in der Antwort zur Abbildung zurückgegeben.
|
Beispiel-Request-Body
{
"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" }
]
}
Beispiel-Anfragen
cURL-Beispiel
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-Beispiel
<?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-Beispiel
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-Beispiel
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())
Beispiel-JSON-Antwort
{
"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"
}
Antwortfelder
Feld | Typ | Beschreibung |
---|---|---|
status | Boolean | Gibt an, ob die Anfrage erfolgreich war. |
used_credits | Integer | Anzahl der für diese Anfrage verbrauchten Credits. |
remaining_credits | Integer | Verbleibende Credits auf deinem Konto nach dieser Anfrage. |
expires | Integer (timestamp) | Ablaufdatum des Pakets als UNIX-Timestamp. |
names | Array von Objekten | Ergebnisliste für jede eingegebene E-Mail. |
names[].name | String | Der extrahierte Vorname aus der E-Mail. |
names[].q | String | Deine ursprüngliche E-Mail-Eingabe. |
names[].gender | Enum[String] | Vorhergesagtes Geschlecht: male , female oder null . |
names[].country | String | Ländercode, der bei der Vorhersage berücksichtigt wurde. |
names[].total_names | Integer | Anzahl der für diese Vorhersage verwendeten Stichproben. |
names[].probability | Integer | Wahrscheinlichkeits-Prozentsatz der Geschlechtsvorhersage. |
names[].id | String / Integer | Die gleiche id , die du in der Anfrage gesendet hast (zum Abgleich). |
duration | String | Gesamte Bearbeitungszeit für die Anfrage (z.B. 5ms ). |