Scrapers / Developer & File Tools

Countries Data Scraper
hipersoft/restcountries-scraper
Fetch country reference data in bulk as clean JSON, CSV or Excel: name, ISO codes, capital, region, population, area, languages, currencies, borders, coordinates, timezones, flags and calling codes. Get all countries, or filter by name, region or ISO code.
Total users
2Monthly users
1Total runs
63Per country scraped
$0.0008Last rebuilt
Oct 26, 2026Overview
Pull reference data for every country in the world as clean, structured JSON, CSV, Excel or XML. Get common and official names, ISO codes, capital, region, population, area, languages, currencies, borders, coordinates, timezones, flags and calling codes — for all countries at once, or filtered by name, region or ISO code. Ideal for dropdowns, forms, dashboards, data enrichment and automated pipelines.
What does Countries Data Scraper do?
This actor turns world country data into a ready-to-use dataset. Choose a mode — all countries, by name, by region, or by ISO code — and it returns one tidy record per country with names, codes, capital, region, population, currencies, languages and more. Use it to seed a country/currency picker, enrich records with ISO codes, build a geography dashboard, or keep a fresh copy of country reference data on a schedule.
What data can you get?
| Field | Description |
|---|---|
name |
Object with the country's common and official name. |
cca2 |
Two-letter ISO 3166-1 country code (e.g. SG). |
cca3 |
Three-letter ISO 3166-1 country code (e.g. SGP). |
capital |
Capital city or cities. |
region |
Region (e.g. Asia, Europe, Americas). |
subregion |
Subregion (e.g. South-Eastern Asia). |
population |
Population count. |
area |
Land area in km². |
languages |
Spoken languages as code → name pairs. |
currencies |
Currencies as code → { name, symbol } pairs. |
borders |
Three-letter codes of bordering countries. |
latlng |
Latitude and longitude of the country. |
flag |
URL of the country's flag as a PNG image. |
timezones |
Timezones observed in the country. |
tld |
Internet top-level domain(s), e.g. .sg. |
callingCodes |
International dialling code(s), e.g. +65. |
Use cases
- Dropdowns & forms — populate country, currency or dialling-code pickers with correct ISO codes.
- Data enrichment — add capital, region, population or currency to your existing records by ISO code.
- Dashboards & maps — power geography, demographics or logistics dashboards.
- Localization — map users to region, timezone, currency and language.
- Data pipelines — feed structured country reference data into BI tools, notebooks or apps.
How to use it
- Add Countries Data Scraper to your Apify account and open its input.
- Pick a mode: all countries, by name, by region, or by ISO code.
- Fill in the matching field — names, region, or codes — for the filtered modes.
- Optionally set fields to keep only the columns you need, and maxItems to cap the output.
- Click Run, then export the results as JSON, CSV, Excel or XML.
Input
{
"mode": "byRegion",
"region": "Europe"
}
| Field | Description |
|---|---|
mode |
all, byName, byRegion or byCode. |
names |
For byName: country names to match (partial, case-insensitive). |
region |
For byRegion: a single region, e.g. Europe. |
codes |
For byCode: two- or three-letter ISO codes, e.g. US, SG, JPN. |
fields |
Optional allow-list of output fields to keep. Empty = all fields. |
maxItems |
Cap the number of countries returned. 0 = no limit. |
What you get
One flat JSON record per country, ready to export to CSV, Excel, JSON or XML.
{
"name": { "common": "Singapore", "official": "Republic of Singapore" },
"cca2": "SG",
"cca3": "SGP",
"capital": ["Singapore"],
"region": "Asia",
"subregion": "South-Eastern Asia",
"population": 5685807,
"area": 710,
"languages": { "eng": "English", "msa": "Malay", "tam": "Tamil", "zho": "Chinese" },
"currencies": { "SGD": { "name": "Singapore dollar", "symbol": "$" } },
"borders": [],
"latlng": [1.36666666, 103.8],
"flag": "https://flagcdn.com/w320/sg.png",
"timezones": ["UTC+08:00"],
"tld": [".sg"],
"callingCodes": ["+65"]
}
FAQ
How do I get every country?
Set mode to all. You'll get one record for every country.
How do I look up specific countries?
Use mode: "byCode" with a list of ISO codes (US, SG, JPN), or mode: "byName" with country names (partial matches work).
How do I get all countries in a region?
Use mode: "byRegion" with one of: Africa, Americas, Antarctic, Asia, Europe, Oceania.
Can I return only some fields?
Yes — set fields to an allow-list, e.g. ["name", "cca2", "capital", "population"], to keep just those columns.
What export formats are available? JSON, CSV, Excel and XML, plus programmatic access through the Apify API.
Can I use this with n8n? Yes. Run it from the Apify n8n community node or trigger it over HTTP, then pass the dataset items straight into your n8n workflow to build dropdowns, enrich records or drive downstream steps.
Can I connect this to my other tools? It works with Make, Zapier, Slack, Airbyte, GitHub, Google Drive and many more, plus the Apify API, JavaScript/Python clients and MCP. Or use webhooks to trigger an action whenever a run finishes.
How fresh is the data? Static fields such as codes, capitals and borders change rarely; dynamic figures like population reflect the latest published values at run time. Re-run on a schedule to keep your copy current.
Notes
Original clean-room implementation. Returns only public country reference data; you are responsible for compliant use. Country names and boundaries are provided for reference and do not imply any political position. All trademarks belong to their respective owners.
Input
| Field | Type | Description |
|---|---|---|
modeMode | string · all, byName, byRegion, byCode | How to select countries. "All countries" returns every country. "By name" filters by the names you list. "By region" returns every country in one region. "By ISO code" returns the exact countries whose two- or three-letter ISO codes you list. Default: "all" |
namesCountry names | array | Used when mode is "By name". One or more country names to match (partial, case-insensitive), e.g. "Singapore", "united", "korea". Matches common, official and native names. |
regionRegion | string | Used when mode is "By region". A single region name: Africa, Americas, Antarctic, Asia, Europe or Oceania. |
codesISO codes | array | Used when mode is "By ISO code". Two-letter (cca2) or three-letter (cca3) ISO country codes, e.g. "US", "SG", "JPN". Case-insensitive. |
fieldsFields | array | Optional allow-list of output fields to keep, e.g. "name", "cca2", "capital", "population". Leave empty to return every field. Valid names: name, cca2, cca3, capital, region, subregion, population, area, languages, currencies, borders, latlng, flag, timezones, |
maxItemsMax countries | integer | Maximum number of countries to output. 0 = no limit. Default: 0 |
API
curl -X POST "https://api.apify.com/v2/acts/hipersoft~restcountries-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"names": [
"Singapore",
"Japan"
],
"region": "Europe",
"codes": [
"US",
"SG",
"JP"
],
"fields": [
"name",
"cca2",
"capital",
"population"
]
}'from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("hipersoft/restcountries-scraper").call(run_input={
"names": [
"Singapore",
"Japan"
],
"region": "Europe",
"codes": [
"US",
"SG",
"JP"
],
"fields": [
"name",
"cca2",
"capital",
"population"
]
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
print(item)import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('hipersoft/restcountries-scraper').call({
"names": [
"Singapore",
"Japan"
],
"region": "Europe",
"codes": [
"US",
"SG",
"JP"
],
"fields": [
"name",
"cca2",
"capital",
"population"
]
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);Pricing
| Event | Price | Paid plans from |
|---|---|---|
| Country Scraped Charged per country returned. | $0.0008 | $0.0004 |
You pay only for what the run returns. Set a maximum cost per run and it stops cleanly at that limit.
Related scrapers
Bulk Image Downloader
Download thousands of images from a list of URLs and store each in the key-value store with a public link. Returns content type, size, dimensions and SHA-256 per image. Bulk-ready. Great for datasets, backups and media pipelines.
8,102 runs · 103 users · $0.056 / url processedText to Speech
Convert any text to natural-sounding speech as an MP3 download. 300+ premium neural voices across 70+ languages, adjustable rate, pitch and volume. Great for voiceovers, videos, accessibility and audio content. No setup.
278 runs · 22 users · $0.01 / audio generatedGoogle Maps Email Extractor
Search Google Maps for businesses, then crawl each business website to extract emails, social profiles and extra phone numbers. Turns any Maps search into a ready lead list. No setup.
159 runs · 8 users · $0.006 / business lead scrapedWebsite Screenshot
Capture full-page or viewport screenshots of any URL as PNG or JPEG, at any device size. For monitoring, previews, thumbnails and automation workflows.
156 runs · 3 users · $0.004 / screenshot capturedBulk URL Status Checker
Check thousands of URLs over plain HTTP: status codes, broken links (404/410/5xx), full redirect chains, response time, content type, page title and SSL certificate expiry.
154 runs · 13 users · $0.002 / url checkedGoogle Search Scraper
Scrape Google Search results (organic listings) for any query: title, URL, displayed URL, snippet and position. Multi-query, per-country/language, pagination. Uses Google SERP proxy — reliable, no captcha, no setup.
121 runs · 8 users · $0.001 / result scrapedSend the site and the fields. We build it and you get it first.