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.
Looking for historical inflation data? Go to the Historical Inflation endpoint.
/v1/inflation GET
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 | - | 
| 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 | - | 
Parameters
- typeoptional- Inflation indicator type. Can be either - CPI(Consumer Price Index) or- HICP(Harmonized Index of Consumer Prices). If not provided, the- CPIwill be used by default.
- countryoptional- Name of country (case-insensitive). 
Headers
- X-Api-Keyrequired- API Key associated with your account. 
Response Fields
- 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. 
Sample Request Live Demo!
https://api.api-ninjas.com/v1/inflation?country=CanadaHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
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
  }
]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
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.
Parameters
- countryrequired- Country 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 - - - The Netherlands - Yes - Yes - Türkiye - Yes - Yes - United Kingdom - Yes - Yes - United States - Yes - - 
- typeoptional- Inflation indicator type. Can be either - CPI(Consumer Price Index) or- HICP(Harmonized Index of Consumer Prices). If not provided, the- CPIwill be used by default.
- start_timeoptional- Start time for the data range, specified as a UNIX timestamp in seconds. 
- end_timeoptional- End time for the data range, specified as a UNIX timestamp in seconds. 
Headers
- X-Api-Keyrequired- API Key associated with your account. 
Sample Request
https://api.api-ninjas.com/v1/inflationhistoricalSample Response
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
    },
    ...
  ]
}