# World Bank & FRED API — Macro Economic Data (`galih_rakasiwi/macro-finance-api`) Actor

Global macro-economic indicators as clean LLM-ready JSON: World Bank (GDP, inflation, trade — no key required) and FRED (St. Louis Fed — free key). Search series, fetch observations by year, browse the indicator catalog.

- **URL**: https://apify.com/galih_rakasiwi/macro-finance-api.md
- **Developed by:** [RD.Galih Rakasiwi](https://apify.com/galih_rakasiwi) (community)
- **Categories:** AI
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.20 / 1,000 api requests

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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

## Macro Finance Data API — World Bank + FRED Indicators

Global macro-economic indicators as **clean, LLM-ready JSON**.

- **World Bank** — works **with no key at all**: GDP, inflation, population,
  trade, unemployment, and 1,400+ other indicators for 200+ countries.
- **FRED (St. Louis Fed)** — US and global economic series with a **free** API
  key: CPI, interest rates, money supply, employment, and more.

### Why this Actor

Both sources return nested, inconsistent payloads. This Actor normalizes them
into one predictable shape (`country`, `year`, `value`) so you can drop the data
straight into a chart, a database, or an LLM tool.

### Endpoints

| Method | Path | Key required |
|---|---|---|
| GET | `/wb/indicator/{code}` | no |
| GET | `/wb/indicators?search=` | no |
| GET | `/wb/countries` | no |
| GET | `/fred/search?q=` | `FRED_API_KEY` |
| GET | `/fred/series/{id}` | `FRED_API_KEY` |

```bash
## Indonesia GDP (current US$), 2021–2025
curl "https://<container-url>/wb/indicator/NY.GDP.MKTP.CD?country=IDN&start_year=2021&end_year=2025"

## List World Bank indicators matching "inflation"
curl "https://<container-url>/wb/indicators?search=inflation"

## FRED: search series (needs FRED_API_KEY)
curl "https://<container-url>/fred/search?q=inflation"
```

### Output

```json
{
  "indicator": "NY.GDP.MKTP.CD",
  "count": 5,
  "items": [
    {"country": "Indonesia", "countryIso3": "IDN", "year": "2025", "value": 1445642584163.81, "unit": ""}
  ]
}
```

### Getting a FRED key (free)

1. Create an account at <https://fred.stlouisfed.org>
2. Request an API key: <https://fred.stlouisfed.org/docs/api/api_key.html>
3. Put it in the Actor input `fredApiKey` (or `FRED_API_KEY` env var)

World Bank endpoints work without any key.

### Local development

```bash
pip install -r requirements.txt
uvicorn src.main:app --reload
```

### Related searches

world bank api, fred api, macro economic data, gdp data api, inflation data api, economic indicators api, country statistics

# Actor input Schema

## `fredApiKey` (type: `string`):

Free FRED API key from https://fred.stlouisfed.org/docs/api/api_key.html — required only for /fred/\* endpoints. World Bank endpoints work without any key.

## `port` (type: `integer`):

Port the API server listens on.

## Actor input object example

```json
{
  "port": 8000
}
```

# Actor output Schema

## `liveApi` (type: `string`):

Base URL of the running API.

## `swagger` (type: `string`):

Interactive API docs — try every endpoint in the browser.

## `openapi` (type: `string`):

Machine-readable OpenAPI JSON for client generation and LLM tools.

## `health` (type: `string`):

Verify the server is running.

## `runConsole` (type: `string`):

Logs, storage and metrics.

# 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 = {
    "fredApiKey": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("galih_rakasiwi/macro-finance-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 = { "fredApiKey": "" }

# Run the Actor and wait for it to finish
run = client.actor("galih_rakasiwi/macro-finance-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 '{
  "fredApiKey": ""
}' |
apify call galih_rakasiwi/macro-finance-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,galih_rakasiwi/macro-finance-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/XXNKIlI3I9zoF0L7S/builds/9X1SrCtOvchybp8sI/openapi.json
