NewConnect Claude, Cursor, ChatGPT, and other AI agents to API Ninjas via our MCP server

Country API

The Country API provides key geographic, demographic, and economic statistics about every country in the world.

Available endpoints:

For flag images of countries, check out the Country Flag API instead.

(4.8)

From 8,067 users

400+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
336ms351ms420ms696ms1218ms

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

  • name  optional

    Plain English name, 2-letter ISO-3166 alpha-2, or 3-letter ISO-3166 alpha-3 code of country.

  • currency  optional

    3-letter currency code of country (e.g. USD).

  • min_gdp  optional

    Minimum gross domestic product (GDP) of country, in US Dollars.

  • max_gdp  optional

    Maximum gross domestic product (GDP) of country, in US Dollars.

  • min_population  optional

    Minimum population of country.

  • max_population  optional

    Maximum population of country.

  • min_area  optional

    Minimum surface area of country in km2.

  • max_area  optional

    Maximum surface area of country in km2.

  • min_unemployment  optional

    Minimum unemployment rate in %.

  • max_unemployment  optional

    Maximum unemployment rate in %.

  • min_gdp_growth  optional

    Minimum GDP growth rate in %.

  • max_gdp_growth  optional

    Maximum GDP growth rate in %.

  • min_infant_mortality  optional

    Minimum infant mortality rate in %.

  • max_infant_mortality  optional

    Maximum infant mortality rate in %.

  • min_fertility  optional

    Minimum fertility rate in %.

  • max_fertility  optional

    Maximum fertility rate in %.

  • min_urban_pop_rate  optional

    Minimum urban population rate in %.

  • max_urban_pop_rate  optional

    Maximum urban population rate in %.

  • limit  optional

    How many results to return. Must be between 1 and 30. Default is 5.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.

Sample Request Live Demo!

name
currency
min_population
max_population
min_gdp

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/country?name=United%20States

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON

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-Key  required

    API Key associated with your account.

Response

A JSON array of strings, or an error if the request is unsuccessful.

Sample Request

https://api.api-ninjas.com/v1/allcountries

Sample Response

JSON