Diaspora & ethnicity API – Analyze a name to identify ethnic background
Namsor's Diaspora & Ethnicity API provides detailed insights into a person's likely ethnic background or diaspora affiliation based on their name and a local context such as the country of residence. It supports both separated inputs (first and last name) and full name strings, making it easy to adapt to your existing datasets. This flexibility simplifies integration and speeds up your analysis process.
Whether you're conducting academic research, analyzing demographic trends, or building inclusive digital products, this API helps identify cultural diversity with high precision. It's especially effective in multicultural societies where standard origin detection may fall short. Namsor's name-based ethnicity model is trained on rich, global data—ensuring consistent and accurate results across regions and languages.
600+Research contributions
99.99%Names availability
11B billionsNames processed
Name Diaspora
Diaspora from first name (optional), last name , country code (optional).
{
"script": "LATIN",
"id": "0d7d6417-0bbb-4205-951d-b3473f605b56",
"firstName": "Keith",
"lastName": "Haring",
"score": 8.653234788906794,
"ethnicityAlt": "British",
"ethnicity": "German",
"lifted": false,
"countryIso2": "US",
"ethnicitiesTop": [
"German", "British", "Dutch", "Danish", "Irish", "Norwegian", "Swedish", "Jewish", "NativeHawaiian", "Austrian"
],
"probabilityCalibrated": 0.5197497794419499,
"probabilityAltCalibrated": 0.5197497794419499
}
Name Diaspora analyzes a name to identify the most likely ethnicity or diaspora, with slightly higher accuracy than the Full Name Diaspora feature. Providing both a first and last name, along with a local context (ex: country of residence, country of work, etc.), significantly improves the accuracy. The response includes the most likely ethnicity or diaspora and a ranked list of the top 10, each accompanied by a calibrated probability.

When no value is provided for countryIso2, Name Diaspora uses the United States US as the default local context
- Precision:
- Cost: 20 credits per name.
- Description: Returns the most likely ethnicity or diaspora of up to 100 first names (optional) and last names, according to their country of residence.
- More about: Name Diaspora
HTTP request

https://v2.namsor.com/NamSorAPIv2/api2/json/diasporaBatch
Property | Required | Description |
---|---|---|
X-API-KEY | Required | Your Namsor's services API key |

To get an API key for free, please create an account.
Name | Type | Required | Description |
---|---|---|---|
personalNames | Array of objects | Required | A list of personal names with their country of residence. |
[{...}].id | String | Optional | Unique identifier. |
[{...}].firstName | String | Optional | First name, given name, nickname. |
[{...}].lastName | String | Required | Last name, family name, surname. |
[{...}].countryIso2 | String | Optional | Country of residence, in ISO 3166-1 alpha-2 format. "US" by default (if no value indicated). |
Name | Type | Description | Enumerators |
---|---|---|---|
personalNames | Array of objects | List of submitted names with their ethnicities. | |
[{...}].script | String | Name of the script used for the name, in ISO 15924 format. | Script |
[{...}].id | String | Provided unique identifier. | |
[{...}].firstName | String | Submitted first name. | |
[{...}].lastName | String | Submitted last name. | |
[{...}].score | Number | Higher implies a more reliable result, score is not normalized. | |
[{...}].ethnicityAlt | String | Second most likely ethnicity. | Ethnicities or diasporas |
[{...}].ethnicity | String | Most likely ethnicity. | Ethnicities or diasporas |
[{...}].lifted | Boolean | Indicates if the output ethnicity is based on machine learning only, or further lifted as a known fact by a country-specific rule. | |
[{...}].countryIso2 | String | Submitted country of residence, in ISO 3166-1 alpha-2 format. | Country of residence |
[{...}].ethnicitiesTop | Array | Top 10 most likely ethnicities, ordered from most likely to least likely. | Ethnicities or diasporas |
[{...}].probabilityCalibrated | Number | The calibrated probability that ethnicity has been guessed correctly. -1 = still calibrating . | |
[{...}].probabilityAltCalibrated | Number | The calibrated probability that ethnicity OR ethnicityAlt have been guessed correctly. -1 = still calibrating . | |
Optional: X-OPTION-RELIGION-STATS = True | |||
[{...}].religionStats | Array of objects | Religious statistics in the country of origin of the most likely diaspora. Returned only if the religious statistics option is enabled (X-OPTION-RELIGION-STATS: True). | |
[{...}].religion | String | Religion within country of origin of most likely diaspora (ethnicity). | Religions |
[{...}].pct | Number | Percentage of the population practicing this religion in the country of origin of the most likely diaspora (ethnicity). | |
[{...}].religionStatsAlt | Array of objects | Religious statistics in the country of origin of the second most likely diaspora. Returned only if the religious statistics option is enabled (X-OPTION-RELIGION-STATS: True). | |
[{...}].religion | String | Religion within country of origin of second most likely diaspora (ethnicityAlt). | Religions |
[{...}].pct | Number | Percentage of the population practicing this religion in the country of origin of the second most likely diaspora (ethnicityAlt). |
Code sample:
Name Diaspora code sample for shell:
curl --request POST \
--url https://v2.namsor.com/NamSorAPIv2/api2/json/diasporaBatch \
--header 'X-API-KEY: your-api-key' \
--header 'Accept: application/json'
--header 'Content-Type: application/json' \
--data '{"personalNames":[{"id":"0d7d6417-0bbb-4205-951d-b3473f605b56","firstName":"Keith","lastName":"Haring","countryIso2":"US"}]}'
Body parameter:
{
"personalNames": [
{
"id": "0d7d6417-0bbb-4205-951d-b3473f605b56",
"firstName": "Keith",
"lastName": "Haring",
"countryIso2": "US"
}
]
}
The above command returns JSON structured like this:
{
"personalNames": [
{
"script": "LATIN",
"id": "0d7d6417-0bbb-4205-951d-b3473f605b56",
"firstName": "Keith",
"lastName": "Haring",
"score": 8.653234788906794,
"ethnicityAlt": "British",
"ethnicity": "German",
"lifted": false,
"countryIso2": "US",
"ethnicitiesTop": ["German", "British", "Dutch", "Danish", "Irish", "Norwegian", "Swedish", "Jewish", "NativeHawaiian", "Austrian"],
"probabilityCalibrated": 0.5197497794419499,
"probabilityAltCalibrated": 0.5197497794419499
}
]
}
Values returned only if the religious statistics option is enabled X-OPTION-RELIGION-STATS: True.
{
religionStats: [
{ religion: 'Christian', pct: 68.7 },
{ religion: 'Unaffiliated', pct: 24.7 },
{ religion: 'Muslim', pct: 5.8 },
{ religion: 'Buddhist', pct: 0.3 },
{ religion: 'Jewish', pct: 0.3 },
{ religion: 'Other', pct: 0.1 },
{ religion: 'Folk', pct: 0.05 },
{ religion: 'Hindu', pct: 0.05 },
],
religionStatsAlt: [
{ religion: 'Christian', pct: 68.7 },
{ religion: 'Unaffiliated', pct: 24.7 },
{ religion: 'Muslim', pct: 5.8 },
{ religion: 'Buddhist', pct: 0.3 },
{ religion: 'Jewish', pct: 0.3 },
{ religion: 'Other', pct: 0.1 },
{ religion: 'Folk', pct: 0.05 },
{ religion: 'Hindu', pct: 0.05 },
],
}
Full Name Diaspora
Diaspora from full name , country code .
{
"script": "LATIN",
"id": "0d7d6417-0bbb-4205-951d-b3473f605b56",
"name": "Keith Haring",
"score": 1.9177978014400305,
"ethnicityAlt": "British",
"ethnicity": "German",
"lifted": false,
"countryIso2": "US",
"ethnicitiesTop": [
"German", "British", "Dutch", "Irish", "Norwegian", "Danish", "Swedish", "Swiss", "Austrian", "NativeHawaiian"
],
"probabilityCalibrated": 0.29971840123154375,
"probabilityAltCalibrated": 0.35544175296700403
}
Full Name Diaspora analyzes an unsplit full name (first and last name combined) to determine the most likely ethnicity or diaspora. The response includes the most likely result along with a ranked list of the top 10 ethnicities or diasporas, each accompanied by a calibrated probability.

If the first and last name are clearly identifiable, the Name Diaspora feature will be slightly more accurate.
- Precision:
- Cost: 20 credits per name.
- Description: Returns the most likely ethnicity or diaspora of up to 100 unsplit full names, according to their country of residence.
- More about: Full Name Diaspora
HTTP request

https://v2.namsor.com/NamSorAPIv2/api2/json/diasporaFullBatch
Property | Required | Description |
---|---|---|
X-API-KEY | Required | Your Namsor's services API key |

To get an API key for free, please create an account.
Name | Type | Required | Description |
---|---|---|---|
personalNames | Array of objects | Required | A list of personal full names with their country of residence. |
[{...}].id | String | Optional | Unique identifier. |
[{...}].name | String | Required | Unsplit full name (first name and last name). |
[{...}].countryIso2 | String | Required | Country of residence, in ISO 3166-1 alpha-2 format. "US" by default (if no value indicated). |
Name | Type | Description | Enumerators |
---|---|---|---|
personalNames | Array of objects | List of submitted full names with their ethnicities. | |
[{...}].script | String | Name of the script used for the name, in ISO 15924 format. | Script |
[{...}].id | String | Provided unique identifier. | |
[{...}].name | String | Submitted full name. | |
[{...}].score | Number | Higher implies a more reliable result, score is not normalized. | |
[{...}].ethnicityAlt | String | Second most likely ethnicity. | Ethnicities or diasporas |
[{...}].ethnicity | String | Most likely ethnicity. | Ethnicities or diasporas |
[{...}].lifted | Boolean | Indicates if the output ethnicity is based on machine learning only, or further lifted as a known fact by a country-specific rule. | |
[{...}].countryIso2 | String | Submitted country of residence, in ISO 3166-1 alpha-2 format. | Country of residence |
[{...}].ethnicitiesTop | Array | Top 10 most likely ethnicities, ordered from most likely to least likely. | Ethnicities or diasporas |
[{...}].probabilityCalibrated | Number | The calibrated probability that ethnicity has been guessed correctly. -1 = still calibrating . | |
[{...}].probabilityAltCalibrated | Number | The calibrated probability that ethnicity OR ethnicityAlt have been guessed correctly. -1 = still calibrating . | |
Optional: X-OPTION-RELIGION-STATS = True | |||
[{...}].religionStats | Array of objects | Religious statistics in the country of origin of the most likely diaspora. Returned only if the religious statistics option is enabled (X-OPTION-RELIGION-STATS: True). | |
[{...}].religion | String | Religion within country of origin of most likely diaspora (ethnicity). | Religions |
[{...}].pct | Number | Percentage of the population practicing this religion in the country of origin of the most likely diaspora (ethnicity). | |
[{...}].religionStatsAlt | Array of objects | Religious statistics in the country of origin of the second most likely diaspora. Returned only if the religious statistics option is enabled (X-OPTION-RELIGION-STATS: True). | |
[{...}].religion | String | Religion within country of origin of second most likely diaspora (ethnicityAlt). | Religions |
[{...}].pct | Number | Percentage of the population practicing this religion in the country of origin of the second most likely diaspora (ethnicityAlt). |
Code sample:
Full Name Diaspora code sample for shell:
curl --request POST \
--url https://v2.namsor.com/NamSorAPIv2/api2/json/diasporaFullBatch \
--header 'X-API-KEY: your-api-key' \
--header 'Accept: application/json'
--header 'Content-Type: application/json' \
--data '{"personalNames":[{"id":"0d7d6417-0bbb-4205-951d-b3473f605b56","name":"Keith Haring","countryIso2":"US"}]}'
Body parameter:
{
"personalNames": [
{
"id": "0d7d6417-0bbb-4205-951d-b3473f605b56",
"name": "Keith Haring",
"countryIso2": "US"
}
]
}
The above command returns JSON structured like this:
{
"personalNames": [
{
"script": "LATIN",
"id": "0d7d6417-0bbb-4205-951d-b3473f605b56",
"name": "Keith Haring",
"score": 1.9177978014400305,
"ethnicityAlt": "British",
"ethnicity": "German",
"lifted": false,
"countryIso2": "US",
"ethnicitiesTop": ["German", "British", "Dutch", "Irish", "Norwegian", "Danish", "Swedish", "Swiss", "Austrian", "NativeHawaiian"],
"probabilityCalibrated": 0.29971840123154375,
"probabilityAltCalibrated": 0.35544175296700403
}
]
}
Values returned only if the religious statistics option is enabled X-OPTION-RELIGION-STATS: True.
{
religionStats: [
{ religion: 'Christian', pct: 68.7 },
{ religion: 'Unaffiliated', pct: 24.7 },
{ religion: 'Muslim', pct: 5.8 },
{ religion: 'Buddhist', pct: 0.3 },
{ religion: 'Jewish', pct: 0.3 },
{ religion: 'Other', pct: 0.1 },
{ religion: 'Folk', pct: 0.05 },
{ religion: 'Hindu', pct: 0.05 },
],
religionStatsAlt: [
{ religion: 'Christian', pct: 68.7 },
{ religion: 'Unaffiliated', pct: 24.7 },
{ religion: 'Muslim', pct: 5.8 },
{ religion: 'Buddhist', pct: 0.3 },
{ religion: 'Jewish', pct: 0.3 },
{ religion: 'Other', pct: 0.1 },
{ religion: 'Folk', pct: 0.05 },
{ religion: 'Hindu', pct: 0.05 },
],
}