Gender from name · Single request

Determine gender from a name

Analyze one first name with country context, confidence scoring and an optional AI fallback.

POSThttps://api.genderapi.io/api

Request overview

Send one name per request

Submit a JSON object with a first name and authenticate with a Bearer token. Add a country code when regional naming patterns can improve the prediction.

MethodPOST
Content typeapplication/json
AuthenticationBearer token
Credit cost1 lookup
HDR

Required HTTP headers

Authorize the request

Content-Typeapplication/json
AuthorizationBearer YOUR_API_KEY
Keep the API key in server-side environment variables. See the authentication guide for credential safety.

JSON request body

Parameters

ParameterTypeRequirementDescription
namestringRequiredFirst name to analyze. Use a clean name value without titles or prefixes.
countrystringOptionalISO 3166-1 alpha-2 country code, such as US or TR, to add regional context.
askToAIbooleanOptionalWhen true, use the AI fallback if the name is not found in the database.
forceToGenderizebooleanOptionalWhen true, attempt a result for nicknames or inputs that do not resemble typical names.
About AI fallback

askToAI applies only when the database has no result. Forced predictions for unusual inputs can be less reliable, so treat probability as an important signal.

Code examples

Make a single request

These examples send the same request using Bearer authentication.

cURL
curl -X POST "https://api.genderapi.io/api" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"name":"Alice","country":"US","askToAI":true}'
JavaScript
const response = await fetch("https://api.genderapi.io/api", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_API_KEY"
  },
  body: JSON.stringify({ name: "Alice", country: "US", askToAI: true })
});

const data = await response.json();
Python
import requests

response = requests.post(
  "https://api.genderapi.io/api",
  headers={"Authorization": "Bearer YOUR_API_KEY"},
  json={"name": "Alice", "country": "US", "askToAI": True}
)
print(response.json())

200 response

Prediction result

JSON
{
  "status": true,
  "used_credits": 1,
  "remaining_credits": 4999,
  "expires": 1743659200,
  "q": "Alice",
  "name": "Alice",
  "gender": "female",
  "country": "US",
  "total_names": 10234,
  "probability": 98,
  "duration": "4ms"
}

Response fields

FieldTypeDescription
statusbooleanWhether the request completed successfully.
used_creditsintegerCredits consumed by this request.
remaining_creditsintegerCredits available after the request.
expiresintegerPackage expiration time as a UNIX timestamp.
qstringOriginal name submitted in the request.
namestringName analyzed by GenderAPI.
genderstring | nullPredicted value: male, female or null.
countrystringCountry code considered for the prediction.
total_namesintegerNumber of samples supporting the prediction.
probabilityintegerPrediction confidence as a percentage.
durationstringServer processing time.

Send clean, correctly encoded input

Use a first name without titles or prefixes. JSON clients handle encoding automatically, but always validate external input before creating the request body.

Next guide

Analyze multiple names

Multiple name requestProcess several names in one request →AuthenticationReview API key security →