How to hit the World Bank API

The World Bank's API at https://api.worldbank.org/v2 covers thousands of indicators by country and year. Add format=json; the default is XML. Responses are a two-item array: paging info, then data.

Authentication

None — no key, no signup. Every example runs as-is.

Full reference: https://datahelpdesk.worldbank.org/knowledgebase/topics/125589

GDP for a country

Indicator NY.GDP.MKTP.CD is GDP in current US dollars.

curl "https://api.worldbank.org/v2/country/US/indicator/NY.GDP.MKTP.CD?format=json&per_page=3"
Run in PostTaco
Example response (trimmed)
[
  {
    "page": 1,
    "pages": 22,
    "per_page": 3,
    "total": 66,
    "sourceid": "2",
    "lastupdated": "2026-07-13"
  },
  [
    {
      "indicator": {
        "id": "NY.GDP.MKTP.CD",
        "value": "GDP (current US$)"
      },
      "country": {
        "id": "US",
        "value": "United States"
      },
      "countryiso3code": "USA",
      "date": "2025",
      "value": 30769700000000,
      "unit": "",
      "obs_status": "",
      "decimal": 0
    },
    {
      "indicator": {
        "id": "NY.GDP.MKTP.CD",
        "value": "GDP (current US$)"
      },
      "country": {
        "id": "US",
        "value": "United States"
      },
      "countryiso3code": "USA",
      "date": "2024",
      "value": 29298013000000,
      "unit": "",
      "obs_status": "",
      "decimal": 0
    }
  ]
]

Population, several countries

Separate country codes with semicolons.

curl "https://api.worldbank.org/v2/country/JP;DE/indicator/SP.POP.TOTL?format=json&date=2023"
Run in PostTaco
Example response (trimmed)
[
  {
    "page": 1,
    "pages": 1,
    "per_page": 50,
    "total": 2,
    "sourceid": "2",
    "lastupdated": "2026-07-13"
  },
  [
    {
      "indicator": {
        "id": "SP.POP.TOTL",
        "value": "Population, total"
      },
      "country": {
        "id": "DE",
        "value": "Germany"
      },
      "countryiso3code": "DEU",
      "date": "2023",
      "value": 83287273,
      "unit": "",
      "obs_status": "",
      "decimal": 0
    },
    {
      "indicator": {
        "id": "SP.POP.TOTL",
        "value": "Population, total"
      },
      "country": {
        "id": "JP",
        "value": "Japan"
      },
      "countryiso3code": "JPN",
      "date": "2023",
      "value": 124516650,
      "unit": "",
      "obs_status": "",
      "decimal": 0
    }
  ]
]

Country info

curl "https://api.worldbank.org/v2/country/BR?format=json"
Run in PostTaco
Example response (trimmed)
[
  {
    "page": 1,
    "pages": 1,
    "per_page": "50",
    "total": 1
  },
  [
    {
      "id": "BRA",
      "iso2Code": "BR",
      "name": "Brazil",
      "region": {
        "id": "LCN",
        "iso2code": "ZJ",
        "value": "Latin America & Caribbean "
      },
      "adminregion": {
        "id": "LAC",
        "iso2code": "XJ",
        "value": "Latin America & Caribbean (excluding high income)"
      },
      "incomeLevel": {
        "id": "UMC",
        "iso2code": "XT",
        "value": "Upper middle income"
      },
      "lendingType": {
        "id": "IBD",
        "iso2code": "XF",
        "value": "IBRD"
      },
      "capitalCity": "Brasilia",
      "longitude": "-47.9292",
      "latitude": "-15.7801"
    }
  ]
]