Developers & internal tools
Build a supplier directory
A working supplier directory with country codes, calling codes and currencies that fill themselves in. Choose the language separately.
Try it: pick a country in the Add supplier row.
Suppliers
Six fictional businesses. Real reference data.
Make it your own
Build your own version.
Use a country name for the picker and store its code. This small example assumes your server has already supplied countries and languages; the requests below load those references.
// countries and languages are the two complete reference arrays from your server.
const countryInput = document.querySelector('#country');
const countryOptions = document.querySelector('#countries');
const languageSelect = document.querySelector('#language');
const codes = document.querySelector('#codes');
const callingCode = document.querySelector('#calling-code');
const currency = document.querySelector('#currency');
// HTML: <input id="country" list="countries"><datalist id="countries"></datalist>
// Also provide <select id="language"> and outputs with the three IDs above.
for (const country of countries) {
const option = document.createElement('option');
option.value = country.CountryName;
countryOptions.append(option);
}
for (const language of languages) {
languageSelect.add(new Option(language.Language, language.Alpha2));
}
countryInput.addEventListener('input', () => {
const country = countries.find(row => row.CountryName === countryInput.value);
// An unfinished or unrecognized name must not retain the previous codes.
codes.textContent = country ? `${country.CountryAlpha2} / ${country.CountryAlpha3}` : '';
callingCode.textContent = country?.PhoneCode || '';
currency.textContent = country?.CurrencyCode || '';
});
// Store codes when saving, and validate them against your server's references.
// Never infer a person's language preference from their country.
Build a useful internal form
-
Load the references on your server
Countries and Languages are complete and free. Fetch each list once and cache it for your application; do not request both lists on every keystroke.
-
Store codes, display names
Store the selected country and language codes in your supplier record. Display the current names from the reference. The JSON preview includes country alpha-2 and alpha-3, calling code, currency and language so the mapping is explicit.
-
Validate existing records before importing
Use Country codes for names and aliases, then Join CSV files to attach reference fields. Flag ambiguous countries for review instead of guessing. Validate required supplier fields on the server too.
JavaScript · server-side fetch
const load = async list => {
const r = await fetch(`https://mysafeinfo.com/api/data/${list}?format=json`);
if (!r.ok) throw new Error(`HTTP ${r.status}`);
return r.json();
};
const [countries, languages] = await Promise.all([load("countries"), load("languages")]);
C# · HttpClient
using System.Net.Http.Json;
using System.Text.Json;
using var http = new HttpClient();
var countries = await http.GetFromJsonAsync<JsonElement>("https://mysafeinfo.com/api/data/countries?format=json");
var languages = await http.GetFromJsonAsync<JsonElement>("https://mysafeinfo.com/api/data/languages?format=json");
Python · standard library
import json
from urllib.request import urlopen
def load(name):
with urlopen(f"https://mysafeinfo.com/api/data/{name}?format=json", timeout=20) as response:
return json.load(response)
countries, languages = load("countries"), load("languages")
Data notes
Country, currency, calling code and language are separate reference concepts. A country code does not identify a person's language, nationality or preferred currency. Let people choose their language; do not infer it from their country. Verify payment and dialing rules with the systems that actually use them.
Also download the complete Languages CSV, JSON or XML. The preview stays on this page and does not submit a supplier.
Language reference fields
| Field | How to read it |
|---|---|
Language
|
Language display name. |
Family
|
Language-family grouping recorded in this dataset. |
Alpha2
|
Two- or three-letter language code. |
Alpha3
|
Two- or three-letter language code. |
Questions
Do these free requests need an API key?
No. They return both full reference lists without a key. Anonymous rate limits still apply, so cache sensible reference data in your own application.
Should I keep the name or the code?
Keep the code for joins and the original imported value for audit or review. Display names can change; refresh your reference deliberately.
Free in full. No Data Pass or API key needed. Opening this guide does not use your API allowance.
What each record contains
Explore the dataset and its sources. These fields are in the complete download.
| Field | How to read it |
|---|---|
CountryName |
Display name; use the codes for stable joins. |
CountryAlpha2 |
Two-letter ISO country code. |
CountryAlpha3 |
Three-letter ISO country code. |
CountryNumeric3 |
Three-digit ISO code; preserve leading zeros. |
CurrencyCode |
Recorded currency code; verify current currency rules for payments. |
PhoneCode |
Recorded international calling code, including its plus sign. |
Working with the download? Convert CSV to JSON, or turn a column into a list with the comma separator.
For your next project
More subjects to build with.
Countries and Languages are free in full. The Data Pass covers the rest of the catalog.
The Data Pass includes complete downloads and API access across the catalog.
Data Pass
$69one payment / 365 days
Explore the Data PassNo account required. No automatic renewal.