REST API Reference
A few endpoints, one response shape. Everything below is live against your account.
https://namegender.com/api/v1/gender
Sign up free
Markdown for coding assistants such as Claude Code, Cursor and Copilot. Paste it into the chat, or give the assistant the link.
Quick start
Create a key in your dashboard, then send your first request. No SDK needed.
curl "https://namegender.com/api/v1/gender?name=Ay%C5%9Fe&country=TR" \
-H "Authorization: Bearer YOUR_API_KEY"
<?php
$query = http_build_query(['name' => 'Ayşe', 'country' => 'TR']);
$ch = curl_init('https://namegender.com/api/v1/gender?' . $query);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$result = json_decode(curl_exec($ch), true);
echo $result['gender']; // female
echo $result['probability']; // 100
const params = new URLSearchParams({ name: 'Ayşe', country: 'TR' });
const response = await fetch(`https://namegender.com/api/v1/gender?${params}`, {
headers: { Authorization: 'Bearer YOUR_API_KEY' },
});
const result = await response.json();
console.log(result.gender); // "female"
console.log(result.probability); // 100
import requests
response = requests.get(
"https://namegender.com/api/v1/gender",
params={"name": "Ayşe", "country": "TR"},
headers={"Authorization": "Bearer YOUR_API_KEY"},
)
result = response.json()
print(result["gender"]) # female
print(result["probability"]) # 100
require "net/http"
require "json"
uri = URI("https://namegender.com/api/v1/gender")
uri.query = URI.encode_www_form(name: "Ayşe", country: "TR")
request = Net::HTTP::Get.new(uri)
request["Authorization"] = "Bearer YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
puts JSON.parse(response.body)["gender"] # female
req, _ := http.NewRequest("GET", "https://namegender.com/api/v1/gender?name=Ay%C5%9Fe&country=TR", nil)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
var result struct {
Gender string `json:"gender"`
Probability int `json:"probability"`
}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result.Gender) // female
Every endpoint returns the same shape, so you can switch inputs without changing your parsing code.
Authentication
Every request carries your API key in a header. Use Authorization: Bearer by default, or X-Api-Key when your HTTP client reserves the Authorization header for something else. A key placed in the URL is rejected: URLs get copied into proxy logs, analytics tools and browser history.
Authorization: Bearer ng_live_xxxxxxxxxxxx
Copy failed. Select and copy the text.
X-Api-Key: ng_live_xxxxxxxxxxxx
Copy failed. Select and copy the text.
You can restrict a key to specific IP addresses from the dashboard.
Client libraries
Thin wrappers over the REST API. They send your key, build each request and turn error responses into exceptions.
npm install namegender
Copy failed. Select and copy the text.
npm install -g namegender
Copy failed. Select and copy the text.
composer config repositories.namegender composer https://namegender.com/composer
composer require namegender/namegender:^0.4
Copy failed. Select and copy the text.
pip install namegender-client
Copy failed. Select and copy the text.
gem install namegender
Copy failed. Select and copy the text.
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.anpekesen</groupId>
<artifactId>namegender-java</artifactId>
<version>v0.9.0</version>
</dependency>
Copy failed. Select and copy the text.
dotnet add package NameGender --version 0.6.0
Copy failed. Select and copy the text.
go get github.com/anpekesen/namegender-go@v0.7.0
Copy failed. Select and copy the text.
install.packages('namegender')
Copy failed. Select and copy the text.
Install-Module NameGender
Copy failed. Select and copy the text.
cargo add namegender
Copy failed. Select and copy the text.
You do not need one. The API is a handful of plain JSON endpoints; a library saves you an afternoon, not a project. If your language is not listed, the REST reference has copy-paste examples.
View allAI assistants (MCP)
Use NameGender from Claude, Cursor and any other client that supports the Model Context Protocol. Ask the assistant about a list of names and it calls the API for you, with the evidence next to every answer.
claude mcp add namegender -e NAMEGENDER_API_KEY=ng_live_... -- npx -y namegender-mcp
Copy failed. Select and copy the text.
{
"mcpServers": {
"namegender": {
"command": "npx",
"args": [
"-y",
"namegender-mcp"
],
"env": {
"NAMEGENDER_API_KEY": "ng_live_..."
}
}
}
}
Copy failed. Select and copy the text.
Add this to the client's MCP configuration file and restart it.
Tools
gender_from_name- Gender from a first or full name.
gender_from_email- Reads the name in an email address; role addresses such as info@ return unknown.
gender_from_username- Reads the name in a username or handle.
gender_bulk- Up to 100 values in one request, with a match-rate summary.
name_countries- Countries where a name is recorded. Not a claim about origin.
salutation- Opening line of a letter in the letter's language; the neutral form when the gender is not certain.
name_check- Whether a name typed into a form looks real, with the reasons. Never calls a name fake.
age_from_name- Median age and age ranges of the people with a first name in the US, France and Norway.
account_status- Remaining credits and today's free quota.
Each lookup uses credits from the account that owns the key, exactly as a direct API call does. Listed in the official MCP registry as io.github.anpekesen/namegender. npm package · Source
Gender from name
Accepts a first name or a full name. Titles, middle names and surnames are stripped before lookup, so "Dr. Ayşe Yılmaz" and "Ayşe" give the same answer.
| Parameter | Type | Description |
|---|---|---|
name
required
|
string
|
The name to classify. First name or full name. |
country
optional
|
string
|
ISO 3166-1 alpha-2 country code. Alpha-3 (ITA) and country names (Italy, Italia) are also accepted, so a CRM country field can be passed as it is. Improves accuracy for names whose gender differs by region, such as Andrea (male in Italy, female in Germany). |
locale
optional
|
string
|
A language tag such as de-DE or en_US, for example the browser's language. Its region becomes the country when country is not sent. A tag without a region (en, de) sets no country. |
ip
optional
|
string
|
The end user's IP address. Its country is used when neither country nor a regional locale is sent. Not stored. IP geolocation by DB-IP (db-ip.com). |
ai_fallback
optional
|
boolean
|
If the name has no entry in our data, ask a language model for an estimate instead of returning null. Only works once AI lookups are switched on in your settings, and costs no extra credit. |
best_guess
optional
|
boolean
|
Return the leading gender even when the evidence falls short of the confidence threshold. Off by default: a near 50/50 answer that looks definite does more damage than a null. |
curl "https://namegender.com/api/v1/gender?name=Jordan" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"credits_charged": 1,
"credits_remaining": 49999,
"request_id": "req_4b7e0c2d9a1f6358",
"query": "Jordan",
"name": "Jordan",
"first_name": "Jordan",
"middle_name": null,
"last_name": null,
"name_type": "personal",
"gender": "male",
"country": null,
"sample_size": 62240,
"probability": 84,
"took_ms": 1,
"confidence": "high",
"source": "db",
"matched_as": null
}
Gender from email
Extracts the person from the local part of the address, then classifies that. "ayse.yilmaz84@example.com" resolves to Ayşe.
| Parameter | Type | Description |
|---|---|---|
email
required
|
string
|
The email address. Only the part before @ is used. |
country
optional
|
string
|
ISO 3166-1 alpha-2 country code. Alpha-3 (ITA) and country names (Italy, Italia) are also accepted, so a CRM country field can be passed as it is. Improves accuracy for names whose gender differs by region, such as Andrea (male in Italy, female in Germany). |
locale
optional
|
string
|
A language tag such as de-DE or en_US, for example the browser's language. Its region becomes the country when country is not sent. A tag without a region (en, de) sets no country. |
ip
optional
|
string
|
The end user's IP address. Its country is used when neither country nor a regional locale is sent. Not stored. IP geolocation by DB-IP (db-ip.com). |
ai_fallback
optional
|
boolean
|
If the name has no entry in our data, ask a language model for an estimate instead of returning null. Only works once AI lookups are switched on in your settings, and costs no extra credit. |
best_guess
optional
|
boolean
|
Return the leading gender even when the evidence falls short of the confidence threshold. Off by default: a near 50/50 answer that looks definite does more damage than a null. |
best_guess acts on the first name read from the address, not on the address itself. When no first name can be read, there is nothing to force and gender stays null. Keep in mind that a forced answer here sits on top of an extraction that can itself be wrong.
curl "https://namegender.com/api/v1/gender/email?email=ayse.yilmaz84%40example.com" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"credits_charged": 1,
"credits_remaining": 49998,
"query": "ayse.yilmaz84@example.com",
"name": "Ayse",
"gender": "female",
"sample_size": 655,
"probability": 100,
"took_ms": 1,
"confidence": "high",
"source": "db"
}
Gender from username
Handles camelCase, snake_case, trailing digits and leading @ signs. "AyseYilmaz84" resolves to Ayşe.
| Parameter | Type | Description |
|---|---|---|
username
required
|
string
|
The username or handle. A leading @ is ignored. |
country
optional
|
string
|
ISO 3166-1 alpha-2 country code. Alpha-3 (ITA) and country names (Italy, Italia) are also accepted, so a CRM country field can be passed as it is. Improves accuracy for names whose gender differs by region, such as Andrea (male in Italy, female in Germany). |
locale
optional
|
string
|
A language tag such as de-DE or en_US, for example the browser's language. Its region becomes the country when country is not sent. A tag without a region (en, de) sets no country. |
ip
optional
|
string
|
The end user's IP address. Its country is used when neither country nor a regional locale is sent. Not stored. IP geolocation by DB-IP (db-ip.com). |
ai_fallback
optional
|
boolean
|
If the name has no entry in our data, ask a language model for an estimate instead of returning null. Only works once AI lookups are switched on in your settings, and costs no extra credit. |
best_guess
optional
|
boolean
|
Return the leading gender even when the evidence falls short of the confidence threshold. Off by default: a near 50/50 answer that looks definite does more damage than a null. |
curl "https://namegender.com/api/v1/gender/username?username=AyseYilmaz84" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"credits_charged": 1,
"credits_remaining": 49997,
"query": "AyseYilmaz84",
"name": "Ayse",
"gender": "female",
"sample_size": 655,
"probability": 100,
"took_ms": 1,
"confidence": "high",
"source": "db"
}
Bulk request
Send up to 100 names in one request. Use this instead of looping: one bulk call for 100 names is a single round trip and a single deduplicated lookup.
| Parameter | Type | Description |
|---|---|---|
names
required
|
string[]
|
Array of names. Maximum 100 items. |
type
optional
|
string
|
What the items are: name, email or username. Defaults to name. |
country
optional
|
string
|
Applied to every item in the request. |
locale
optional
|
string
|
Language tag whose region becomes the country for every item when country is not sent. |
ip
optional
|
string
|
End user IP address whose country is used for every item when neither country nor a regional locale is sent. Not stored. IP geolocation by DB-IP (db-ip.com). |
curl -X POST "https://namegender.com/api/v1/gender/bulk" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"names": ["Ayşe", "Mehmet", "Priya", "Wei"]}'
<?php
$ch = curl_init('https://namegender.com/api/v1/gender/bulk');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'names' => ['Ayşe', 'Mehmet', 'Priya', 'Wei'],
]),
]);
$data = json_decode(curl_exec($ch), true);
foreach ($data['results'] as $row) {
printf("%-8s %-7s %d%%\n", $row['query'], $row['gender'] ?? '?', $row['probability']);
}
const response = await fetch('https://namegender.com/api/v1/gender/bulk', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ names: ['Ayşe', 'Mehmet', 'Priya', 'Wei'] }),
});
const { results, summary } = await response.json();
console.log(summary.match_rate); // 100
results.forEach(r => console.log(r.query, r.gender, r.probability));
import requests
response = requests.post(
"https://namegender.com/api/v1/gender/bulk",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"names": ["Ayşe", "Mehmet", "Priya", "Wei"]},
)
data = response.json()
print(data["summary"]["match_rate"]) # 100
for row in data["results"]:
print(row["query"], row["gender"], row["probability"])
{
"credits_charged": 4,
"credits_remaining": 49995,
"request_id": "req_71d0a9e3c5b24f86",
"took_ms": 2,
"summary": {
"total": 4,
"identified": 4,
"unknown": 0,
"match_rate": 100
},
"results": [
{ "query": "Ayşe", "gender": "female", "probability": 100, "sample_size": 655, "confidence": "high", "source": "db" },
{ "query": "Mehmet", "gender": "male", "probability": 100, "sample_size": 1130, "confidence": "high", "source": "db" },
{ "query": "Priya", "gender": "female", "probability": 100, "sample_size": 2993, "confidence": "high", "source": "db" },
{ "query": "Wei", "gender": "male", "probability": 86, "sample_size": 136, "confidence": "high", "source": "db" }
]
}
Results come back in the same order you sent them. Credits are charged per name, and the whole request is rejected before any work if your balance is short, so you never get a half-processed batch.
The summary block tells you the match rate at a glance, so you can decide whether the input needs cleaning before you process the rest.
File jobs
Upload a CSV or XLSX file of up to 100 MB and 1,000,000 rows and get it back with gender columns added to every row. One credit per row that has a name (rows with an empty name cell are free), charged only if the job completes.
-
1.
POST /batchesSend the file and name_column. The job is queued at once. -
2.
GET /batches/{id}Read the job until status is completed or failed. poll_after_seconds says how long to wait between reads. -
3.
GET /batches/{id}/resultDownload the result. It comes back in the format you uploaded.
| Parameter | Type | Description |
|---|---|---|
file
required
|
file
|
CSV, TSV or XLSX with a header row. |
name_column
required
|
string
|
Header of the column holding the names, exactly as in the file. Required unless start=false. |
country_column
optional
|
string
|
Header of a column holding a country code per row. |
country
optional
|
string
|
Default country for rows without one. |
ai_fallback
optional
|
boolean
|
Ask an AI model for names not in the dataset. Requires AI consent in Settings. |
best_guess
optional
|
boolean
|
Return the more likely gender even when the evidence is weak. |
delete_after_download
optional
|
boolean
|
The result can be downloaded once, then it is deleted. |
start
optional
|
boolean
|
false: upload and inspect only. Defaults to true. |
# 1. Upload and start
curl -X POST "https://namegender.com/api/v1/batches" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Idempotency-Key: 6f1c2e0a-customers-2026-09" \
-F "file=@customers.csv" \
-F "name_column=first_name" \
-F "country_column=country"
# 2. Poll until status is completed or failed
curl "https://namegender.com/api/v1/batches/B-7K2M9QX4TA" \
-H "Authorization: Bearer YOUR_API_KEY"
# 3. Download the result
curl "https://namegender.com/api/v1/batches/B-7K2M9QX4TA/result" \
-H "Authorization: Bearer YOUR_API_KEY" \
-o customers-gender.csv
import { NameGender } from 'namegender';
import { openAsBlob } from 'node:fs';
import { writeFile } from 'node:fs/promises';
const client = new NameGender(process.env.NAMEGENDER_API_KEY);
const job = await client.batches.create(await openAsBlob('customers.csv'), {
filename: 'customers.csv',
name_column: 'first_name',
country_column: 'country',
});
const done = await client.batches.wait(job.id);
if (done.status === 'failed') throw new Error(done.error.code);
const file = await client.batches.download(done.id);
await writeFile('customers-gender.csv', Buffer.from(await file.arrayBuffer()));
from namegender import NameGender
client = NameGender("YOUR_API_KEY")
job = client.batches.create("customers.csv", name_column="first_name", country_column="country")
done = client.batches.wait(job["id"])
if done["status"] == "failed":
raise RuntimeError(done["error"]["code"])
client.batches.download(done["id"], "customers-gender.csv")
{
"id": "B-7K2M9QX4TA",
"status": "completed",
"source": "api",
"file": { "name": "customers.csv", "format": "csv" },
"columns": { "name": "first_name", "country": "country" },
"rows": { "total": 200000, "processed": 200000, "identified": 187412 },
"progress": 100,
"credits": { "reserved": 200000, "charged": 200000 },
"summary": { "male": 96120, "female": 91292, "unknown": 12588, "from_llm": 0 },
"error": null,
"result": {
"url": "https://namegender.com/api/v1/batches/B-7K2M9QX4TA/result",
"format": "csv",
"expires_at": "2026-10-01T10:04:12Z"
},
"poll_after_seconds": null
}
name_column is required to start: a guessed column that turns out to be wrong would spend credits on the wrong data. Send start=false to get the columns, a preview and the cost first, then start the job.
Send an Idempotency-Key header. A retry with the same key returns the first job instead of opening a second one.
Up to 3 jobs can be queued or running at once. A job that has not started can be cancelled and its credit is returned; a job being processed cannot be stopped.
Webhooks
Add an endpoint under Webhooks in your dashboard and we send it a signed POST when a file job completes or fails, so you do not have to poll.
| Event | Type | Description |
|---|---|---|
batch.completed
|
BatchJob
|
The job finished. The body carries the job exactly as GET /batches/{id} returns it. |
batch.failed
|
BatchJob
|
The job failed and was not charged. Branch on error.code. |
credits.low
|
CreditsAlert
|
At the current rate, credits last 7 days or less. Checked hourly; subscription renewals are taken into account. |
credits.depleted
|
CreditsAlert
|
The balance is empty and requests are refused with 402. Checked hourly. |
webhook.test
|
object
|
Sent only by "Send test event" in the dashboard, only to that endpoint. |
| Header | Type | Description |
|---|---|---|
NameGender-Signature
required
|
string
|
t=<unix seconds>,v1=<hex>. A second v1 appears for 24 hours after you rotate the secret. |
NameGender-Event-Id
required
|
string
|
The event id. The same on every retry of the same event. |
NameGender-Delivery-Attempt
required
|
integer
|
1 on the first try, up to 8. |
Verify every request
v1 is HMAC-SHA256 of the timestamp, a dot and the raw body, keyed with your endpoint secret. Compare in constant time, accept the request if any v1 matches, and reject a timestamp more than five minutes from your clock. The client libraries do all of this in one call.
import express from 'express';
import { webhooks, NameGenderWebhookError } from 'namegender';
const app = express();
// express.raw, not express.json: the signature covers the exact bytes.
app.post('/namegender', express.raw({ type: 'application/json' }), async (req, res) => {
let event;
try {
event = await webhooks.verify(
req.body,
req.get('NameGender-Signature'),
process.env.NAMEGENDER_WEBHOOK_SECRET,
);
} catch (error) {
if (error instanceof NameGenderWebhookError) return res.sendStatus(400);
throw error;
}
res.sendStatus(204); // answer first, then do the work
if (event.type === 'batch.completed') {
const job = event.data.object; // same object as GET /batches/{id}
}
});
import os
from flask import Flask, request
from namegender import webhooks, WebhookVerificationError
app = Flask(__name__)
@app.post("/namegender")
def namegender_webhook():
try:
event = webhooks.verify(
request.get_data(), # raw bytes, not request.json
request.headers.get("NameGender-Signature"),
os.environ["NAMEGENDER_WEBHOOK_SECRET"],
)
except WebhookVerificationError:
return "", 400
if event["type"] == "batch.completed":
job = event["data"]["object"] # same object as GET /batches/{id}
return "", 204
<?php
$body = file_get_contents('php://input'); // raw body, before json_decode
$header = $_SERVER['HTTP_NAMEGENDER_SIGNATURE'] ?? '';
$secret = getenv('NAMEGENDER_WEBHOOK_SECRET');
parse_str(str_replace(',', '&', $header), $parts); // t=…&v1=…
preg_match_all('/v1=([0-9a-f]{64})/', $header, $m);
$t = (int) ($parts['t'] ?? 0);
$expected = hash_hmac('sha256', $t . '.' . $body, $secret);
$valid = abs(time() - $t) <= 300
&& array_filter($m[1], fn ($sig) => hash_equals($expected, $sig));
if (! $valid) {
http_response_code(400);
exit;
}
http_response_code(204);
$event = json_decode($body, true);
{
"id": "evt_16f7c01502fda5436e8b7c4e",
"type": "batch.completed",
"created_at": "2026-09-24T10:04:12Z",
"api_version": "v1",
"data": {
"object": {
"id": "B-7K2M9QX4TA",
"status": "completed",
"rows": { "total": 200000, "processed": 200000, "identified": 187412 },
"credits": { "reserved": 200000, "charged": 200000 },
"result": { "url": "…/api/v1/batches/B-7K2M9QX4TA/result", "format": "csv" }
}
}
}
- Answer with any 2xx within 10 seconds, then do the work.
- Anything else, a redirect included, is retried up to 7 times over about 45 hours. If an endpoint keeps failing for three days it is turned off and you are emailed.
- A retry carries the same event id and order is not guaranteed. Deduplicate on NameGender-Event-Id, and read the job with GET when you need its current state.
- Rotating the secret in the dashboard keeps the old one signing for 24 hours, so you can update your server without missing an event.
- New event types can be added. Answer 2xx to a type you do not handle and ignore it.
Country distribution
Returns the countries a name is recorded in. Two lists come back and they are deliberately not merged: `registrations` is measured volume, comparable only among the eleven countries that publish counted name statistics, and `attested_in` is presence, with no weight attached.
| Parameter | Type | Description |
|---|---|---|
name
required
|
string
|
The name to look up. |
limit
optional
|
integer
|
How many counted countries to list in `registrations`. 1–100, default 25. Shares are not recalculated for the shorter list. |
curl "https://namegender.com/api/v1/gender/countries?name=Mehmet" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"credits_charged": 1,
"credits_remaining": 49994,
"took_ms": 3,
"name": "Mehmet",
"basis": {
"counted_sources": ["ssa", "ons", "nrs", "nisra", "insee", "statcan", "ine", "cso", "ssb", "statat", "pesel", "bfs"],
"counted_countries": 8,
"attested_countries": 16,
"note": "Shares are calculated only across countries that publish counted name statistics…"
},
"registrations": [
{ "country": "CH", "count": 3890, "share": 29.45, "gender": "male", "source": "bfs" },
{ "country": "FR", "count": 3775, "share": 28.58, "gender": "male", "source": "insee" },
{ "country": "PL", "count": 1808, "share": 13.69, "gender": "male", "source": "pesel" }
],
"attested_in": ["AL","AT","AU","BE","CA","CH","ES","FR","GB","KS","MK","NO","PL","SE","TR","US"]
}
One credit per request. `share` is calculated across every counting country, so it sums to 100 only when `limit` does not cut the list; `counted_countries` also counts before the cut. `attested_in` carries no percentages because there is no count behind those records to compute one from.
Salutation
Turns a name into a salutation ready for a letter or email, in ten languages: “Sehr geehrte Frau Dr. Müller,”, “Sayın Ahmet Bey,”, “Madame,”, “山田様”. The gender lookup is included and costs the same one credit. Each response has a formal, an informal and a neutral line, plus the pieces of the formal line.
| Parameter | Type | Description |
|---|---|---|
name
required
|
string
|
Full name, titles included (“Dr. Anna Müller”). Send this or `first_name` and `last_name`. |
first_name, last_name
optional
|
string
|
Use these instead of `name` when your CRM keeps names in separate fields. Nothing is parsed. |
email
optional
|
string
|
Email address, used when no name is sent. The name is read from the part before the @, without accents (Mueller, not Müller); info@ and other role addresses get the form for organisations. |
language
optional
|
string
|
Language of the salutation: en, en-US, en-GB, de, de-AT, de-CH, fr, es, it, pt, pt-PT, pt-BR, nl, tr, pl, ja. Without it: the language of `locale`, then the main language of the country, then English. An unsupported language is an error, never a silent switch to English. |
country, locale, ip
optional
|
string
|
Country hint for the gender lookup, as on the gender endpoints. It picks the language only when `language` is not sent. |
gender
optional
|
string
|
`male`, `female` or `neutral`, when you already know it. Overrides the lookup; `neutral` always gives the neutral form. |
min_probability
optional
|
integer
|
Lowest probability for a gendered salutation, 50–100. Default 90. |
title
optional
|
string
|
Academic title kept in a separate field, such as `Dr.` Used in German and English salutations. |
curl -X POST "https://namegender.com/api/v1/salutation" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Dr. Anna Müller", "language": "de"}'
{
"credits_charged": 1,
"credits_remaining": 49993,
"language": "de",
"form": "gendered",
"reason": null,
"salutation": {
"formal": "Sehr geehrte Frau Dr. Müller,",
"informal": "Liebe Anna,",
"neutral": "Guten Tag Dr. Anna Müller,"
},
"parts": { "opening": "Sehr geehrte", "courtesy": "Frau", "academic": "Dr.", "name": "Müller" },
"gender": "female",
"gender_source": "lookup",
"probability": 99,
"first_name": "Anna",
"last_name": "Müller",
"name_type": "personal"
}
A wrong gender is worse than none, so the gendered form is used only when the gender is known with at least `min_probability` and the language has the name part it needs. Otherwise `form` is `neutral` and `reason` says why. Companies and role addresses get `form: organization`. `best_guess` and `ai_fallback` do not apply here.
POST /api/v1/salutation/bulk takes up to 100 names in `names`, one credit each, with the same options applied to every name.
Name check
Says whether a name typed into a sign-up or lead form looks like a real person’s name, and why. It catches keyboard mashing (“asdf qwerty”), placeholders (“Test Test”, “John Doe”, “n/a”), fictional characters (“Mickey Mouse”), profanity, and digits, symbols or email addresses in the name field. One credit per name.
| Parameter | Type | Description |
|---|---|---|
name
required
|
string
|
The name as typed into the form. Send this or `first_name` and `last_name`. |
first_name, last_name
optional
|
string
|
Use these instead of `name` when your form has separate fields. |
country, locale, ip
optional
|
string
|
Country hint, as on the gender endpoints. Helps name parsing and the record lookup. |
curl -X POST "https://namegender.com/api/v1/name-check" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "asdf qwerty"}'
{
"credits_charged": 1,
"credits_remaining": 49992,
"query": "asdf qwerty",
"assessment": "implausible",
"score": 0,
"signals": [
{ "code": "placeholder", "severity": "high", "part": "first_name", "value": "asdf" },
{ "code": "keyboard_pattern", "severity": "high", "part": "first_name", "value": "asdf" },
{ "code": "keyboard_pattern", "severity": "high", "part": "last_name", "value": "qwerty" }
],
"first_name": "Asdf",
"last_name": "Qwerty",
"name_type": "personal",
"evidence": { "first_name_status": "not_found", "first_name_counted_records": 0 }
}
`assessment` is `implausible` when there is a high-severity signal (keyboard pattern, repeated letters, placeholder, profanity, email or URL), `suspicious` with a medium one (fictional character, digits, symbols, company name, no vowels, very long) or two low ones, and `plausible` otherwise. `score` runs from 0 to 100 for your own threshold. A first name found in official birth records raises it; a name we have never seen does not lower it on its own. Surnames are judged by their shape only: there is no surname dataset behind this endpoint.
Tested on 4,610 real first names in nine scripts, alone and paired with a surname: none was marked suspicious or implausible. Surnames such as Null, Test or Cockburn, two-letter names such as Ng and single names are left alone on purpose.
POST /api/v1/name-check/bulk takes up to 100 names in `names`, one credit each, with a summary of the three assessments.
Age from name
How old the living people with a first name are: the median age, the middle half of them (`age_range`) and the middle 80% (`age_range_80`). Brittany in the United States: median 36, half of them between 32 and 38. One credit per name.
| Parameter | Type | Description |
|---|---|---|
name
required
|
string
|
A first name or a full name; the first name is used. |
gender
optional
|
string
|
`male` or `female` to use only that gender’s records. Male Leslies are 16 years older than female ones. |
country, locale, ip
optional
|
string
|
Country hint, as on the gender endpoints. Covered: US, FR and NO. Without a hint the US series is used and `country_source` is `default`. Another country returns `reason: country_not_covered` and costs nothing. |
curl "https://namegender.com/api/v1/age?name=Brittany" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"credits_charged": 1,
"credits_remaining": 49991,
"request_id": "req_8f2c1a",
"name": "Brittany",
"first_name": "Brittany",
"gender": null,
"age": 36,
"age_range": { "low": 32, "high": 38 },
"age_range_80": { "low": 28, "high": 41 },
"birth_year": 1990,
"sample_size": 353775,
"births": 361434,
"country": "US",
"country_source": "default",
"source": "ssa",
"series": "1880-2024",
"reference_year": 2026,
"reason": null
}
Method: registered births by name, sex and year, each year weighted by the share of that birth cohort still alive (SSA cohort life tables). Sources: SSA births 1880–2024 (US), INSEE 1900–2025 (France), SSB 1945–2025 (Norway). `reason` is `not_found` for a name not in the series and `insufficient_data` below 100 living people.
Births abroad are in no series, so names common among immigrants look younger than they are. Norway’s series starts in 1945, so people born earlier are missing. The US life table is used for France and Norway too.
POST /api/v1/age/bulk takes up to 100 names in `names`, one credit each, in the order sent.
Balance
Read your credit balance and what is left of today's free allowance. This call is not charged.
curl "https://namegender.com/api/v1/me" \
-H "Authorization: Bearer YOUR_API_KEY"
{
"email": "you@example.com",
"credits_remaining": 50099,
"purchased_credits": 50000,
"free_today": 99,
"free_daily_limit": 100,
"lifetime_requests": 12480
}
Non-Latin scripts
Send a name in its own script and we bridge it to the reference data. No extra parameter: we detect the script and pick the right strategy for it.
Arabic writing omits short vowels, so محمد transliterates to "mhmd" while our data holds "muhammed". We match on the consonant pattern instead, and keep the feminine ة marker so خالد (Khalid) and خالدة (Khalida) stay apart. Also covers Persian and Urdu names written in Arabic script.
Converted to Pinyin. The surname comes first in Chinese, so 李明 is surnamed 李 (Li) with the given name 明 (Ming) — we strip the surname before looking up. A single character is a complete given name and is handled as one.
Same surname-first handling as Chinese, using the common Korean surnames.
Hiragana and katakana are read correctly (ひろし → Hiroshi).
Russian, Ukrainian, Bulgarian and Serbian names transliterate directly.
Hindi, Marathi and Nepali names. The inherent trailing vowel is handled (राहुल → Rahul, not "Rahula").
Japanese kanji and Chinese characters occupy the same Unicode range, so we cannot tell them apart from the characters alone. Han input is read as Chinese: a kanji name we do not already hold verbatim gets its Mandarin reading, which for a Japanese name is usually wrong (健太 reads as "jian tai" when the name is Kenta). Names we do hold match exactly and are correct. Send Japanese names in kana or Latin to be sure.
Thai omits vowels much like Arabic and needs its own matching layer. Not built yet, so these return null.
# Arap yazısı — ünsüz iskeleti üzerinden eşleşir
curl "https://namegender.com/api/v1/gender?name=%D9%85%D8%AD%D9%85%D8%AF" -H "Authorization: Bearer KEY"
# -> { "gender": "male", "probability": 100, "source": "script", "matched_as": "mahamad" }
# Çince — soyadı ayıklanır, verilen ad sorgulanır
curl "https://namegender.com/api/v1/gender?name=%E6%9D%8E%E6%98%8E" -H "Authorization: Bearer KEY"
# -> { "gender": "male", "probability": 92, "source": "db" }
Copy failed. Select and copy the text.
When we cannot bridge a script at all, the response is gender: null with source: none. Check the source field: script means we transliterated, db means we matched the characters you sent directly. The two carry different confidence, and we show you which one you got.
Response fields
Identical across all endpoints.
| Field | Type | Description |
|---|---|---|
credits_charged
|
integer
|
How many credits were deducted for this call. |
credits_remaining
|
integer
|
Your spendable balance once this call is paid for: purchased credits plus what remains of today's free allowance. |
query
|
string
|
The input exactly as you sent it, before any cleaning. |
name
|
string
|
The name we actually looked up after stripping titles and surnames. |
first_name
|
string
|
Given name parsed from the input. Returned even when gender is null, at no extra cost. |
middle_name
|
string
|
Further given names between the first name and the surname. Initials are dropped. |
last_name
|
string
|
Surname, including particles such as van or de la. Always null for usernames. |
name_type
|
string
|
personal, organization (Acme LLC) or role (info@, Customer Service). Organizations and roles get no gender. |
gender
|
string
|
male, female, or null when we are not confident enough to say. |
country
|
string
|
The country the statistics came from, or null for the global aggregate. |
country_source
|
string
|
Where the country came from: country, locale, ip, or null when the answer is worldwide. |
sample_size
|
integer
|
Number of recorded people behind this answer. 0 means the source publishes proportions or attestations, not a count we can audit. |
probability
|
integer
|
Observed dominant-gender ratio for counted data. Uncounted data is capped below 100; 0 when gender is null. |
took_ms
|
integer
|
Time we spent resolving the lookup, in whole milliseconds. Network time on your side is not included. |
Evidence fields other services do not give you
confidence distinguishes counted evidence from records without a sample size. source tells you where the answer came from, and matched_as names the entry a fuzzy match landed on.
| Field | Type | Description |
|---|---|---|
source
|
string
|
db, script, fuzzy, llm, or none. |
confidence
|
string
|
high, medium, low, unverified, or unknown, based on sample evidence. |
matched_as
|
string
|
For a fuzzy match, the database entry that matched. Otherwise null. |
gender_source
|
string
|
What decided the gender: lookup (the name; see source) or title (a courtesy title in the input, such as Mrs or Herr; matched_as then holds the title). Null when there is no gender. |
Error codes
The HTTP status code tells you a call failed. The JSON body then names the reason in error, explains it in message, and gives you a request_id to quote to support plus a docs link to the matching row below. Branch on error, never on message: messages are translated and may be reworded.
| Code | HTTP | Meaning |
|---|---|---|
missing_key |
401 | No API key was sent. Add an Authorization: Bearer header or an X-Api-Key header to the request. |
invalid_key |
401 | This API key is not valid. |
revoked_key |
401 | This API key has been revoked. |
blocked |
403 | This account has been suspended. Contact support. |
email_not_verified |
403 | This account's email address has not been confirmed yet. Open the confirmation link we emailed you, or request a new one from your dashboard. |
ip_not_allowed |
403 | Requests from this IP address are not allowed for this key. |
proxy_secret_required |
403 | This key only works through its API marketplace, which signs every request. Use the key issued to you there. |
forbidden |
403 | You are not allowed to perform this action. |
no_credits |
402 | You are out of credits. Buy more or wait for your daily free quota to reset. |
missing_input |
400 | The "name" parameter is required. |
invalid_input |
422 | The "name" parameter is not valid. |
too_many_items |
422 | A maximum of 100 items can be sent in one request. |
ai_consent_required |
422 | ai_fallback sends the name to a third-party AI provider, which this account has not agreed to. See the "ai" field for who that provider is, then enable AI lookups in your dashboard settings. |
unknown_endpoint |
404 | There is no endpoint at this path. Check the URL against the API documentation. |
method_not_allowed |
405 | This endpoint does not accept DELETE requests. |
payload_too_large |
413 | That request body is too large. |
rate_limited |
429 | Too many requests. Slow down and try again shortly. |
batch_not_found |
404 | There is no file job with this ID on this account. |
batch_not_startable |
409 | This job has already been started or closed. |
batch_not_finished |
409 | This job has not finished yet. Check its status and download the result once it is completed. |
batch_in_progress |
409 | This job is being processed and cannot be cancelled now. Delete it once it has finished. |
result_gone |
410 | This job has no result to download. It failed, was cancelled, expired, or its single-download result has already been fetched. |
too_many_batches |
429 | You already have 100 file jobs running. Wait for one to finish before starting another. |
not_ready |
503 | The name database is being rebuilt. Try again in a moment. |
server_error |
500 | Something went wrong on our side. We have been notified. |
{
"error": "no_credits",
"message": "You are out of credits. Buy more or wait for your daily free quota to reset.",
"request_id": "req_9c1f5b2a7e0d4a13",
"docs": "https://namegender.com/docs#error-no_credits"
}
Copy failed. Select and copy the text.
Rate limits
Normal usage does not hit a limit. The cap exists to stop a leaked key from being abused, and it counts per API key rather than per IP so that several customers on one server do not consume each other's allowance.
Current limit: 1,200 requests per minute per key. Need more? Ask and we will raise it on your account.
Every response carries the standard X-RateLimit-Limit and X-RateLimit-Remaining headers.
Spaces and non-Latin letters in GET requests
A name such as Ayşe Yılmaz or 中村 cannot travel in a URL as typed. Percent-encode the value when you call with GET, or send it in a JSON body with POST and skip encoding altogether.
Ayşe Yılmaz -> Ay%C5%9Fe%20Y%C4%B1lmaz
محمد -> %D9%85%D8%AD%D9%85%D8%AF
中村 -> %E4%B8%AD%E6%9D%91
Copy failed. Select and copy the text.