Get Gender by Email - Single Request

The Get Gender by Email endpoint allows you to determine the gender of a person by analyzing their email address. All parameters are sent via a POST request as JSON. You must authenticate using the Bearer token method in the Authorization header.

Request URL

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

Required HTTP Headers

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

Request Body Parameters

Parameter Type Required Description
email String Yes The email address to analyze. The API will extract the likely first name from the email before determining the gender.
country String No A two-letter country code (ISO 3166-1 alpha-2) to improve prediction accuracy. Example: TR for Turkey.
askToAI Boolean No If set to true, the API will ask an AI model to determine the gender if the extracted name cannot be found in the database.

Example Requests


cURL Example

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 Example

<?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 Example

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 Example

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())

Example JSON Response

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

Response Fields

Field Type Description
status Boolean Indicates whether the request was successful.
used_credits Integer Number of credits consumed for this request.
remaining_credits Integer Credits left in your account after this request.
expires Integer (timestamp) Package expiration date as a UNIX timestamp.
q String Your input query (the email submitted).
name String The extracted first name from the email address.
gender Enum[String] Predicted gender. Possible values: male, female, or null.
country String The country code considered during the prediction.
total_names Integer Number of samples used for this prediction.
probability Integer Confidence percentage for the gender prediction.
duration String Time taken to process the request (e.g. 5ms).