🔬 Country X-Ray API

Free JSON API — 28 indicators across 195 countries

No auth required CORS enabled Updated weekly

Base URL

https://countryxray.com/api/v1

Endpoints

GET/api/v1/countries

List all countries with basic metadata.

GET/api/v1/countries/:ISO3

Full country data: metadata + all 28 indicators (latest values) + democracy scores + 10-year trends.

GET/api/v1/indicators/:key

Global ranking for one indicator across all countries.

GET/api/v1/health

Data freshness — last update timestamp per source, row counts.

Available Indicators

Economy (World Bank)

KeyDescription
gdpGDP (current US$)
gdp_per_capitaGDP per capita (current US$)
gdp_growthGDP growth (annual %)
populationTotal population
unemploymentUnemployment (% of labor force)
inflationInflation, consumer prices (annual %)
trade_pct_gdpTrade (% of GDP)
fdi_pct_gdpForeign direct investment (% of GDP)
giniGini index (inequality)
govt_debt_pctGovernment debt (% of GDP)
literacyAdult literacy rate (%)
internet_usersInternet users (% of population)

Health (WHO GHO + World Bank)

KeyDescription
life_expectancyLife expectancy at birth (years)
healthy_life_expectancyHealthy life expectancy / HALE (years)
fertility_rateFertility rate (births per woman)
neonatal_mortalityNeonatal mortality (per 1,000 live births)
maternal_mortalityMaternal mortality ratio (per 100,000)
under5_mortalityUnder-5 mortality (per 1,000 live births)
physicians_per_1000Physicians per 1,000 people
health_spending_pctHealth expenditure (% of GDP)

Environment (World Bank)

KeyDescription
co2_per_capitaCO2 emissions (metric tons per capita)

Democracy (V-Dem)

Democracy scores are on a 0–1 scale (higher = more democratic, except corruption where higher = more corrupt).

KeyDescription
electoralElectoral Democracy Index
liberalLiberal Democracy Index
participatoryParticipatory Democracy Index
deliberativeDeliberative Democracy Index
egalitarianEgalitarian Democracy Index
corruptionPolitical Corruption Index
rule_of_lawRule of Law Index
press_freedomFreedom of Expression & Alt Info

Response Format

All responses are JSON with Cache-Control: public, max-age=3600 and CORS headers.

Example: Single Country

GET /api/v1/countries/JPN

{
  "country": {
    "iso3": "JPN",
    "name": "Japan",
    "capital": "Tokyo",
    "region": "Asia",
    "population": 125124989,
    "flag_emoji": "🇯🇵",
    ...
  },
  "indicators": [
    { "indicator": "gdp", "year": 2023, "value": 4212945070000, "source": "worldbank" },
    { "indicator": "life_expectancy", "year": 2022, "value": 84.8, "source": "worldbank" },
    ...
  ],
  "democracy": {
    "year": 2024, "electoral": 0.88, "liberal": 0.84,
    "corruption": 0.12, "rule_of_law": 0.93, ...
  },
  "trends": [
    { "indicator": "gdp_per_capita", "year": 2015, "value": 34524 },
    { "indicator": "gdp_per_capita", "year": 2016, "value": 38761 },
    ...
  ]
}

Data Sources

SourceIndicatorsUpdate FrequencyLicense
World Bank16QuarterlyCC BY 4.0
WHO GHO5AnnualCC BY-NC-SA 3.0 IGO
V-Dem8Annual (March)Free, cite required
REST CountriesMetadataOn changeMPL 2.0

Rate Limits

None. The API is free and open. Please be reasonable — if you need bulk data, use the /api/v1/countries endpoint to get all countries in one call.

Attribution

If you use this API, a link back to countryxray.com is appreciated but not required.