Determine Gender from 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 batch processing and high-performance integrations. All parameters must be sent as a JSON-formatted POST request. You need to authenticate your request using a Bearer token in the Authorization header.
The API attempts to extract a potential name from each username, which can help improve the accuracy
of the gender prediction. Additionally, you can optionally provide a country
filter
and a custom id
field to match results with your own database records.
Warning:
Usernames should generally consist of Latin characters. However, they often contain words or combinations
that do not represent real names, such as
If your main goal is accurate gender prediction, we recommend using single requests with the
If your priority is just extracting potential names from usernames, then multiple requests can be used instead.
cool_boy123
.
If your main goal is accurate gender prediction, we recommend using single requests with the
forceToGenderize
parameter enabled.If your priority is just extracting potential names from usernames, then 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 | An array containing the usernames and their optional parameters. You can send up to 50 records in a single request. |
username | String | Yes (per object) | The username to be analyzed. 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 |
An optional identifier you can define to match the results with your database records.
The same id will be returned in the response for matching 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 by this request. |
remaining_credits | Integer | Number of credits remaining on your account after this request. |
expires | Integer (timestamp) | Expiration date of your plan as a UNIX timestamp. |
names | Array of Objects | List of results for each submitted username. |
names[].name | String | The extracted name (if any) from the username. |
names[].q | String | The original username you submitted. |
names[].gender | Enum[String] | Predicted gender: male , female , or null . |
names[].country | String | Country code considered during prediction. |
names[].total_names | Integer | Number of name samples used for this prediction. |
names[].probability | Integer | Confidence score for the gender prediction (percentage). |
names[].id | String / Integer | The same id you submitted, useful for matching with your records. |
duration | String | Time taken to process the request (e.g., 5ms ). |