Nationalize.io

AI API · Nationality prediction from name · Country probabilities · No auth

TL;DR

Nationalize.io predicts the likely nationality of a person based on their first name. Unlike simple country-name databases, it returns a probability-weighted list of countries — so you can see that "Smith" probably comes from the US, UK, or Australia, while "Müller" points strongly to Germany. It draws from global demographic data and completes the name-demographic trifecta with Agify.io and Genderize.io.

Quick start: https://api.nationalize.io/?name=smith

No API key needed — just make a request!

How to Use This API

1. Predict Nationality for "Smith"

https://api.nationalize.io/?name=smith

Returns: {"name":"smith","country":[{"country_id":"US","probability":0.43},{"country_id":"GB","probability":0.31},{"country_id":"AU","probability":0.08}]}

2. Check a Culturally Specific Name

https://api.nationalize.io/?name=hiroshi

"Hiroshi" should return Japan (JP) as the top result with high probability.

3. Batch Multiple Names

https://api.nationalize.io/?name[]=mohammed&name[]=vladimir

Compare the geographic distributions for culturally distinct names.

4. JavaScript — Nationality Breakdown

async function predictNationality(name) {
  const resp = await fetch(
    `https://api.nationalize.io/?name=${encodeURIComponent(name)}`
  );
  const data = await resp.json();
  return data.country.map(c => ({
    country: c.country_id,
    probability: c.probability
  }));
}

predictNationality('mohammed').then(countries => {
  console.log('Top likely countries:');
  countries.slice(0, 3).forEach(c => {
    const pct = (c.probability * 100).toFixed(1);
    console.log(`  ${c.country}: ${pct}%`);
  });
});

5. Python — Combined Demographic Profile

import requests

def name_profile(first_name):
    """Get age, gender, and nationality from a single name."""
    # Fire all three APIs in parallel
    import asyncio
    
    agify = requests.get(
        'https://api.agify.io/',
        params={'name': first_name}
    ).json()
    genderize = requests.get(
        'https://api.genderize.io/',
        params={'name': first_name}
    ).json()
    nationalize = requests.get(
        'https://api.nationalize.io/',
        params={'name': first_name}
    ).json()
    
    profile = {
        'name': first_name,
        'estimated_age': agify.get('age'),
        'gender': genderize.get('gender'),
        'gender_probability': genderize.get('probability'),
        'top_countries': [
            f"{c['country_id']} ({c['probability']:.0%})"
            for c in nationalize.get('country', [])[:3]
        ]
    }
    return profile

# Profile a few names
for name in ['sarah', 'mohammed', 'wei']:
    p = name_profile(name)
    print(f"{p['name']}: ~{p['estimated_age']}yo, "
          f"{p['gender']} ({p['top_countries']})")
Try "smith": https://api.nationalize.io/?name=smith

Frequently Asked Questions

How does Nationalize.io determine nationality from a name?
It analyzes the frequency distribution of names across countries using public data sources. A name appearing mostly in US records gets a higher US probability. The model includes hundreds of millions of records.
What countries are covered?
Dozens of countries are included with reliable data: US, GB, DE, FR, IT, ES, PT, NL, BE, CH, AT, SE, NO, DK, FI, PL, RU, JP, CN, KR, IN, BR, MX, AR, AU, NZ, and many more.
Why do I get multiple countries?
Names spread across countries through migration, cultural exchange, and historical ties. "Smith" appears in the US, UK, Australia, Canada, etc. The probabilities reflect the global distribution.
How accurate is the top prediction?
Accuracy depends on how name-specific a country is. "Hiroshi" → Japan is very accurate (95%+). "Alex" → ? could be many countries (lower top probability). The probability values quantify this uncertainty.
Can I use this for fraud detection?
It's better suited for demographic enrichment and UX personalization than security applications. The probabilities indicate correlation, not identity verification.
Are there rate limits?
Similar to Agify.io and Genderize.io — approximately 1,000 free requests per day. Batch requests help maximize your limit.

API Details

API URL
https://api.nationalize.io
Documentation
nationalize.io
Category
AI
Authentication
Not Required
Geographic Coverage
Global — covers 50+ countries with reliable data

What You Can Build