# Inflation API - CPI & Economic Indicators by Country (`martin10291/inflation-cpi-api`) Actor

Inflation and CPI data by country as JSON, no API key: yearly inflation, CPI index, GDP, GDP growth, GDP per capita, unemployment, population and lending rate for 217 countries (World Bank, CC BY 4.0), plus monthly HICP inflation (yoy, mom, index) for 37 European countries from Eurostat, including t

- **URL**: https://apify.com/martin10291/inflation-cpi-api.md
- **Developed by:** [Martin Petrov](https://apify.com/martin10291) (community)
- **Categories:** Developer tools, Automation, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Inflation API - CPI & Economic Indicators by Country

**Problem:** your finance app, salary or price calculator, newsroom or AI agent needs the inflation rate of a country, this month's euro-area HICP, or "what is $100 from 2000 worth today". The World Bank publishes yearly data in bulk files and its per-country API is often down; Eurostat publishes monthly HICP as JSON-stat cubes with a new dataset code since 2026 (the old `prc_hicp_manr` stopped at 2025-12). Joining the two by hand takes a day.

**This API:** one JSON call, no API key, answers from a maintained copy of the official data.

- **Yearly, 217 countries (World Bank WDI):** `inflation` (CPI %), `cpi` (index 2010=100), `gdp`, `gdpGrowth`, `gdpPerCapita`, `unemployment`, `population`, `interestRate` (lending rate). Raw WDI codes work too.
- **Monthly, 37 European countries (Eurostat HICP):** year-on-year %, month-on-month % and index, including the euro-area flash estimate (`estimated: true`). `latest` adds the newest month to the yearly row, so you get yearly and monthly numbers in one call.
- **Inflation calculator:** `adjust` converts an amount between two years (CPI index) or two months (HICP index, EU countries) and returns the cumulative and average annual inflation.
- **Countries:** ISO2 (`US`, `DE`, `EL` or `GR`), ISO3 (`BGR`) or names (`Germany`). Up to 50 per call.
- **Source on every row:** World Bank WDI (CC BY 4.0) and Eurostat (reuse authorised with source acknowledged). The `source` field carries the attribution.

### Example (API)

```bash
curl -X POST "https://api.apify.com/v2/acts/martin10291~inflation-cpi-api/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode": "latest", "countries": ["DE"], "indicators": ["inflation"]}'
```

Output row (measured 2026-11-13):

```json
{"country": "DE", "countryName": "Germany", "iso3": "DEU", "indicator": "inflation", "value": 2.1718, "unit": "% per year", "year": 2025,
 "previousValue": 2.2565, "previousYear": 2024, "change": -0.0847,
 "monthlyHicp": {"month": "2026-10", "yoy": 2.8, "mom": -0.1, "index": 103.8, "indexBase": "Index, 2025=100", "estimated": true},
 "source": "World Bank, World Development Indicators (FP.CPI.TOTL.ZG), licence CC BY 4.0; Eurostat, HICP monthly data (prc_hicp_minr)"}
```

Inflation calculator (`{"mode": "adjust", "amount": 100, "country": "US", "fromYear": 2000, "toYear": 2024}`):

```json
{"country": "US", "amount": 100.0, "fromYear": 2000, "toYear": 2024, "adjustedAmount": 182.17, "cumulativeInflationPct": 82.17, "avgAnnualInflationPct": 2.53, "method": "WB CPI index (FP.CPI.TOTL)"}
```

More inputs:

- `{"mode": "monthly", "countries": ["FR", "Bulgaria"], "startMonth": "2025-10"}` -> one row per country and month (yoy, mom, index).
- `{"mode": "history", "countries": ["JP"], "indicator": "inflation", "startYear": 2015}` -> one row per year.
- `{"mode": "adjust", "amount": 50, "country": "DE", "fromMonth": "2020-01", "toMonth": "2026-09"}` -> monthly HICP precision.
- `{"mode": "countries"}` / `{"mode": "indicators"}` -> what is covered.

### Use from agents (MCP)

Add the Apify MCP server (`https://mcp.apify.com?tools=martin10291/inflation-cpi-api`) to Claude, Cursor or any MCP client and ask: "What was inflation in Bulgaria last month, and what is 1,000 EUR from 2020 worth today?".

### Schedule it

Set `onlyNew: true` and a `monitorId`, schedule monthly: each run returns only the new months (HICP) or new years (World Bank) since the last run.

### Input

| Field | Meaning |
|---|---|
| `mode` | latest (default), history, monthly, adjust, indicators, countries |
| `countries` | list of ISO2/ISO3/names, default US, DE, GB, JP, BG |
| `indicators` / `indicator` | for latest / history, default inflation |
| `startYear`, `endYear` | history range |
| `startMonth`, `endMonth` | monthly range, YYYY-MM |
| `amount`, `country`, `fromYear`, `toYear`, `fromMonth`, `toMonth` | adjust |
| `limit` | max rows (default 1000) |
| `onlyNew`, `monitorId` | monitor mode |

### Limits (honest)

- World Bank data is yearly and lags: the newest year is usually last year (US CPI currently ends 2024).
- Monthly HICP covers EU, EEA and candidate countries only; the US and UK are not monthly here.
- `interestRate` is sparse for many countries.

### Pricing

$1.00 per 1,000 rows. A latest call for 3 countries = 3 rows.

### FAQ

- **How fresh is the data?** Eurostat HICP is refreshed every 6 hours (the flash estimate appears at the end of each month, `estimated: true`); World Bank data every 12 hours (it changes a few times a year). Every row has `fetchedAt`; if a source is down, the last copy is returned with `stale: true`.
- **Why is the newest year last year?** The World Bank publishes yearly values with a lag. For Europe use `monthly` or the `monthlyHicp` field for this month's number.
- **Errors:** an unknown country, indicator or month, or a monthly request for a non-European country returns a clear message in the run status and `RUN_SUMMARY.lastError`; the run does not fail and no rows are charged.

# Actor input Schema

## `mode` (type: `string`):

latest = newest yearly value per country and indicator (EU countries also get the newest monthly HICP); history = one row per country and year; monthly = Eurostat HICP per month (EU/EEA/candidate countries); adjust = what an amount from one year (or month) is worth in another, using the official CPI index; indicators / countries = lists of what is covered.

## `countries` (type: `array`):

ISO2 (US, DE, BG), ISO3 (USA, BGR) or English names (Germany). Up to 50. Empty = US, DE, GB, JP, BG.

## `indicators` (type: `array`):

For latest: inflation, cpi, gdp, gdpGrowth, gdpPerCapita, unemployment, population, interestRate (or the raw World Bank code, e.g. FP.CPI.TOTL.ZG). Empty = inflation.

## `indicator` (type: `string`):

For history: one indicator key, e.g. inflation or gdpGrowth. Default inflation.

## `startYear` (type: `integer`):

For history: first year (1960 or later). Default 10 years ago.

## `endYear` (type: `integer`):

For history: last year. Default the latest year with data.

## `startMonth` (type: `string`):

For monthly: first month YYYY-MM. Default 24 months back.

## `endMonth` (type: `string`):

For monthly: last month YYYY-MM. Default the newest month.

## `amount` (type: `number`):

For adjust: the money amount to convert, e.g. 100. Default 100.

## `country` (type: `string`):

For adjust: one country, e.g. US or Germany. Default US.

## `fromYear` (type: `integer`):

For adjust: the year of the original amount. Default 10 years before To year.

## `toYear` (type: `integer`):

For adjust: the target year. Default the latest year with CPI data.

## `fromMonth` (type: `string`):

For adjust with monthly precision (EU countries, HICP index): YYYY-MM.

## `toMonth` (type: `string`):

For adjust with monthly precision (EU countries, HICP index): YYYY-MM.

## `limit` (type: `integer`):

Maximum rows returned. Between 1 and 20000.

## `onlyNew` (type: `boolean`):

Return only country/indicator/period rows not returned before for this Monitor ID. Schedule monthly to get each new HICP month or new World Bank year once.

## `monitorId` (type: `string`):

Name of the watch for only-new mode, e.g. my-dashboard. Each Monitor ID keeps its own memory.

## Actor input object example

```json
{
  "mode": "latest",
  "countries": [
    "US",
    "DE",
    "BG"
  ],
  "indicators": [
    "inflation",
    "unemployment"
  ],
  "limit": 1000,
  "onlyNew": false,
  "monitorId": "default"
}
```

# Actor output Schema

## `results` (type: `string`):

latest/history: one row per country and indicator (and year); monthly: one row per country and month with yoy %, mom % and index; adjust: one row with the adjusted amount and cumulative inflation. Every row carries source attribution.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "latest",
    "countries": [
        "US",
        "DE",
        "BG"
    ],
    "indicators": [
        "inflation",
        "unemployment"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("martin10291/inflation-cpi-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "mode": "latest",
    "countries": [
        "US",
        "DE",
        "BG",
    ],
    "indicators": [
        "inflation",
        "unemployment",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("martin10291/inflation-cpi-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "latest",
  "countries": [
    "US",
    "DE",
    "BG"
  ],
  "indicators": [
    "inflation",
    "unemployment"
  ]
}' |
apify call martin10291/inflation-cpi-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,martin10291/inflation-cpi-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/VgJLk0uFiXMDd9LMf/builds/YJvBeKxGdCdjJoXUL/openapi.json
