Holiday Sale! Get over 30% off when you subscribe to an annual plan!

Population API

The Population API provides historical, current, and projected future population statistics about every country in the world.

(4.5)

From 8,616 users

3,500+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
286ms298ms357ms581ms1094ms

Didn't find what you were looking for? Suggest an improvement


/v1/population GET

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

Get population data from given parameters. Returns a list of up to 5 country population statistics that satisfy the parameters. For more results use the offset parameter.

Parameters

At least one of the following parameters must be set: country, min_population, max_population

  • country  optional

    Country name (case-insensitive) or 2-letter ISO-3166 alpha-2 code of the country. E.g. Japan or JP.

  • min_population  optional

    Minimum population of country.

  • max_population  optional

    Maximum population of country.

  • offset  optional

    Offset results for pagination.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

Returns an object containing:

  • country_name

    The name of the country.

  • historical_population

    Array of historical population data objects, each containing the following fields:

    • year

      The year for which the population data is recorded.

    • population

      Total population count for the country in the given year.

    • yearly_change_percentage

      Percentage change in population from the previous year (can be positive or negative).

    • yearly_change

      Absolute change in population from the previous year (can be positive or negative).

    • migrants

      Net number of migrants (immigrants minus emigrants) for the year.

    • median_age

      Median age of the population in years.

    • fertility_rate

      Average number of children born per woman in the population.

    • density

      Population density per square kilometer.

    • urban_population_pct

      Percentage of the total population living in urban areas.

    • urban_population

      Total number of people living in urban areas.

    • percentage_of_world_population

      Percentage of the world's total population represented by this country.

    • rank

      World ranking by population size (1 being the most populous country).

  • population_forecast

    Array of projected future population data objects with the same structure as historical_population.

Sample Request Live Demo!

country
min_population
max_population
offset

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

https://api.api-ninjas.com/v1/population?country=Japan

Headers

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

Sample Response

JSON
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 { "country_name": "Japan", "historical_population": [ { "year": 2024, "population": 123753041, "yearly_change_percentage": -0.5, "yearly_change": -617906, "migrants": 153357, "median_age": 49.4, "fertility_rate": 1.22, "density": 339, "urban_population_pct": 92.9, "urban_population": 114979260, "percentage_of_world_population": 1.52, "rank": 12 }, { "year": 2023, "population": 124370947, "yearly_change_percentage": -0.5, "yearly_change": -626631, "migrants": 175003, "median_age": 49, "fertility_rate": 1.21, "density": 341, "urban_population_pct": 92.7, "urban_population": 115292289, "percentage_of_world_population": 1.54, "rank": 12 }, "..." ], "population_forecast": [ { "year": 2025, "population": 123103479, "yearly_change_percentage": -0.51, "yearly_change": -640213, "migrants": 140579, "median_age": 49.8, "fertility_rate": 1.23, "density": 338, "urban_population_pct": 93.1, "urban_population": 114645589, "percentage_of_world_population": 1.5, "rank": 12 }, { "year": 2030, "population": 119584121, "yearly_change_percentage": -0.58, "yearly_change": -703872, "migrants": 123993, "median_age": 51.5, "fertility_rate": 1.26, "density": 328, "urban_population_pct": 94.3, "urban_population": 112710068, "percentage_of_world_population": 1.4, "rank": 15 }, "..." ] }

Code Examples

1 2 curl -X GET "https://api.api-ninjas.com/v1/population?country=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.