Inflation
Historical and current CPI inflation rates for 241 countries, sourced from the World Bank. Returns up to 30 years of annual data per country.
Overview
Use Cases
- Economic dashboards and financial research tools
- Country comparison and risk analysis
- Inflation-adjusted financial modelling
- Macroeconomics education platforms
- Investment research and reporting
Features
241 countries covered
Up to 30 years of annual CPI data
Sourced from the World Bank (FP.CPI.TOTL.ZG indicator)
Current rate and 10 years of history in a single request
ISO 3166-1 alpha-2 country codes
API Endpoints
Get Inflation Rate
Returns the latest annual CPI inflation rate for a country plus the previous 10 years of historical data.
GET
https://api.requiems.xyz/v1/finance/inflation
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| country | string |
Required | ISO 3166-1 alpha-2 country code (e.g. US, GB, DE). Case-insensitive. |
Try it out
Live DemoRequest
ISO 3166-1 alpha-2 country code (e.g. US, GB, DE). Case-insensitive.
Sending request...
Response Fields
| Field | Type | Description |
|---|---|---|
| country | string |
ISO 3166-1 alpha-2 country code, uppercased |
| rate | number |
Latest annual CPI inflation rate as a percentage (e.g. 2.9495 means 2.9495%) |
| period | string |
Year of the latest data point (e.g. 2024) |
| historical | array |
Up to 10 previous years of inflation data, ordered newest to oldest |
| historical[].period | string |
Year of the historical data point |
| historical[].rate | number |
Annual CPI inflation rate for that year |
Code Examples
curl "https://api.requiems.xyz/v1/finance/inflation?country=US" \
-H "requiems-api-key: YOUR_API_KEY"
import requests
url = "https://api.requiems.xyz/v1/finance/inflation"
headers = {"requiems-api-key": "YOUR_API_KEY"}
params = {"country": "US"}
response = requests.get(url, headers=headers, params=params)
data = response.json()["data"]
print(data["rate"]) # 2.9495
print(data["period"]) # "2024"
const response = await fetch(
'https://api.requiems.xyz/v1/finance/inflation?country=US',
{ headers: { 'requiems-api-key': 'YOUR_API_KEY' } }
);
const { data } = await response.json();
console.log(data.rate); // 2.9495
console.log(data.period); // "2024"
console.log(data.historical.length); // 10
require 'net/http'
require 'json'
uri = URI('https://api.requiems.xyz/v1/finance/inflation')
uri.query = URI.encode_www_form(country: 'US')
request = Net::HTTP::Get.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)['data']
puts data['rate'] # 2.9495
puts data['period'] # "2024"
Error Responses
bad_request
The country parameter is missing or is not a valid ISO 3166-1 alpha-2 code.
not_found
No inflation data found for the given country code.
internal_error
Unexpected server error.
Frequently Asked Questions
Data is sourced from the World Bank and updated annually when new figures are published (typically mid-year for the prior calendar year). Re-run the seed CLI to pull the latest data.
The rate is the annual percentage change in the Consumer Price Index (CPI) β the World Bank indicator FP.CPI.TOTL.ZG. A rate of 8.0 means prices rose 8% on average over that year.
Some territories or newly recognised states may not have CPI data in the World Bank dataset. The database is seeded from World Bank records and only includes countries with available data.
Percent. A rate of 2.9495 means 2.9495%, not 0.029495. The value is stored with 4 decimal places of precision.