Before sending the request
Send GenderAPI.io V2 prediction requests to POST https://api.genderapi.io/api/v2/gender with type and value in the JSON body. Use your existing GenderAPI.io key in Authorization: Bearer YOUR_API_KEY and Content-Type: application/json. Read the result from data and the access and billing information from meta. Every request is processed independently.
Choose your language in the code example. Set GENDERAPI_API_KEY in the process environment before running it. Missing or unrecognized keys can use the shared IP trial, so confirm meta.access.mode is api_key when integrating an account.
Gender from an email address
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
type | string | Yes | — | Input category: name, email or username. |
value | string | Yes | — | Required. 1–254 characters; nonblank, without control characters. Email values must be valid email syntax. |
country | string | No | — | Optional uppercase ISO 3166-1 alpha-2 code, for example TR or US. Country-specific lookup can fall back to the global dataset. |
forceToGenderize | boolean | No | false | Try the dataset first, then nickname-aware AI if unresolved. Supported for name, email and username. |
options | object | No | — | Container for per-input AI options. |
options.ai_mode | string | No | fallback | Allowed values: off, fallback, always. With forceToGenderize: true, omit this field or use fallback. |
id | string | No | — | Optional 1–64 character identifier in POST JSON. Returned beside each batch result; unique within a batch. Accepted but not echoed for single predictions. Not supported in GET queries. |
Send type: email and the address in value to POST https://api.genderapi.io/api/v2/gender. GenderAPI.io V2 looks for a usable name signal in the address. Shared inboxes and opaque local parts may produce an unknown result. forceToGenderize is optional here too; it permits AI inference from an alias even without a real given name.
Choose your language. Set up your API key, then run the example on your server.
Every prediction request is a new billable operation, including retries. These examples do not automatically retry. Check billing status before sending another request.
Before you run: access and error handling
Run these examples on your server. Set GENDERAPI_API_KEY in the process environment to your existing API key. Confirm meta.access.mode is api_key: an unrecognized key can fall back to the IP trial.
HTTP 4xx and 5xx JSON responses preserve the error body and return a nonzero exit status. Check code, action and meta.usage.billing_status before retrying.
Error and retry guide →cURL 7.76+ in a POSIX shell. Run in your terminal. Runtime documentation
Node.js 22+; built-in fetch. Save as example.mjs and run node example.mjs. Runtime documentation
Python 3.10+; standard library. Save as example.py and run python3 example.py. Runtime documentation
PHP 8+ with the cURL extension. Save as example.php and run php example.php. Runtime documentation
Java 17+; standard HTTP client. Save as GenderApiExample.java and run java GenderApiExample.java. Runtime documentation
.NET 8+ console application. Use as Program.cs in a console project, then run dotnet run. Runtime documentation
Go 1.22+; standard library. Save as main.go and run go run main.go. Runtime documentation
Example response
This is a real response captured on 1 October 2026 with an API key; only the account balance is replaced. It is not a measure of accuracy, and a live request can return a different result. API-key requests report meta.access.mode: api_key and null trial-only quota fields; IP-trial requests report ip_trial. Read data for the inference and meta.usage for the operation's billing outcome.
{
"data": {
"input": {
"type": "email",
"value": "alice.smith@example.com",
"country": "US"
},
"name": "alice",
"gender": "female",
"country": "US",
"confidence": 0.9932550587059705,
"confidence_kind": "observed_frequency",
"sample_count": 4003,
"source": "dataset",
"result_status": "identified",
"reason": null,
"country_source": "dataset",
"match": {
"name": "alice",
"method": "token",
"scope": "country",
"country": "US"
}
},
"meta": {
"request_id": "7c22993d-454f-4f61-8b4b-d1154d3b89ff",
"duration_ms": 13,
"access": {
"mode": "api_key",
"reason": null
},
"usage": {
"charged_credits": 1,
"remaining_credits": 49999,
"billing_status": "confirmed",
"resets_at": null,
"limit": null,
"period_seconds": null
}
}
}Prediction response fields
| Field | Type | Nullable | Example | Description |
|---|---|---|---|---|
data.input | object | No | {"type":"name","value":"James","country":"US"} | Input type, value and country. forceToGenderize is included when true. |
data.name | string | Yes | "james" | Matched or extracted given name; null when none is available. |
data.gender | string | Yes | "male" | male, female or JSON null. An inference, not verified personal identity. |
data.result_status | string | No | "identified" | identified when a gender is returned; unknown otherwise. |
data.reason | string | Yes | null | Null for identified results. Unknown reasons: not_found, no_name_candidate, ambiguous or insufficient_evidence. |
data.confidence | number | Yes | 0.95 | 0–1 score or null. Null gender has null confidence. |
data.confidence_kind | string | Yes | "observed_frequency" | observed_frequency: dominant dataset count / total. model_reported: AI score, not a calibrated probability. Null when unavailable. |
data.sample_count | integer | Yes | 1200 | Dataset sample size or null. AI does not invent a sample count. |
data.source | string | No | "dataset" | dataset, ai or none. |
data.country | string | Yes | "US" | Country association from dataset or ai_association, or null. Does not establish nationality, residence or ethnicity. |
data.country_source | string | Yes | "dataset" | Origin of the country association: dataset, ai_association or null. |
data.match | object | No | {"name":"james","method":"normalized","scope":"country","country":"US"} | Matched dataset name, method (normalized, token, substring or model_inference), country/global scope and matched country. Unavailable evidence is null. |
Access, billing and request metadata
| Field | Type | Nullable | Example | Description |
|---|---|---|---|---|
meta.request_id | string | No | "550e8400-e29b-41d4-a716-446655440000" | Unique identifier for this HTTP attempt; also sent in X-Request-ID. |
meta.duration_ms | integer | No | 42 | Request processing time in milliseconds. |
meta.access.mode | string | No | "api_key" | api_key, ip_trial or unauthenticated. Verify api_key when using a paid account. |
meta.access.reason | string | Yes | null | Trial fallback reason: api_key_missing, api_key_invalid or api_key_not_found; null otherwise. |
meta.usage.charged_credits | integer | Yes | 1 | Net credits charged. Zero before charging or after a full confirmed refund; null when billing is unconfirmed. |
meta.usage.remaining_credits | integer | Yes | 99 | Balance when the operation completes. May be negative; null when unavailable or billing is unconfirmed. |
meta.usage.billing_status | string | No | "confirmed" | not_charged, confirmed or unconfirmed. Check this before retrying a failed prediction. |
meta.usage.resets_at | string | Yes | "2026-09-27T12:00:00.000Z" | IP trial reset time in UTC (ISO 8601); null for API-key accounts or when unknown. |
meta.usage.limit | integer | Yes | 10 | IP trial allowance; null for API-key accounts. |
meta.usage.period_seconds | integer | Yes | 86400 | IP trial window in seconds; null for API-key accounts. |
Email validation and name signals
The value must be a syntactically valid email address. Invalid syntax returns HTTP 422 before billing. Syntax validation does not establish that the mailbox exists or belongs to a particular person.
A recognizable personal name in the address may match the dataset. Shared mailboxes, role addresses and opaque local parts can return gender: null. By default, an unresolved single lookup uses ordinary AI fallback for 1 credit total, including a successful unknown result.
Use forceToGenderize: true if you want nickname-aware AI inference when the dataset is unresolved. This costs 1 credit for a resolved dataset result or 2 total if AI is used. The API may still return null. The email domain is not proof of the person's location; supply a country only when relevant context is known.