# IMF World Economic Outlook Scraper (`muhammadafzal/imf-world-economic-outlook-scraper`) Actor

Extract normalized IMF World Economic Outlook indicators for countries, regions, and analytical groups by year, including GDP growth, inflation, GDP, debt, unemployment, and current-account series.

- **URL**: https://apify.com/muhammadafzal/imf-world-economic-outlook-scraper.md
- **Developed by:** [Muhammad Afzal](https://apify.com/muhammadafzal) (community)
- **Categories:** Other, Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.50 / 1,000 weo observations

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## IMF World Economic Outlook Scraper

Extract current macroeconomic observations from the official IMF World Economic Outlook (WEO) DataMapper API. The Actor returns one clean dataset item per entity, indicator, and year, ready for research, dashboards, spreadsheets, and AI agents.

### What you can extract

- Countries such as `USA`, `CHN`, `DEU`, `IND`, and `PAK`
- IMF regions and analytical groups such as `WEOWORLD`
- Real GDP growth (`NGDP_RPCH`)
- Nominal GDP (`NGDPD`) and GDP per capita (`NGDPDPC`)
- Average inflation (`PCPIPCH`)
- Unemployment (`LUR`)
- Current account balance (`BCA_NGDPD`)
- Government net lending/borrowing (`GGXCNL_NGDP`)
- Government gross debt (`GGXWDG_NGDP`)

The DataMapper WEO surface contains selected key indicators. It is not the full spreadsheet/SDMX WEO database.

### Input example

```json
{
  "entityCodes": ["USA", "CHN", "WEOWORLD"],
  "indicatorCodes": ["NGDP_RPCH", "PCPIPCH"],
  "startYear": 2024,
  "endYear": 2027,
  "includeProjections": true,
  "maxResults": 100
}
```

### Output example

```json
{
  "entityCode": "USA",
  "entityName": "United States",
  "entityType": "country",
  "indicatorCode": "NGDP_RPCH",
  "indicatorName": "Real GDP growth",
  "year": 2026,
  "value": 2.3,
  "unit": "Annual percent change",
  "isProjection": true,
  "projectionStartYear": 2026,
  "source": "World Economic Outlook (April 2026)",
  "dataset": "WEO",
  "vintage": "April 2026",
  "lastModified": "2026-04-08 16:07:34",
  "sourceUrl": "https://www.imf.org/external/datamapper/api/v2/NGDP_RPCH",
  "retrievedAt": "2026-08-27T00:00:00.000Z"
}
```

### Projection handling

The IMF metadata declares a projection start year per indicator. `isProjection` is true from that year onward. Set `includeProjections` to false to exclude those records. Missing IMF values are omitted rather than converted to zero.

### Pricing

Pay per event is designed around two transparent synthetic events:

- Actor start: `$0.00005` per start event (memory-scaled by Apify)
- WEO observation: `$0.0005` for each dataset item

For example, a 100-observation run costs about `$0.05005` in event charges. The Actor stops at `maxResults` and reserves the synthetic start event when calculating how many observations fit inside `ACTOR_MAX_TOTAL_CHARGE_USD`; your Apify run-level maximum charge is also enforced by the platform. Live Apify pricing is canonical and is re-read from the Actor's monetization settings.

### Reliability and limitations

- Data comes directly from the public IMF DataMapper v2 endpoint; no API key or proxy is required.
- The official API currently may return more series than requested, so the Actor applies entity and year filtering locally.
- WEO is revised twice yearly, and the Actor reports the source vintage and last-modified metadata returned by IMF.
- Some entities or years have no value for a selected indicator.
- WEO projections are IMF staff estimates and are not guarantees.
- Use IMF data in accordance with the [IMF Copyright and Usage terms](https://www.imf.org/external/terms.htm).

### Run diagnostics

The default dataset contains only homogeneous WEO observations. `OUTPUT` in the default key-value store reports `DATA`, `EMPTY`, `REJECTED`, or `FAILED`, delivered counts, normalized input, source details, and actionable diagnostics. Invalid entity or indicator codes produce no fabricated records and no result-event charges.

### Local development

```bash
npm install
npm test
apify run
```

This Actor is an independent data extraction tool and is not affiliated with or endorsed by the International Monetary Fund.

### Use cases

- Schedule repeatable collection and export results to downstream workflows.
- Run a one-off research job and export the structured result as JSON, CSV, Excel, XML, or RSS from Apify.
- Schedule the same input to monitor changes over time and send completed datasets to a webhook or integration.
- Feed schema-shaped records into a database, spreadsheet, BI tool, or AI workflow with the source URL retained for verification.

### Run IMF World Economic Outlook Scraper with the Apify API

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('muhammadafzal/imf-world-economic-outlook-scraper').call({
  "entityCodes": [
    "USA",
    "CHN"
  ],
  "indicatorCodes": [
    "NGDP_RPCH",
    "PCPIPCH"
  ],
  "startYear": 2024,
  "endYear": 2027,
  "includeProjections": true,
  "maxResults": 100
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

You can also run the Actor from Apify Console, schedules, webhooks, the REST API, Make, Zapier, n8n, or the hosted Apify MCP server.

### Responsible use

Use this Actor only for data you are authorized to access. Follow the target website's terms, robots and access policies, and applicable privacy, database, copyright, anti-spam, and data-protection laws. Do not use it to bypass authentication or other access controls, collect private data, harass people, or make high-impact decisions without independent verification.

### Support

When reporting a problem, include the **Actor run ID**, a redacted input, the expected result, and a small public example URL when applicable. Do not post API tokens, cookies, credentials, or personal data in an issue.

# Actor input Schema

## `entityCodes` (type: `array`):

Choose IMF entity codes to retrieve. Use ISO-style country codes such as USA, CHN, DEU; regional codes such as WEQ; or analytical groups such as WEOWORLD. Defaults to USA and CHN.

## `indicatorCodes` (type: `array`):

Choose IMF WEO DataMapper indicator codes. Common examples: NGDP\_RPCH (real GDP growth), NGDPD (nominal GDP), PCPIPCH (average inflation), GGXWDG\_NGDP (government debt percent of GDP).

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

Return observations from this year, inclusive. WEO DataMapper currently begins in 1980 for most series.

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

Return observations through this year, inclusive. The selected range must be no more than 100 years.

## `includeProjections` (type: `boolean`):

Include years at or after the indicator's IMF projection start year. Disable this to keep only historical/estimated observations.

## `maxResults` (type: `integer`):

Stop after this many normalized entity-indicator-year observations. Use a small value for tests and up to 50,000 for bulk extraction.

## Actor input object example

```json
{
  "entityCodes": [
    "USA",
    "CHN"
  ],
  "indicatorCodes": [
    "NGDP_RPCH",
    "PCPIPCH"
  ],
  "startYear": 2024,
  "endYear": 2027,
  "includeProjections": true,
  "maxResults": 100
}
```

# Actor output Schema

## `observations` (type: `string`):

No description

## `summary` (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 = {
    "entityCodes": [
        "USA",
        "CHN"
    ],
    "indicatorCodes": [
        "NGDP_RPCH",
        "PCPIPCH"
    ],
    "startYear": 2024,
    "endYear": 2027,
    "maxResults": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("muhammadafzal/imf-world-economic-outlook-scraper").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 = {
    "entityCodes": [
        "USA",
        "CHN",
    ],
    "indicatorCodes": [
        "NGDP_RPCH",
        "PCPIPCH",
    ],
    "startYear": 2024,
    "endYear": 2027,
    "maxResults": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("muhammadafzal/imf-world-economic-outlook-scraper").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 '{
  "entityCodes": [
    "USA",
    "CHN"
  ],
  "indicatorCodes": [
    "NGDP_RPCH",
    "PCPIPCH"
  ],
  "startYear": 2024,
  "endYear": 2027,
  "maxResults": 100
}' |
apify call muhammadafzal/imf-world-economic-outlook-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,muhammadafzal/imf-world-economic-outlook-scraper"
        }
    }
}

```

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/4dyMjHvfZbA7u01Eq/builds/JkXfGoNGYKo55cAwl/openapi.json
