Country API
The Country API provides key geographic, demographic, and economic statistics about every country in the world.
Available endpoints:
- /v1/country - Get country data from given parameters
- /v1/allcountries - Get a list of all countries
For flag images of countries, check out the Country Flag API instead.
From 8,067 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 329ms | 363ms | 409ms | 698ms | 1177ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/country GET
https://api.api-ninjas.com/v1/country
Get country data from given parameters. Returns a list of country statistics that satisfy the parameters.
Parameters
nameoptionalPlain English name, 2-letter ISO-3166 alpha-2, or 3-letter ISO-3166 alpha-3 code of country.
currencyoptional3-letter currency code of country (e.g.
USD).min_gdpoptionalMinimum gross domestic product (GDP) of country, in US Dollars.
max_gdpoptionalMaximum gross domestic product (GDP) of country, in US Dollars.
min_populationoptionalMinimum population of country.
max_populationoptionalMaximum population of country.
min_areaoptionalMinimum surface area of country in km2.
max_areaoptionalMaximum surface area of country in km2.
min_unemploymentoptionalMinimum unemployment rate in %.
max_unemploymentoptionalMaximum unemployment rate in %.
min_gdp_growthoptionalMinimum GDP growth rate in %.
max_gdp_growthoptionalMaximum GDP growth rate in %.
min_infant_mortalityoptionalMinimum infant mortality rate in %.
max_infant_mortalityoptionalMaximum infant mortality rate in %.
min_fertilityoptionalMinimum fertility rate in %.
max_fertilityoptionalMaximum fertility rate in %.
min_urban_pop_rateoptionalMinimum urban population rate in %.
max_urban_pop_rateoptionalMaximum urban population rate in %.
limitoptionalHow many results to return. Must be between
1and30. Default is5.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
Returns an array of country objects containing comprehensive statistics.
Sample Request Live Demo!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/country?name=United%20StatesHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
[
{
"gdp": "20580223",
"sex_ratio": "97.9",
"surface_area": "9833517",
"life_expectancy_male": "76.3",
"unemployment": "3.9",
"imports": "2567490",
"homicide_rate": "5",
"currency": {
"code": "USD",
"name": "Us Dollar"
},
"iso2": "US",
"gdp_growth": "2.9",
"employment_services": "79",
"urban_population_growth": "0.9",
"secondary_school_enrollment_female": "98.7",
"employment_agriculture": "1.3",
"capital": "Washington, D.C.",
"co2_emissions": "4761.3",
"forested_area": "33.9",
"tourists": "79746",
"exports": "1644280",
"life_expectancy_female": "81.3",
"post_secondary_enrollment_female": "102.0",
"post_secondary_enrollment_male": "75.0",
"primary_school_enrollment_female": "101.4",
"infant_mortality": "5.8",
"secondary_school_enrollment_male": "99.2",
"threatened_species": "1655",
"population": "331003",
"urban_population": "82.5",
"employment_industry": "19.7",
"name": "United States",
"pop_growth": "0.6",
"region": "Northern America",
"pop_density": "36.2",
"internet_users": "87.3",
"gdp_per_capita": "62917.9",
"fertility": "1.8",
"refugees": "1043.2",
"primary_school_enrollment_male": "102.2",
"telephone_country_codes": [
"1"
]
}
]Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/country?name=United%20States" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
/v1/allcountries GETPremium Only
https://api.api-ninjas.com/v1/allcountries
Get a list of all 2-letter country codes for countries, territories and regions for which we have statistics.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
Returns an array of 2-letter ISO-3166 alpha-2 country codes (strings).
Sample Request
https://api.api-ninjas.com/v1/allcountriesSample Response
1
2
3
4
5
6
7
8
9
10
[
"AD",
"AE",
"AF",
"AG",
"AI",
"AL",
"AM",
"..."
]