All APIs

Government debt and budget balance API

Government debt and budget balance as a percent of GDP for 192 countries, from the IMF World Economic Outlook, with forecasts marked.

Online99.94% uptime, last 30 days354 ms typical response

First request

Get the government debt of a country

curl --request GET \
  --url "https://api.narwhalapi.com/v1/economics/IDN/government/debt" \
  --header "Authorization: Bearer $NARWHAL_API_KEY"
Example response
{
  "country": "IDN",
  "indicator": "government_debt_gdp",
  "unit": "percent of GDP",
  "year": 2025,
  "value": "40.879735",
  "kind": "actual",
  "source": "IMF World Economic Outlook",
  "edition": "2026-10"
}

Endpoints

GETGet government debt/v1/economics/{country}/government/debt

The newest actual year of general government gross debt, as a percent of GDP.

Parameters

  • countryrequired

    Three letter country code, such as IDN.


Full reference →
GETGet government debt by year/v1/economics/{country}/government/debt/observations

Every year held, oldest first, each marked actual or forecast.

Parameters

  • countryrequired

    Three letter country code, such as IDN.

  • startoptional

    First day or year of the range.

  • endoptional

    Last day or year of the range.


Full reference →
GETGet the budget balance/v1/economics/{country}/government/balance

The newest actual year of net lending (positive) or net borrowing (negative), as a percent of GDP.

Parameters

  • countryrequired

    Three letter country code, such as IDN.


Full reference →
GETGet the budget balance by year/v1/economics/{country}/government/balance/observations

Every year held, oldest first, each marked actual or forecast.

Parameters

  • countryrequired

    Three letter country code, such as IDN.

  • startoptional

    First day or year of the range.

  • endoptional

    Last day or year of the range.


Full reference →

Coverage

192 countries. The last actual year differs between countries, and later years are IMF forecasts.

Only the newest edition of the World Economic Outlook is served. For earlier rounds of a forecast, use the forecasts API.

Show all 192 countries

Sources

IMF World Economic Outlook, republished unchanged and checked weekly. Every answer names the source and its edition.

Related APIs

Economic data API

Official indicators for prices, labour, output, trade, and rates.

Explore the API →

FAQ

What is government debt to GDP?

General government gross debt as a percent of the country's economic output in the year.

Does the government debt data include forecasts?

Yes. Each year is marked actual or forecast. Years are actual up to the last year the IMF calls actual for that country.

What does a negative budget balance mean?

The government borrowed that share of GDP in the year. A positive figure is a surplus.

What does the government debt API cost?

Each answer is one Economics call from your prepaid credit. Every account gets $10 free every month, with no card.