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

GDP API

The GDP API provides current and historical GDP (Gross Domestic Product) data for countries around the world.

(4.6)

From 6,519 users

1,900+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
295ms316ms369ms519ms1213ms

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


/v1/gdp GET

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

Get GDP data from given parameters. Returns GDP statistics that satisfy the parameters.

Parameters

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

  • country  optional

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

  • year  optional

    Year for which to retrieve GDP data.

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.

  • country

    The 3-letter ISO 3166 alpha-3 country code.

  • year

    The year for which the GDP data is recorded.

  • gdp_growth

    GDP growth rate as a percentage.

  • gdp_nominal

    Nominal GDP in billions of US dollars.

  • gdp_per_capita_nominal

    Nominal GDP per capita in US dollars.

  • gdp_ppp

    GDP at purchasing power parity (PPP) in billions of US dollars.

  • gdp_per_capita_ppp

    GDP per capita at PPP in US dollars.

  • gdp_ppp_share

    Country's share of world GDP at PPP as a percentage.

Sample Request Live Demo!

country
year

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

https://api.api-ninjas.com/v1/gdp?country=Canada

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/gdp?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.