# African Inflation Monitor (`malmon/africa-inflation-monitor`) Actor

Monthly CPI and inflation data for 7 African countries pulled directly from national statistics offices — Ghana (GSS), Morocco (HCP), Tunisia (INS), South Africa (SARB), Zambia (BoZ), Kenya (CBK), Uganda (UBOS). Returns CPI index, YoY %, MoM % and food sub-indices. Every record is source-attributed.

- **URL**: https://apify.com/malmon/africa-inflation-monitor.md
- **Developed by:** [Simon M](https://apify.com/malmon) (community)
- **Categories:** Agents, Developer tools, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / latest cpi snapshot

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Africa Inflation Monitor — Monthly CPI Data

Delivers monthly Consumer Price Index (CPI) and inflation rates for **7 African countries** — directly from national statistics offices and central banks. Data is typically available 2–4 weeks after the reference period, compared to 6–12 months for World Bank / IMF aggregator feeds.

**Countries:** Ghana · Morocco · Tunisia · South Africa · Zambia · Kenya · Uganda

---

### Why this actor

| Aggregator | Africa CPI lag | This actor |
|---|---|---|
| World Bank | 6–12 months | 2–4 weeks |
| IMF | 6–12 months | 2–4 weeks |

Each record includes CPI index level, year-on-year % change, month-on-month % change, and food/non-food sub-categories where available — normalised across all 7 countries.

---

### Coverage

| Country | Source | Legal | CPI index | YoY | MoM | Food | Historical depth |
|---------|--------|-------|-----------|-----|-----|------|-----------------|
| Ghana (GH) | GSS StatsBank PX-Web API | 🟡 no ban | ✅ | ✅ pub | ✅ pub | ✅ index | Jan 1998 |
| Morocco (MA) | HCP BDS API — CC-BY 4.0 | 🟢 CC-BY | ✅ | derived | derived | ✅ index | Jan 2017 |
| Tunisia (TN) | INS HTML tables | 🟢 open | ✅ | ✅ pub | ✅ pub | ✅ index | Rolling 9 mo |
| South Africa (ZA) | SARB JSON API | 🟡 © footer | — | ✅ pub | — | — | Jan 2000 |
| Zambia (ZM) | BoZ JSON API | 🟡 no ban | — | ✅ pub | ✅ pub | ✅ yoy | Feb 2010 |
| Kenya (KE) | CBK wpDataTables | 🟡 © footer | — | ✅ pub | — | — + annualAvg | Jan 2005 |
| Uganda (UG) | UBOS Excel via WP | 🟡 © footer | ✅ | derived | derived | ✅ index | Jul 2017 |

**Note:** Food sub-category is not available for South Africa or Kenya from any machine-readable source without browser automation. South Africa also lacks a CPI index level via the SARB API (headline YoY only).

---

### Modes

#### `latest` (default)
Returns the single most recently published CPI month for each country. One API call per country, results in ~7 records. Recommended for scheduled daily or weekly runs.

#### `historical`
Returns monthly CPI rows for a specified date range. Requires `dateFrom` and `dateTo` in `YYYY-MM` format.

**Limitations in historical mode:**
- **Tunisia:** only the rolling 9-month window is available — no archive API.
- **Uganda:** each month requires downloading a separate Excel file (~650 KB each). For Uganda, `latest` mode is strongly recommended; historical across many months is slow.

---

### Input

| Parameter | Type | Default | Description |
|---|---|---|---|
| `mode` | string | `latest` | `latest` or `historical` |
| `countries` | string[] | all 7 | ISO 3166-1 alpha-2 codes: GH, MA, TN, ZA, ZM, KE, UG |
| `dateFrom` | string | — | Required for historical. `YYYY-MM` |
| `dateTo` | string | — | Required for historical. `YYYY-MM` |
| `maxItems` | integer | 5000 | Hard cap on total output records |

---

### Output example

**Ghana — latest:**
```json
{
  "schemaVersion": "0.1",
  "id": "GH:2026-01",
  "country": "GH",
  "countryName": "Ghana",
  "period": "2026-01",
  "currency": "GHS",
  "cpiIndex": 262.3,
  "cpiBaseYear": "2018",
  "yoyChange": 3.8,
  "yoyChangeDerived": false,
  "momChange": 0.2,
  "momChangeDerived": false,
  "food": 294.3,
  "foodType": "index",
  "nonFood": 239.1,
  "nonFoodType": "index",
  "annualAverage": null,
  "source": {
    "name": "Ghana Statistical Service (GSS) StatsBank",
    "url": "https://statsbank.statsghana.gov.gh/api/v1/en/Macroeconomic Indicators/Prices and Inflation/cpi.px",
    "retrievedAt": "2026-06-04T14:05:06.862Z",
    "asOfDate": "2026-01",
    "licenseNote": "Source: Ghana Statistical Service (statsghana.gov.gh). Government statistical data, reproduced for informational purposes."
  },
  "warnings": []
}
````

**Kenya — latest (headline-only source):**

```json
{
  "id": "KE:2026-05",
  "country": "KE",
  "period": "2026-05",
  "currency": "KES",
  "cpiIndex": null,
  "yoyChange": 6.68,
  "momChange": null,
  "food": null,
  "annualAverage": 4.66,
  "source": { "name": "Central Bank of Kenya (CBK)", ... }
}
```

***

### Cost (Pay-per-event)

| Run type | Cost |
|---|---|
| `latest` — all 7 countries | **$0.10** |
| `latest` — 2 countries | **$0.10** (same snapshot charge) |
| Historical — 1 country, 12 months | **$0.12** |
| Historical — Ghana full (1998–2026, ~337 months) | **$3.37** |
| Historical — all 7, full depth | ~**$13** |

***

### Legality & disclaimers

All data reproduced from official government sources. Each output record carries a `source.licenseNote` with the legal basis:

- **Morocco (HCP):** [CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/) — explicit open licence
- **Tunisia (INS):** Explicit open data declaration
- **Ghana, Zambia, Kenya, Uganda, South Africa:** No redistribution prohibition found on any government web page as of 2026-06-04 (verified via direct inspection). Published under the factual-data rationale: raw statistical figures are not copyrightable; only creative expression is protected.

**This data is for informational purposes only. Not financial advice.**

All values are reproduced faithfully from the source — no values are synthesised or adjusted.

***

### Limitations

- **South Africa:** `cpiIndex = null`, `food = null` — SARB API only publishes headline YoY %. Stats SA (the primary source) is blocked by a WAF.
- **Kenya:** `cpiIndex = null`, `food = null`, `momChange = null` — CBK only publishes YoY and 12-month annual average.
- **Tunisia:** Rolling 9-month window only — no historical archive available via any machine-readable route.
- **Uganda:** `historical` mode downloads one Excel file (~650 KB) per month. For ranges > 3 months, consider using `latest` mode on a schedule instead.
- **Morocco:** `yoyChangeDerived: true` — YoY and MoM are computed from the index, not published directly by HCP.
- Data cadence: CPI is published monthly, typically 2–4 weeks after the reference period. Scheduling this actor daily is fine but new data will only appear once per month.

***

### Issues / feedback

[Open an issue](https://github.com/anthropics/claude-code/issues) or contact simon.maltzen@mail.de

# Actor input Schema

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

latest returns one record per country for the most recently published month. historical returns the full time series for a date range.

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

Leave empty for all 7 countries. ISO 3166-1 alpha-2 codes: GH, MA, TN, ZA, ZM, KE, UG.

## `dateFrom` (type: `string`):

Start month in YYYY-MM format. Required in historical mode. Earliest: GH 1998-01, MA 2017-01, TN rolling 9mo, ZA 2000-01, ZM 2010-02, KE 2005-01, UG 2017-07.

## `dateTo` (type: `string`):

End month in YYYY-MM format. Defaults to latest available.

## `maxItems` (type: `integer`):

Hard cap on total output records.

## Actor input object example

```json
{
  "mode": "latest",
  "countries": [
    "GH",
    "MA",
    "TN",
    "ZA",
    "ZM",
    "KE",
    "UG"
  ],
  "dateFrom": "2023-01",
  "dateTo": "2026-05",
  "maxItems": 5000
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# 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 = {
    "countries": [
        "GH",
        "MA",
        "TN",
        "ZA",
        "ZM",
        "KE",
        "UG"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("malmon/africa-inflation-monitor").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 = { "countries": [
        "GH",
        "MA",
        "TN",
        "ZA",
        "ZM",
        "KE",
        "UG",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("malmon/africa-inflation-monitor").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "countries": [
    "GH",
    "MA",
    "TN",
    "ZA",
    "ZM",
    "KE",
    "UG"
  ]
}' |
apify call malmon/africa-inflation-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=malmon/africa-inflation-monitor",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "African Inflation Monitor",
        "description": "Monthly CPI and inflation data for 7 African countries pulled directly from national statistics offices — Ghana (GSS), Morocco (HCP), Tunisia (INS), South Africa (SARB), Zambia (BoZ), Kenya (CBK), Uganda (UBOS). Returns CPI index, YoY %, MoM % and food sub-indices. Every record is source-attributed.",
        "version": "0.1",
        "x-build-id": "E8QhOvDOqHkpcF1yi"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/malmon~africa-inflation-monitor/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-malmon-africa-inflation-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/malmon~africa-inflation-monitor/runs": {
            "post": {
                "operationId": "runs-sync-malmon-africa-inflation-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/malmon~africa-inflation-monitor/run-sync": {
            "post": {
                "operationId": "run-sync-malmon-africa-inflation-monitor",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Data mode",
                        "enum": [
                            "latest",
                            "historical"
                        ],
                        "type": "string",
                        "description": "latest returns one record per country for the most recently published month. historical returns the full time series for a date range.",
                        "default": "latest"
                    },
                    "countries": {
                        "title": "Countries (optional filter)",
                        "type": "array",
                        "description": "Leave empty for all 7 countries. ISO 3166-1 alpha-2 codes: GH, MA, TN, ZA, ZM, KE, UG.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "dateFrom": {
                        "title": "Date from (historical mode)",
                        "pattern": "^[0-9]{4}-[0-9]{2}$",
                        "type": "string",
                        "description": "Start month in YYYY-MM format. Required in historical mode. Earliest: GH 1998-01, MA 2017-01, TN rolling 9mo, ZA 2000-01, ZM 2010-02, KE 2005-01, UG 2017-07."
                    },
                    "dateTo": {
                        "title": "Date to (historical mode)",
                        "pattern": "^[0-9]{4}-[0-9]{2}$",
                        "type": "string",
                        "description": "End month in YYYY-MM format. Defaults to latest available."
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": 1,
                        "maximum": 50000,
                        "type": "integer",
                        "description": "Hard cap on total output records.",
                        "default": 5000
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
