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.

/v1/inflation GET

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

Returns current monthly and annual inflation percentages.

The following inflation measures are available:

CountryCPIHICP
AustriaYesYes
BelgiumYesYes
BrazilYes premium only-
CanadaYes-
ChileYes-
ChinaYes premium only-
Czech RepublicYes premium onlyYes premium only
DenmarkYes premium onlyYes premium only
EstoniaYesYes
FinlandYes premium onlyYes
FranceYes premium onlyYes premium only
GermanyYesYes
GreeceYes premium onlyYes premium only
HungaryYesYes
IcelandYesYes
IndiaYes premium only-
IndonesiaYes premium only-
IrelandYesYes
IsraelYes premium only-
ItalyYes premium onlyYes premium only
JapanYes premium only-
MexicoYes-
NorwayYes-
PolandYes premium onlyYes premium only
PortugalYesYes
RussiaYes-
SlovakiaYesYes
SloveniaYes premium onlyYes
South KoreaYes premium only-
South AfricaYes premium only-
SpainYes premium onlyYes premium only
SwedenYesYes
SwitzerlandYesYes
The NetherlandsYesYes premium only
TürkiyeYes premium onlyYes premium only
United KingdomYes premium onlyYes premium only
United StatesYes premium only-

Parameters

  • type  optional

    Inflation 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  optional

    Name of country (case-insensitive).

Headers

  • X-Api-Key  required

    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!

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

Sample Response

JSON
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 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.