# 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
- **Stats:** 2 total users, 1 monthly users, 100.0% 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/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

## 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("💾 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 '{
  "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": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scrapeworks/fred-economic-data",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "FRED Economic Data Fetcher — Time Series & Indicators",
        "description": "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.",
        "version": "0.1",
        "x-build-id": "bZWIe1o0UW09jVfls"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapeworks~fred-economic-data/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapeworks-fred-economic-data",
                "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/scrapeworks~fred-economic-data/runs": {
            "post": {
                "operationId": "runs-sync-scrapeworks-fred-economic-data",
                "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/scrapeworks~fred-economic-data/run-sync": {
            "post": {
                "operationId": "run-sync-scrapeworks-fred-economic-data",
                "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": [
                    "seriesIds"
                ],
                "properties": {
                    "seriesIds": {
                        "title": "FRED series IDs",
                        "type": "array",
                        "description": "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.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "observationStart": {
                        "title": "Start date (optional)",
                        "type": "string",
                        "description": "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": {
                        "title": "End date (optional)",
                        "type": "string",
                        "description": "Latest observation date to include, as YYYY-MM-DD (e.g. 2024-12-31). Leave blank to include the most recent data."
                    },
                    "units": {
                        "title": "Units transformation",
                        "enum": [
                            "lin",
                            "chg",
                            "ch1",
                            "pch",
                            "pc1",
                            "pca",
                            "cch",
                            "cca",
                            "log"
                        ],
                        "type": "string",
                        "description": "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.",
                        "default": "lin"
                    },
                    "frequency": {
                        "title": "Frequency aggregation",
                        "enum": [
                            "",
                            "d",
                            "w",
                            "bw",
                            "m",
                            "q",
                            "sa",
                            "a"
                        ],
                        "type": "string",
                        "description": "Optionally aggregate higher-frequency data to a lower frequency (e.g. monthly to annual). Leave as 'Native' to keep each series' own frequency.",
                        "default": ""
                    },
                    "aggregationMethod": {
                        "title": "Aggregation method",
                        "enum": [
                            "avg",
                            "sum",
                            "eop"
                        ],
                        "type": "string",
                        "description": "How to combine values when aggregating to a lower frequency (only used when Frequency is set). 'avg' = average, 'sum' = total, 'eop' = end of period.",
                        "default": "avg"
                    },
                    "sortOrder": {
                        "title": "Sort order",
                        "enum": [
                            "asc",
                            "desc"
                        ],
                        "type": "string",
                        "description": "Order observations by date, oldest first (ascending) or newest first (descending).",
                        "default": "asc"
                    },
                    "apiKey": {
                        "title": "FRED API key (optional)",
                        "type": "string",
                        "description": "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": {
                        "title": "Max observations per series",
                        "minimum": 1,
                        "maximum": 100000,
                        "type": "integer",
                        "description": "Cap on the number of observations returned for each series ID. Lower this to sample recent data; raise it to pull deep history.",
                        "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
