Rileva il genere da email – Richiesta multipla
L’endpoint Multiple Email ti permette di analizzare il genere di fino a 50 indirizzi email in una singola richiesta. Questo è utile per processi in bulk e integrazioni ad alte prestazioni. Tutti i parametri sono inviati tramite una richiesta POST in formato JSON. Devi autenticarti utilizzando il metodo Bearer token nell’header Authorization.
L’API estrae il probabile primo nome da ogni indirizzo email e determina il genere per ciascuno.
Puoi anche passare un filtro opzionale country
e un campo personalizzato id
per ogni record, per abbinare i risultati con il tuo database.
URL richiesta
POST https://api.genderapi.io/api/email/multi/country
Header HTTP richiesti
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
Parametri del body della richiesta
Campo | Tipo | Obbligatorio | Descrizione |
---|---|---|---|
data | Array di oggetti | Sì | Array di email e parametri opzionali. Massimo 50 elementi per richiesta. |
String | Sì (in ogni oggetto) | L’indirizzo email da analizzare. L’API estrarrà il probabile primo nome. | |
country | String | No |
Codice paese a due lettere (ISO 3166-1 alpha-2)
per migliorare la precisione della previsione. Esempio: TR per la Turchia.
|
id | String o Integer | No |
ID opzionale che definisci per associare i risultati ai tuoi dati. Lo stesso id sarà restituito nella risposta.
|
Esempio di body richiesta
{
"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" }
]
}
Esempi di richieste
Esempio 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"}]}'
Esempio 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;
?>
Esempio 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));
Esempio 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())
Esempio di risposta 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"
}
Campi della risposta
Campo | Tipo | Descrizione |
---|---|---|
status | Boolean | Indica se la richiesta è stata completata con successo. |
used_credits | Integer | Numero di crediti utilizzati per questa richiesta. |
remaining_credits | Integer | Crediti rimanenti sul tuo account dopo questa richiesta. |
expires | Integer (timestamp) | Data di scadenza del pacchetto in formato UNIX timestamp. |
names | Array di oggetti | Lista dei risultati per ogni email inviata. |
names[].name | String | Il primo nome estratto dall'email. |
names[].q | String | L’email originale che hai inviato. |
names[].gender | Enum[String] | Genere previsto: male , female o null . |
names[].country | String | Codice paese considerato durante la previsione. |
names[].total_names | Integer | Numero di campioni usati per questa previsione. |
names[].probability | Integer | Percentuale di affidabilità della previsione. |
names[].id | String / Integer | Lo stesso id che hai inviato nella richiesta, per collegare i tuoi dati. |
duration | String | Tempo totale di elaborazione della richiesta (esempio: 5ms ). |