# FRED Economic Data Fetcher — Time Series & Indicators (`scrapeworks/fred-economic-data`) Actor

Fetch economic time-series data from FRED (Federal Reserve Economic Data, St. Louis Fed) in bulk. Pass a list of FRED series IDs like GDP, UNRATE or CPIAUCSL and get clean date/value rows — with optional date range, units transforms and frequency aggregation. No API key required.

- **URL**: https://apify.com/scrapeworks/fred-economic-data.md
- **Developed by:** [Nicolas van Arkens](https://apify.com/scrapeworks) (community)
- **Categories:** Business, Developer tools, Other
- **Features:** Limited permissions
- **Stats:** 6 total users, 0 monthly users, 96.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 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.

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

## FRED Economic Data Fetcher

Pull economic time-series straight from **FRED — Federal Reserve Economic Data** (St. Louis Fed) as clean, flat JSON. Pass a **list of FRED series IDs** — GDP, unemployment, CPI, interest rates, and 800,000+ more — and get one tidy `date` + `value` row per observation. Optional date range, units transformations (percent change, year-over-year, etc.) and frequency aggregation. **No API key required.**

### What you get

One record per observation, ready for spreadsheets, dashboards or models:

| Field | Description |
|-------|-------------|
| `series_id` | The FRED series ID (e.g. `UNRATE`). |
| `date` | Observation date, `YYYY-MM-DD`. |
| `value` | The numeric value (or `null` for gaps/holidays). |
| `units_transform` | Transformation applied (`lin`, `pch`, `pc1`, …). |
| `series_title` | Human-readable series name — *with a FRED API key.* |
| `native_units` | The series' real units, e.g. "Percent" — *with a key.* |
| `native_frequency` | e.g. "Monthly", "Quarterly" — *with a key.* |
| `seasonal_adjustment` | e.g. "Seasonally Adjusted" — *with a key.* |
| `last_updated` | When FRED last revised the series — *with a key.* |

### Input

Everything is **bulk by default** — request as many series as you like in one run.

| Field | Type | Description |
|-------|------|-------------|
| `seriesIds` | array | One or more FRED series IDs, e.g. `["GDP", "UNRATE", "CPIAUCSL"]`. |
| `observationStart` / `observationEnd` | string | Optional `YYYY-MM-DD` date range. |
| `units` | enum | Transformation: `lin` (levels), `chg`, `ch1`, `pch`, `pc1`, `pca`, `log`. |
| `frequency` | enum | Aggregate to Daily/Weekly/Monthly/Quarterly/Annual (or keep native). |
| `aggregationMethod` | enum | When aggregating: `avg`, `sum`, or `eop` (end of period). |
| `sortOrder` | enum | Oldest-first or newest-first. |
| `apiKey` | string | Optional free FRED key — unlocks series metadata on every row. |
| `maxResultsPerSeries` | integer | Cap on observations per series. |

#### Input example

```json
{
  "seriesIds": ["GDP", "UNRATE", "CPIAUCSL"],
  "observationStart": "2015-01-01",
  "units": "lin",
  "sortOrder": "asc",
  "maxResultsPerSeries": 5000
}
```

#### Popular series IDs

- `GDP` — Gross Domestic Product
- `UNRATE` — Unemployment Rate
- `CPIAUCSL` — Consumer Price Index (CPI)
- `FEDFUNDS` — Federal Funds Effective Rate
- `DGS10` — 10-Year Treasury Constant Maturity Rate
- `MORTGAGE30US` — 30-Year Fixed Mortgage Rate
- `PAYEMS` — All Employees, Total Nonfarm (payrolls)
- `T10Y2Y` — 10-Year minus 2-Year Treasury Spread

### Output

```json
{
  "series_id": "UNRATE",
  "series_title": null,
  "date": "2024-01-01",
  "value": 3.7,
  "units_transform": "lin",
  "native_units": null,
  "native_frequency": null,
  "seasonal_adjustment": null,
  "last_updated": null,
  "ok": true
}
```

With a FRED API key the metadata fields (`series_title`, `native_units`, `native_frequency`, `seasonal_adjustment`, `last_updated`) are populated too.

### Use cases

- **Dashboards & reporting** — feed live macro indicators into Sheets, Power BI, or a web app.
- **Quant & research** — pull deep history for many series in one run for backtests and models.
- **Newsletters & content** — grab the latest CPI, jobs, or rates numbers on a schedule.

### FAQ

**Do I need a FRED API key?** No. The actor works out of the box using FRED's public CSV download. A free key (from fredaccount.stlouisfed.org/apikeys) simply adds series metadata to each row.

**How do I find a series ID?** Search on fred.stlouisfed.org — the ID is the short code in the series page URL and title (e.g. `UNRATE`).

**What about missing values?** Holidays/gaps come back as `value: null` rather than being dropped, so your time series stays aligned.

### Notes

- Uses the public FRED data endpoints. Independent tool, not affiliated with or endorsed by the Federal Reserve Bank of St. Louis.
- Error/"series not found" rows are returned with `ok: false` for transparency and are **never billed**.

# Actor input Schema

## `seriesIds` (type: `array`):

One entry per FRED series ID to fetch. Find IDs on fred.stlouisfed.org (the code shown in the series URL/title). Examples: GDP (Gross Domestic Product), UNRATE (Unemployment Rate), CPIAUCSL (Consumer Price Index), FEDFUNDS (Federal Funds Rate), DGS10 (10-Year Treasury Yield), PAYEMS (Nonfarm Payrolls), MORTGAGE30US (30-Year Mortgage Rate). Pass as many as you like — each returns its full history as date/value rows.

## `observationStart` (type: `string`):

Earliest observation date to include, as YYYY-MM-DD (e.g. 2010-01-01). Leave blank for the full available history of each series.

## `observationEnd` (type: `string`):

Latest observation date to include, as YYYY-MM-DD (e.g. 2024-12-31). Leave blank to include the most recent data.

## `units` (type: `string`):

Optional data transformation applied to every value. 'lin' = levels (raw values, default). 'chg' = change, 'ch1' = change from a year ago, 'pch' = percent change, 'pc1' = percent change from a year ago, 'pca' = compounded annual rate of change, 'log' = natural log.

## `frequency` (type: `string`):

Optionally aggregate higher-frequency data to a lower frequency (e.g. monthly to annual). Leave as 'Native' to keep each series' own frequency.

## `aggregationMethod` (type: `string`):

How to combine values when aggregating to a lower frequency (only used when Frequency is set). 'avg' = average, 'sum' = total, 'eop' = end of period.

## `sortOrder` (type: `string`):

Order observations by date, oldest first (ascending) or newest first (descending).

## `apiKey` (type: `string`):

Optional free FRED API key from fredaccount.stlouisfed.org/apikeys. When provided, each row is enriched with series metadata (title, native units, frequency, seasonal adjustment, last-updated date). Without a key the actor still works fully using FRED's public CSV download endpoint — you just get date/value rows without the extra metadata.

## `maxResultsPerSeries` (type: `integer`):

Cap on the number of observations returned for each series ID. Lower this to sample recent data; raise it to pull deep history.

## Actor input object example

```json
{
  "seriesIds": [
    "GDP",
    "UNRATE",
    "CPIAUCSL",
    "FEDFUNDS",
    "DGS10"
  ],
  "observationStart": "2015-01-01",
  "units": "lin",
  "frequency": "",
  "aggregationMethod": "avg",
  "sortOrder": "asc",
  "maxResultsPerSeries": 5000
}
```

# 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 = {
    "seriesIds": [
        "GDP",
        "UNRATE",
        "CPIAUCSL"
    ],
    "observationStart": "2015-01-01",
    "maxResultsPerSeries": 5000
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeworks/fred-economic-data").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 = {
    "seriesIds": [
        "GDP",
        "UNRATE",
        "CPIAUCSL",
    ],
    "observationStart": "2015-01-01",
    "maxResultsPerSeries": 5000,
}

# Run the Actor and wait for it to finish
run = client.actor("scrapeworks/fred-economic-data").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 '{
  "seriesIds": [
    "GDP",
    "UNRATE",
    "CPIAUCSL"
  ],
  "observationStart": "2015-01-01",
  "maxResultsPerSeries": 5000
}' |
apify call scrapeworks/fred-economic-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,scrapeworks/fred-economic-data"
        }
    }
}
```

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/R4aPiwdbc93AohjE1/builds/bZWIe1o0UW09jVfls/openapi.json
