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
API Endpoints
Get Inflation Rate
Returns the latest annual CPI inflation rate for a country plus the previous 10 years of historical data.
https://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.
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<object> |
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://requiems.xyz/v1/finance/inflation?country=US" \
-H "requiems-api-key: YOUR_API_KEY"
import requests
url = "https://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://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://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
The country parameter is missing or is not a valid ISO 3166-1 alpha-2 code.
No inflation data found for the given country code.
Unexpected server error.
Batch Inflation Rates
Returns inflation data for up to 50 countries in a single request. Results are in the same order as the input. Countries with no data return found: false instead of failing the whole request. Billing: 1 credit per country (not per HTTP request).
https://requiems.xyz/v1/finance/inflation/batch
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| countries | array<string> |
Required | Array of ISO 3166-1 alpha-2 country codes. Min: 1, Max: 50. |
Try it out
Live DemoRequest
Array of ISO 3166-1 alpha-2 country codes. Min: 1, Max: 50.
Response Fields
| Field | Type | Description |
|---|---|---|
| results | array<object> |
One entry per country, in the same order as the input array |
| results[].country | string |
ISO 3166-1 alpha-2 country code, uppercased |
| results[].found | boolean |
false when the country has no data in the World Bank set |
| results[].rate | number |
Latest CPI inflation rate. Omitted when found: false |
| results[].period | string |
Year of the latest data point. Omitted when found: false |
| results[].historical | array<object> |
Up to 10 previous years. Omitted when found: false |
| total | integer |
Total number of results returned (equals number of countries sent) |
Code Examples
curl -X POST "https://requiems.xyz/v1/finance/inflation/batch" \
-H "requiems-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"countries": ["US", "AR", "DE"]}'
import requests
url = "https://requiems.xyz/v1/finance/inflation/batch"
headers = {
"requiems-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {"countries": ["US", "AR", "DE"]}
response = requests.post(url, headers=headers, json=payload)
results = response.json()["data"]["results"]
for item in results:
if item["found"]:
print(f"{item['country']}: {item['rate']}%")
else:
print(f"{item['country']}: no data")
const response = await fetch(
'https://requiems.xyz/v1/finance/inflation/batch',
{
method: 'POST',
headers: {
'requiems-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ countries: ['US', 'AR', 'DE'] })
}
);
const { data } = await response.json();
data.results.forEach(item => {
if (item.found) {
console.log(`${item.country}: ${item.rate}%`);
} else {
console.log(`${item.country}: no data`);
}
});
require 'net/http'
require 'json'
uri = URI('https://requiems.xyz/v1/finance/inflation/batch')
request = Net::HTTP::Post.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
request['Content-Type'] = 'application/json'
request.body = { countries: ['US', 'AR', 'DE'] }.to_json
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
results = JSON.parse(response.body)['data']['results']
results.each do |item|
if item['found']
puts "#{item['country']}: #{item['rate']}%"
else
puts "#{item['country']}: no data"
end
end
Error Responses
Body is invalid: empty array, more than 50 items, or a bad country code.
Unexpected server error.