The Inflation API provides current economic inflation data for 38 major countries. The stats are usually updated monthly - although certain countries may lag behind or update more infrequently.
https://api.api-ninjas.com/v1/inflation
Returns current monthly and annual inflation percentages.
The following inflation measures are available:
Country | CPI | HICP |
---|---|---|
Austria | Yes | Yes |
Belgium | Yes | Yes |
Brazil | Yes premium only | - |
Canada | Yes | - |
Chile | Yes | - |
China | Yes premium only | - |
Czech Republic | Yes premium only | Yes premium only |
Denmark | Yes premium only | Yes premium only |
Estonia | Yes | Yes |
Finland | Yes premium only | Yes |
France | Yes premium only | Yes premium only |
Germany | Yes | Yes |
Greece | Yes premium only | Yes premium only |
Hungary | Yes | Yes |
Iceland | Yes | Yes |
India | Yes premium only | - |
Indonesia | Yes premium only | - |
Ireland | Yes | Yes |
Israel | Yes premium only | - |
Italy | Yes premium only | Yes premium only |
Japan | Yes premium only | - |
Mexico | Yes | - |
Norway | Yes | - |
Poland | Yes premium only | Yes premium only |
Portugal | Yes | Yes |
Russia | Yes | - |
Slovakia | Yes | Yes |
Slovenia | Yes premium only | Yes |
South Korea | Yes premium only | - |
South Africa | Yes premium only | - |
Spain | Yes premium only | Yes premium only |
Sweden | Yes | Yes |
Switzerland | Yes | Yes |
The Netherlands | Yes | Yes premium only |
Türkiye | Yes premium only | Yes premium only |
United Kingdom | Yes premium only | Yes premium only |
United States | Yes premium only | - |
type
optionalInflation indicator type. Can be either CPI
(Consumer Price Index) or HICP
(Harmonized Index of Consumer Prices). If not provided, the CPI
will be used by default.
country
optionalName of country (case-insensitive).
X-Api-Key
requiredAPI Key associated with your account.
country
The name of the country.
type
The type of inflation indicator (CPI or HICP).
period
The period for the inflation data.
monthly_rate_pct
The monthly inflation rate as a percentage.
yearly_rate_pct
The yearly inflation rate as a percentage.
https://api.api-ninjas.com/v1/inflation?country=Canada
1
2
3
4
5
6
7
8
9
[
{
"country": "Canada",
"type": "CPI",
"period": "Oct 2023",
"monthly_rate_pct": 0.06,
"yearly_rate_pct": 3.12
}
]
1
2
3
4
5
6
7
8
9
import requests
country = 'Canada'
api_url = 'https://api.api-ninjas.com/v1/inflation?country={}'.format(country)
response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'})
if response.status_code == requests.codes.ok:
print(response.text)
else:
print("Error:", response.status_code, response.text)
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.