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.
Looking for historical inflation data? Go to the Historical Inflation endpoint.
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.
Developer and Business tier only
https://api.api-ninjas.com/v1/inflationhistorical
Returns historical inflation rates for a given country and (optionally) time range. The maximum number of data points returned per API call is 100.
country
requiredCountry name (case-insensitive). The following countries are supported:
Country | CPI | HICP |
---|---|---|
Austria | Yes | Yes |
Belgium | Yes | Yes |
Brazil | Yes | - |
Canada | Yes | - |
Chile | Yes | - |
China | Yes | - |
Czech Republic | Yes | Yes |
Denmark | Yes | Yes |
Estonia | Yes | Yes |
Finland | Yes | Yes |
France | Yes | Yes |
Germany | Yes | Yes |
Greece | Yes | Yes |
Hungary | Yes | Yes |
Iceland | Yes | Yes |
India | Yes | - |
Indonesia | Yes | - |
Ireland | Yes | Yes |
Israel | Yes | - |
Italy | Yes | Yes |
Japan | Yes | - |
Mexico | Yes | - |
Norway | Yes | - |
Poland | Yes | Yes |
Portugal | Yes | Yes |
Russia | Yes | - |
Slovakia | Yes | Yes |
Slovenia | Yes | Yes |
South Korea | Yes | - |
South Africa | Yes | - |
Spain | Yes | Yes |
Sweden | Yes | Yes |
Switzerland | Yes | Yes |
The Netherlands | Yes | Yes |
Türkiye | Yes | Yes |
United Kingdom | Yes | Yes |
United States | Yes | - |
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.
start_time
optionalStart time for the data range, specified as a UNIX timestamp in seconds.
end_time
optionalEnd time for the data range, specified as a UNIX timestamp in seconds.
X-Api-Key
requiredAPI Key associated with your account.
https://api.api-ninjas.com/v1/inflationhistorical
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"type": "cpi",
"country": "United States",
"data": [
{
"timestamp": 1659312000,
"rate_pct": 8.26
},
{
"timestamp": 1661990400,
"rate_pct": 8.2
},
{
"timestamp": 1664582400,
"rate_pct": 7.75
},
{
"timestamp": 1667260800,
"rate_pct": 7.11
},
...
]
}