Get Gender by Username - Multiple Request

The Multiple Username endpoint allows you to analyze the gender of up to 50 usernames in a single request. This is useful for bulk processing and high-performance integrations. All parameters are sent via a POST request as JSON. You must authenticate using the Bearer token method in the Authorization header.

The API will try to extract a likely first name from each username, which may help improve gender prediction. You can also pass an optional country filter and a custom id field for each record to match results with your database.

Warning: Usernames are usually required to be in Latin characters. However, they may often contain words or combinations that do not represent real names, e.g. cool_boy123.

If your primary goal is accurate gender prediction, we recommend using single requests with the forceToGenderize parameter enabled.

If your priority is simply extracting potential names from usernames, multiple requests can be used instead.

Request URL

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

Required HTTP Headers

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

Request Body Parameters

Field Type Required Description
data Array of Objects Yes Array of usernames and their optional parameters. Maximum 50 entries per request.
username String Yes (inside each object) The username to analyze. May include underscores, numbers, etc.
country String No A two-letter country code (ISO 3166-1 alpha-2) to improve prediction accuracy. Example: TR for Turkey.
id String or Integer No Optional ID you define to match results with your own database records. The same id will be returned in the response for mapping purposes.

Example Request Body

{
  "data": [
    { "username": "anna_smith88", "country": "US", "id": "123" },
    { "username": "michael_bauer", "country": "DE", "id": "456" },
    { "username": "giulia_rossi", "country": "IT", "id": "789" }
  ]
}

Example Requests


cURL Example

curl -X POST "https://api.genderapi.io/api/username/multi/country" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{"data":[{"username":"anna_smith88","country":"US","id":"123"},{"username":"michael_bauer","country":"DE","id":"456"},{"username":"giulia_rossi","country":"IT","id":"789"}]}'

PHP cURL Example

<?php
$url = "https://api.genderapi.io/api/username/multi/country";

$data = array(
    "data" => array(
        array(
            "username" => "anna_smith88",
            "country" => "US",
            "id" => "123"
        ),
        array(
            "username" => "michael_bauer",
            "country" => "DE",
            "id" => "456"
        ),
        array(
            "username" => "giulia_rossi",
            "country" => "IT",
            "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 Example

fetch("https://api.genderapi.io/api/username/multi/country", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
  },
  body: JSON.stringify({
    data: [
      { username: "anna_smith88", country: "US", id: "123" },
      { username: "michael_bauer", country: "DE", id: "456" },
      { username: "giulia_rossi", country: "IT", id: "789" }
    ]
  })
})
.then(response => response.json())
.then(data => console.log(data));

Python requests Example

import requests

url = "https://api.genderapi.io/api/username/multi/country"

payload = {
    "data": [
        { "username": "anna_smith88", "country": "US", "id": "123" },
        { "username": "michael_bauer", "country": "DE", "id": "456" },
        { "username": "giulia_rossi", "country": "IT", "id": "789" }
    ]
}

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": 3,
  "remaining_credits": 7265,
  "expires": 1717069765,
  "names": [
    {
      "name": "Anna",
      "q": "anna_smith88",
      "gender": "female",
      "country": "US",
      "total_names": 1234,
      "probability": 92,
      "id": "123"
    },
    {
      "name": "Michael",
      "q": "michael_bauer",
      "gender": "male",
      "country": "DE",
      "total_names": 5678,
      "probability": 89,
      "id": "456"
    },
    {
      "name": "Giulia",
      "q": "giulia_rossi",
      "gender": "female",
      "country": "IT",
      "total_names": 4321,
      "probability": 95,
      "id": "789"
    }
  ],
  "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.
names Array of objects List of results for each input username.
names[].name String The detected first name, if any, extracted from the username.
names[].q String Your original username input.
names[].gender Enum[String] Predicted gender: male, female, or null.
names[].country String Country code considered during the prediction.
names[].total_names Integer Number of samples used for this prediction.
names[].probability Integer Confidence percentage for the gender prediction.
names[].id String / Integer The same id you sent in the request. Used to match your records.
duration String Total processing time for the request (e.g. 5ms).