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
From 8,147 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 219ms | 251ms | 284ms | 673ms | 982ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/inflation GETPremium only
https://api.api-ninjas.com/v1/inflation
Returns current monthly and annual inflation percentages.
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
A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.
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!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/inflation?country=CAHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
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 GETPremium 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
A JSON object with the following fields or an error if the request is unsuccessful.
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 containing:
timestampUNIX timestamp in seconds for the data point.
rate_pctThe inflation rate as a percentage for the given timestamp.
Sample Request Live Demo!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/inflationhistorical?country=CAHeaders
X-Api-KeyLog in or sign up to get your API Key