Inflation API
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.
Available endpoints:
- /v1/inflation - Get current monthly and annual inflation percentages
- /v1/inflationhistorical - Get historical inflation rates for a given country and time range
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 282ms | 305ms | 357ms | 757ms | 1083ms |
Didn't find what you were looking for? Suggest an improvement
/v1/inflation GET
https://api.api-ninjas.com/v1/inflation
Returns current monthly and annual inflation percentages.
The following inflation measures are available:
| Country Code | Country | CPI | HICP |
|---|---|---|---|
| AT | Austria | Yes | Yes |
| BE | Belgium | Yes | Yes |
| BR | Brazil | Yes premium only | - |
| CA | Canada | Yes | - |
| CL | Chile | Yes | - |
| CN | China | Yes premium only | - |
| CZ | Czech Republic | Yes premium only | Yes premium only |
| DK | Denmark | Yes premium only | Yes premium only |
| EE | Estonia | Yes | Yes |
| FI | Finland | Yes premium only | Yes |
| FR | France | Yes premium only | Yes premium only |
| DE | Germany | Yes | Yes |
| GR | Greece | Yes premium only | Yes premium only |
| HU | Hungary | Yes | Yes |
| IS | Iceland | Yes | Yes |
| IN | India | Yes premium only | - |
| ID | Indonesia | Yes premium only | - |
| IE | Ireland | Yes | Yes |
| IL | Israel | Yes premium only | - |
| IT | Italy | Yes premium only | Yes premium only |
| JP | Japan | Yes premium only | - |
| MX | Mexico | Yes | - |
| NO | Norway | Yes | - |
| PL | Poland | Yes premium only | Yes premium only |
| PT | Portugal | Yes | Yes |
| RU | Russia | Yes | - |
| SK | Slovakia | Yes | Yes |
| SI | Slovenia | Yes premium only | Yes |
| KR | South Korea | Yes premium only | - |
| ZA | South Africa | Yes premium only | - |
| ES | Spain | Yes premium only | Yes premium only |
| SE | Sweden | Yes | Yes |
| CH | Switzerland | Yes | - |
| NL | The Netherlands | Yes | Yes premium only |
| TR | Türkiye | Yes premium only | Yes premium only |
| GB | United Kingdom | Yes premium only | Yes premium only |
| US | United States | Yes premium only | - |
Parameters
typeoptionalInflation indicator type. Can be either
CPI(Consumer Price Index) orHICP(Harmonized Index of Consumer Prices). If not provided, theCPIwill be used by default.countryoptional2-letter country code (ISO-3166-1 alpha-2) or name of country (case-insensitive).
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response Fields
countryThe name of the country.
country_codeThe 2-letter country code (ISO-3166-1 alpha-2).
typeThe type of inflation indicator (CPI or HICP).
periodThe period for the inflation data.
monthly_rate_pctThe monthly inflation rate as a percentage.
yearly_rate_pctThe yearly inflation rate as a percentage.
Sample Request Live Demo!
https://api.api-ninjas.com/v1/inflation?country=CAHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
6
7
8
9
10
[
{
"country": "Canada",
"country_code": "CA",
"type": "CPI",
"period": "Oct 2023",
"monthly_rate_pct": 0.06,
"yearly_rate_pct": 3.12
}
]Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/inflation?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.
/v1/inflationhistorical GET
Business, Professional and annual plan subscribers 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.
Parameters
countryrequiredEither the 2-letter country code (ISO-3166-1 alpha-2) or the country name (case-insensitive). See the list of supported countries in the /v1/inflation endpoint above.
typeoptionalInflation indicator type. Can be either
CPI(Consumer Price Index) orHICP(Harmonized Index of Consumer Prices). If not provided, theCPIwill be used by default.start_timeoptionalStart time for the data range, specified as a UNIX timestamp in seconds.
end_timeoptionalEnd time for the data range, specified as a UNIX timestamp in seconds.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response Fields
typeThe type of inflation indicator (CPI or HICP).
countryThe name of the country.
country_codeThe 2-letter country code (ISO-3166-1 alpha-2).
dataArray of historical inflation data points. Each element is an object containing:
timestamp(UNIX timestamp in seconds for the data point),rate_pct(the inflation rate as a percentage for the given timestamp).
Sample Request Live Demo!
https://api.api-ninjas.com/v1/inflationhistorical?country=CAHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
"type": "cpi",
"country": "Canada",
"country_code": "CA",
"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
},
...
]
}