Agify.io

AI API · Age prediction from name · Demographic data · No auth

TL;DR

Agify.io predicts a person's age based solely on their first name, using machine learning on public demographic data. Give it "bella" and it'll estimate ~38 years old. The prediction improves with country-specific data — add a country code for finer accuracy. It's part of a trio of prediction APIs (alongside Genderize.io and Nationalize.io) that let you infer demographic information from nothing but a name.

Quick start: https://api.agify.io/?name=bella

No API key needed — just make a request!

How to Use This API

1. Predict Age from Name (Global)

https://api.agify.io/?name=bella

Returns: {"name":"bella","age":38,"count":11234}. The age is the median predicted age. count is the number of data points in the model.

2. Country-Specific Prediction

https://api.agify.io/?name=john&country_id=US

Add country code (ISO 3166-1 alpha-2) for localized predictions. John averages different ages in the US vs UK vs Germany.

3. Batch Prediction (Multiple Names)

https://api.agify.io/?name[]=michael&name[]=sarah&name[]=david

Predict multiple names in one request. Returns an array of results.

4. JavaScript — Age Guesser

async function predictAge(name, country = null) {
  const params = new URLSearchParams({ name });
  if (country) params.set('country_id', country);
  
  const resp = await fetch('https://api.agify.io/?' + params);
  return resp.json();
}

// Predict ages for a group
const names = ['alice', 'bob', 'charlie', 'diana'];
Promise.all(names.map(n => predictAge(n)))
  .then(results => {
    results.forEach(r =>
      console.log(`${r.name}: ~${r.age} years old (n=${r.count})`)
    );
  });

5. Python — Age Distribution View

import requests

def age_for_name(name, country=None):
    params = {'name': name}
    if country:
        params['country_id'] = country
    resp = requests.get('https://api.agify.io/', params=params)
    return resp.json()

# Compare across countries
for country in ['US', 'GB', 'DE', 'FR']:
    data = age_for_name('james', country)
    print(f"James in {country}: ~{data['age']} "
          f"(based on {data['count']} records)")

# Batch request
batch = requests.get(
    'https://api.agify.io/',
    params={'name[]': ['olivia', 'liam', 'noah', 'emma']}
).json()
for r in batch:
    print(f"{r['name']}: ~{r['age']}")
Try predicting "bella": https://api.agify.io/?name=bella

Frequently Asked Questions

How does Agify.io predict age from a name?
It uses public census and social security data to calculate the median age of people with that name. The model correlates name popularity with birth years — names popular in different decades map to different age groups.
How accurate is the prediction?
Accuracy varies by name popularity. Common names like "John" or "Mary" have hundreds of thousands of data points and are quite accurate. Rare names may have fewer points and higher variance.
Does country filtering improve accuracy?
Yes! The US has the most data, but many other countries (GB, DE, FR, IT, ES, NL, etc.) also have solid coverage. Names can have very different age distributions across cultures.
What's the maximum batch size?
You can send up to 10 names in a single batch request using name[] array syntax. For more, use multiple requests.
Are there rate limits?
Agify.io has generous but undocumented rate limits. For high-volume usage, the site offers a paid API plan. Free tier works great for personal projects and moderate usage.
Can I use this for commercial applications?
Yes, the free tier allows commercial use. For high-traffic applications (>1000 requests/day), consider supporting the service with a paid plan or self-hosting the open-source model.

API Details

API URL
https://api.agify.io
Documentation
agify.io
Category
AI
Authentication
Not Required
Geographic Coverage
Global — best coverage for US and European names

What You Can Build