
World Bank
ScienceFree and Open access to global development data provided by world bank. You can fetch articles, statistics, trade emasures, covid-19 research analsysis. Also lets you query data bank analysis / visualization tools that contains collections of time series on data on a variety of topics.
🔑 How to use the World Bank API (no key required)
The World Bank's Indicators API is fully open — no registration, no key, no cost.
- Pick an indicator. Browse indicators at data.worldbank.org — each has a code like NY.GDP.MKTP.CD (GDP, current US$).
- Build the URL. GET https://api.worldbank.org/v2/country/all/indicator/NY.GDP.MKTP.CD?format=json&date=2010:2024.
- Filter by country. Swap all for ISO codes: /country/in;cn;us/indicator/SP.POP.TOTL for India, China, and the US.
- Page through results. Responses include pagination metadata; add &per_page=500 to reduce round-trips.
📚 Documentation & Examples
Everything you need to integrate with World Bank
🚀 Quick Start Examples
// World Bank API Example
const response = await fetch('https://datahelpdesk.worldbank.org/knowledgebase/topics/125589', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);Exploring the World Bank API with JavaScript
The World Bank data API offers a rich source of information on global development indicators. In this article, we'll explore how to consume this API using JavaScript.
Getting Started — No API Key Required
The World Bank Indicators API is completely open: no API key, token, or registration is required. (The earlier note about obtaining a key was incorrect — ignore any API_KEY parameter.) Call the endpoints directly and add format=json to get JSON instead of the default XML:
curl "https://api.worldbank.org/v2/country/USA/indicator/NY.GDP.PCAP.CD?format=json&per_page=5"
Common patterns:
- List indicators:
https://api.worldbank.org/v2/indicator?format=json - List countries:
https://api.worldbank.org/v2/country?format=json - Country + indicator data:
https://api.worldbank.org/v2/country/{code}/indicator/{indicator}?format=json
Useful query parameters include date=2010:2020 (year range), per_page (page size), and page (the response's first element carries pages and total). Country codes are ISO-3 (e.g. USA, IND), and you can request several at once with a semicolon: country/USA;IND;BRA. There are no per-key limits, but keep requests reasonable and cache where you can. Full docs: https://datahelpdesk.worldbank.org/knowledgebase/topics/125589.
Example code
Fetching indicators
One of the main features of the World Bank API is the ability to retrieve indicators. Indicators are statistical measures that provide insights into development outcomes, such as poverty, education, or health.
Here's an example of how to fetch indicators using JavaScript:
const API_KEY = "YOUR_API_KEY";
const options = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
};
fetch(`https://api.worldbank.org/v2/indicators?format=json&per_page=10&source=2&${API_KEY}`, options)
.then(response => response.json())
.then(data => console.log(data));
In this example, we're using the Fetch API to make a GET request to the /indicators endpoint of the World Bank API. The format, per_page, and source parameters specify the output format, the number of results per page, and the data source (2 stands for world development indicators), respectively. The ${API_KEY} part injects our API key into the URL.
Fetching countries
Another important feature of the World Bank API is the ability to retrieve country data. Here's an example of how to fetch countries:
const API_KEY = "YOUR_API_KEY";
const options = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
};
fetch(`https://api.worldbank.org/v2/country?format=json&per_page=10&${API_KEY}`, options)
.then(response => response.json())
.then(data => console.log(data));
In this example, we're using the same approach as before, but this time we're querying the /country endpoint. The per_page parameter specifies the number of results per page.
Fetching data for a specific country and indicator
Finally, let's see how to fetch data for a specific country and indicator. Here's an example:
const API_KEY = "YOUR_API_KEY";
const COUNTRY_CODE = "USA";
const INDICATOR_CODE = "NY.GDP.PCAP.CD";
const options = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
};
fetch(`https://api.worldbank.org/v2/country/${COUNTRY_CODE}/indicator/${INDICATOR_CODE}?format=json&${API_KEY}`, options)
.then(response => response.json())
.then(data => console.log(data));
In this example, we're querying the /country/{country_code}/indicator/{indicator_code} endpoint, which returns data for a specific country and indicator. The COUNTRY_CODE and INDICATOR_CODE constants specify which country and indicator to retrieve.
Conclusion
In this article, we've explored how to use JavaScript to consume the World Bank data API. We've seen examples of how to fetch indicators, countries, and data for a specific country and indicator. Armed with this knowledge, you can start building your own applications that leverage the rich dataset provided by the World Bank API.
❓ Frequently Asked Questions
Does the World Bank API need an API key?
No — it's completely open with no registration. Add format=json to get JSON (the default is XML).
What data is in the World Bank API?
16,000+ time-series indicators covering economics, health, education, environment, and poverty for 200+ countries, many series going back to 1960.









