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:

(4.6)

From 8,147 users

400+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
219ms251ms284ms673ms982ms

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.

List of Supported countries

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

    2-letter country code (ISO-3166-1 alpha-2) or name of country (case-insensitive).

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON array of objects, each containing the following fields, or an error if the request is unsuccessful.

  • country

    The name of the country.

  • country_code

    The 2-letter country code (ISO-3166-1 alpha-2).

  • 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
type

Try this API endpoint with all available parameters in our API playground

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

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON

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

  • country  required

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

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

  • start_time  optional

    Start time for the data range, specified as a UNIX timestamp in seconds.

  • end_time  optional

    End time for the data range, specified as a UNIX timestamp in seconds.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON object with the following fields or an error if the request is unsuccessful.

  • type

    The type of inflation indicator (CPI or HICP).

  • country

    The name of the country.

  • country_code

    The 2-letter country code (ISO-3166-1 alpha-2).

  • data

    Array of historical inflation data points, each 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!

Country
type
start_time
end_time

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/inflationhistorical?country=CA

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON