← Back to API Ninjas
GET/v1/inflationhistorical

Get historical inflation rates

Returns historical inflation rates for a given country and (optionally) time range. The maximum number of data points returned per API call is 100.

API Ninjas·$0.001 per call

Example code

// Using @orth/sdk - The simplest way to call APIs // Install: npm install @orth/sdk import Orthogonal from "@orth/sdk"; const orthogonal = new Orthogonal({ apiKey: process.env.ORTHOGONAL_API_KEY, }); const output = await orthogonal.run({ api: "api-ninjas", path: "/v1/inflationhistorical", query: { "country": "example" } }); console.log(output);

Query parameters

countryrequired
string

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

start_time
number

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

end_time
number

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

type
string

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. (Allowed: CPI, HICP)

    Orthogonal - Giving AI agents the tools they need.