Skip to content

FRED

Economic observations, historical vintages, revision intervals and discovery metadata

Connector software
Free and open source
Service credentials
Required
Use with an agent

Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.

npx skills add Query-farm/vgi-skills --skill orchard

Copy this request into your coding agent to get started.

Use https://query.farm/products/orchard/connectors/fred/index.md to help me query FRED with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.

Track the US unemployment rate since 2020

Uses your connected account. Set up the connector and credentials to run it with your data.

SELECT date, value
FROM fred.main.observations('UNRATE', observation_start := '2020-01-01')
ORDER BY date

Quick start

Choose where to run FRED, then follow the steps below.

The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.

1. Install the vgi extension

Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.

setup.sql
SET allow_extension_repositories = 'allowed';

CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
    WITH PREFIX 'https://duckdb-extensions.query.farm';

INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;

2. Attach the connector

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'fred' AS fred (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-fred-worker'
);

3. Add service credentials

After attaching, create the secret for the service you want to query in the same SQL session. Replace the placeholders with your service settings.

fred_api credentials

FRED API key, shared by FRED and ALFRED queries.

Get these credentials →
secret.sql
CREATE SECRET fred_api (
    TYPE fred_api,
    api_key '<FRED_API_API_KEY>'  -- secret
);
Credential fields and requirements →

4. Run a query

query.sql
SELECT date, value
FROM fred.main.observations('UNRATE', observation_start := '2020-01-01')
ORDER BY date
More example queries →
Technical details
Verified connector release
v0.2.0
Engine
2.0.1
VGI protocol
3.4.0
Verified on
December 1, 2026
Release notes on GitHub
Pin a version for production

When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.

Attach with uvx

Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.

ATTACH 'fred' AS fred (
  TYPE vgi,
  LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-fred-worker'
);

Overview

St. Louis Fed FRED and ALFRED economic time series as SQL tables, including current observations, historical vintages and revisions, and series, category, release and source discovery. Needs a free FRED API key.

Catalog

Everything fred exposes once attached — read straight from the worker's released build.

fred 1 schema
main 15 functions

FRED and ALFRED table functions: current observations, vintages, revisions and series discovery.

Schema examples (18)
Examples (18)

FRED Observations

SELECT date, value
FROM fred.main.observations('UNRATE', observation_start := '2020-01-01')
ORDER BY date;

ALFRED Historical Snapshot

SELECT date, value
FROM fred.main.alfred_observations('GDP', '2020-07-30', observation_start := '2020-01-01')
ORDER BY date;

ALFRED Revision History

SELECT date, value, realtime_start, realtime_end
FROM fred.main.alfred_revisions('GDP', observation_start := '2020-01-01', observation_end := '2020-01-01')
ORDER BY date, realtime_start;

ALFRED Initial Releases

SELECT date, value, realtime_start
FROM fred.main.initial_releases('GDP', observation_start := '2020-01-01')
ORDER BY date;
14 more examples

Compare each 2020 GDP quarter's first published value (initial_releases) with today's value (observations); revision is current minus first print, NULL where FRED reports a missing value

SELECT date, f.value AS first_value, c.value AS current_value,
  c.value - f.value AS revision
FROM fred.main.initial_releases('GDP', observation_start := '2020-01-01', observation_end := '2020-12-31') AS f
JOIN fred.main.observations('GDP', observation_start := '2020-01-01', observation_end := '2020-12-31') AS c USING (date)
ORDER BY date;

ALFRED Vintage Dates

SELECT vintage_date
FROM fred.main.vintage_dates('GDP', realtime_start := '2020-01-01', realtime_end := '2020-12-31')
ORDER BY vintage_date;

Trace the Q1 2020 GDP value (observation date 2020-01-01) as it stood on each 2020 vintage date: vintage_dates joined to the alfred_revisions validity interval covering it, from the first release on

SELECT v.vintage_date, r.value AS q1_2020_value
FROM fred.main.vintage_dates('GDP', realtime_start := '2020-01-01', realtime_end := '2020-12-31') AS v
JOIN fred.main.alfred_revisions('GDP', observation_start := '2020-01-01', observation_end := '2020-01-01') AS r ON v.vintage_date BETWEEN r.realtime_start AND r.realtime_end
ORDER BY v.vintage_date;

FRED Series Metadata

SELECT id, title, units, frequency FROM fred.main.series('GDP') ORDER BY id;

Search FRED Series

SELECT id, title, popularity
FROM fred.main.search_series('unemployment', max_rows := 20)
ORDER BY popularity DESC, id;

Of the top 100 'unemployment rate' search hits, show the 10 most popular that are filed in FRED's Unemployment Rate category (32447)

SELECT s.id, s.title, s.popularity
FROM fred.main.search_series('unemployment rate', max_rows := 100) AS s
WHERE s.id IN (SELECT id FROM fred.main.category_series(32447))
ORDER BY s.popularity DESC, s.id
LIMIT 10;

FRED Category

SELECT id, name, parent_id FROM fred.main.category(125) ORDER BY id;

FRED Category Children

SELECT id, name FROM fred.main.category_children(0) ORDER BY id;

FRED Category Series

SELECT id, title
FROM fred.main.category_series(125, max_rows := 100)
ORDER BY id;

FRED Releases

SELECT id, name FROM fred.main.releases() ORDER BY id;

FRED Release Series

SELECT id, title
FROM fred.main.release_series(53, max_rows := 100)
ORDER BY id;

FRED Release Calendar

SELECT release_id, date
FROM fred.main.release_dates(53, realtime_start := '2020-01-01', realtime_end := '2020-12-31')
ORDER BY date;

FRED Data Sources

SELECT id, name, link FROM fred.main.sources() ORDER BY id;

FRED Series Categories

SELECT id, name FROM fred.main.series_categories('GDP') ORDER BY id;
Table functions
alfred_observations (series_id VARCHAR, as_of VARCHAR, aggregation_method := VARCHAR, frequency := VARCHAR, max_rows := BIGINT, observation_end := VARCHAR, observation_start := VARCHAR, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, sort_order := VARCHAR, start_offset := BIGINT, units := VARCHAR) 1 example

Read observations known on the required as_of date; both real-time bounds equal that date.

Positional arguments
series_id VARCHAR
FRED series identifier, for example GDP or UNRATE.
as_of VARCHAR
Required historical knowledge date, YYYY-MM-DD. Sets both real-time bounds.
Named arguments
aggregation_method := VARCHAR
Frequency aggregation: average, sum, or end of period. · default "avg"
frequency := VARCHAR
Lower output frequency; empty preserves native frequency. FRED rejects upsampling. · default ""
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
observation_end := VARCHAR
Last measured period (YYYY-MM-DD), inclusive. · default "9999-12-31"
observation_start := VARCHAR
First measured period (YYYY-MM-DD), inclusive. · default "1776-07-04"
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
sort_order := VARCHAR
Order by observation date, ascending or descending. · default "asc"
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
units := VARCHAR
FRED transformation: lin, chg, ch1, pch, pc1, pca, cch, cca, log. · default "lin"
Returns columns
series_id VARCHAR
FRED series identifier.
date DATE
Period measured by the observation, not its publication date.
value DOUBLE
Numeric observation; FRED's missing marker '.' becomes SQL NULL.
value_text VARCHAR
Original numeric text, preserving decimal precision and the missing marker.
realtime_start DATE
First date this value is valid within the requested real-time window.
realtime_end DATE
Last inclusive validity date; 9999-12-31 denotes an open end.
Example

ALFRED Historical Snapshot

SELECT date, value
FROM fred.main.alfred_observations('GDP', '2020-07-30', observation_start := '2020-01-01')
ORDER BY date;
Link
alfred_revisions (series_id VARCHAR, aggregation_method := VARCHAR, frequency := VARCHAR, max_rows := BIGINT, observation_end := VARCHAR, observation_start := VARCHAR, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, sort_order := VARCHAR, start_offset := BIGINT, units := VARCHAR) 1 example

Read every value revision and its inclusive real-time validity interval; defaults to all history.

Positional arguments
series_id VARCHAR
FRED series identifier, for example GDP or UNRATE.
Named arguments
aggregation_method := VARCHAR
Frequency aggregation: average, sum, or end of period. · default "avg"
frequency := VARCHAR
Lower output frequency; empty preserves native frequency. FRED rejects upsampling. · default ""
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
observation_end := VARCHAR
Last measured period (YYYY-MM-DD), inclusive. · default "9999-12-31"
observation_start := VARCHAR
First measured period (YYYY-MM-DD), inclusive. · default "1776-07-04"
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Last real-time date, inclusive; defaults to open end. · default "9999-12-31"
realtime_start := VARCHAR
First real-time date, inclusive; defaults to all history. · default "1776-07-04"
sort_order := VARCHAR
Order by observation date, ascending or descending. · default "asc"
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
units := VARCHAR
FRED transformation: lin, chg, ch1, pch, pc1, pca, cch, cca, log. · default "lin"
Returns columns
series_id VARCHAR
FRED series identifier.
date DATE
Period measured by the observation, not its publication date.
value DOUBLE
Numeric observation; FRED's missing marker '.' becomes SQL NULL.
value_text VARCHAR
Original numeric text, preserving decimal precision and the missing marker.
realtime_start DATE
First date this value is valid within the requested real-time window.
realtime_end DATE
Last inclusive validity date; 9999-12-31 denotes an open end.
Example

ALFRED Revision History

SELECT date, value, realtime_start, realtime_end
FROM fred.main.alfred_revisions('GDP', observation_start := '2020-01-01', observation_end := '2020-01-01')
ORDER BY date, realtime_start;
Link
category (category_id BIGINT, max_rows := BIGINT, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, start_offset := BIGINT) 1 example

Look up one FRED category, including its parent and optional notes.

Positional arguments
category_id BIGINT
Nonnegative FRED category identifier; 0 is the root.
Named arguments
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
Returns columns
id BIGINT
Category identifier.
name VARCHAR
Category name.
parent_id BIGINT
Parent category; root category has identifier zero.
notes VARCHAR
Optional category notes.
Example

FRED Category

SELECT id, name, parent_id FROM fred.main.category(125) ORDER BY id;
Link
category_children (category_id BIGINT, max_rows := BIGINT, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, start_offset := BIGINT) 1 example

List immediate children of a FRED category; use category zero to start browsing the hierarchy.

Positional arguments
category_id BIGINT
Nonnegative FRED category identifier; 0 is the root.
Named arguments
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
Returns columns
id BIGINT
Category identifier.
name VARCHAR
Category name.
parent_id BIGINT
Parent category; root category has identifier zero.
notes VARCHAR
Optional category notes.
Example

FRED Category Children

SELECT id, name FROM fred.main.category_children(0) ORDER BY id;
Link
category_series (category_id BIGINT, max_rows := BIGINT, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, start_offset := BIGINT) 1 example

Stream series metadata in a FRED category, optionally as known during a historical real-time window.

Positional arguments
category_id BIGINT
Nonnegative FRED category identifier; 0 is the root.
Named arguments
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
Returns columns
id VARCHAR
FRED series identifier.
title VARCHAR
Series title.
observation_start DATE
First observation date.
observation_end DATE
Last observation date.
frequency VARCHAR
Native frequency description.
frequency_short VARCHAR
Native frequency abbreviation.
units VARCHAR
Measurement units.
units_short VARCHAR
Measurement units abbreviation.
seasonal_adjustment VARCHAR
Seasonal adjustment description.
seasonal_adjustment_short VARCHAR
Seasonal adjustment abbreviation.
last_updated TIMESTAMP WITH TIME ZONE
Last upstream update, normalized to UTC.
popularity BIGINT
FRED popularity score.
group_popularity BIGINT
Group popularity, when supplied by the endpoint.
notes VARCHAR
Source notes and attribution; NULL if absent.
realtime_start DATE
First inclusive real-time date for this metadata.
realtime_end DATE
Last inclusive real-time date for this metadata.
Example

FRED Category Series

SELECT id, title
FROM fred.main.category_series(125, max_rows := 100)
ORDER BY id;
Link
initial_releases (series_id VARCHAR, aggregation_method := VARCHAR, frequency := VARCHAR, max_rows := BIGINT, observation_end := VARCHAR, observation_start := VARCHAR, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, sort_order := VARCHAR, start_offset := BIGINT, units := VARCHAR) 2 examples

Read first published values using FRED output_type=4; defaults to the complete real-time history.

Positional arguments
series_id VARCHAR
FRED series identifier, for example GDP or UNRATE.
Named arguments
aggregation_method := VARCHAR
Frequency aggregation: average, sum, or end of period. · default "avg"
frequency := VARCHAR
Lower output frequency; empty preserves native frequency. FRED rejects upsampling. · default ""
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
observation_end := VARCHAR
Last measured period (YYYY-MM-DD), inclusive. · default "9999-12-31"
observation_start := VARCHAR
First measured period (YYYY-MM-DD), inclusive. · default "1776-07-04"
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Last real-time date, inclusive; defaults to open end. · default "9999-12-31"
realtime_start := VARCHAR
First real-time date, inclusive; defaults to all history. · default "1776-07-04"
sort_order := VARCHAR
Order by observation date, ascending or descending. · default "asc"
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
units := VARCHAR
FRED transformation: lin, chg, ch1, pch, pc1, pca, cch, cca, log. · default "lin"
Returns columns
series_id VARCHAR
FRED series identifier.
date DATE
Period measured by the observation, not its publication date.
value DOUBLE
Numeric observation; FRED's missing marker '.' becomes SQL NULL.
value_text VARCHAR
Original numeric text, preserving decimal precision and the missing marker.
realtime_start DATE
First date this value is valid within the requested real-time window.
realtime_end DATE
Last inclusive validity date; 9999-12-31 denotes an open end.
Examples (2)

ALFRED Initial Releases

SELECT date, value, realtime_start
FROM fred.main.initial_releases('GDP', observation_start := '2020-01-01')
ORDER BY date;

Compare each 2020 GDP quarter's first published value (initial_releases) with today's value (observations); revision is current minus first print, NULL where FRED reports a missing value

SELECT date, f.value AS first_value, c.value AS current_value,
  c.value - f.value AS revision
FROM fred.main.initial_releases('GDP', observation_start := '2020-01-01', observation_end := '2020-12-31') AS f
JOIN fred.main.observations('GDP', observation_start := '2020-01-01', observation_end := '2020-12-31') AS c USING (date)
ORDER BY date;
Link
observations (series_id VARCHAR, aggregation_method := VARCHAR, frequency := VARCHAR, max_rows := BIGINT, observation_end := VARCHAR, observation_start := VARCHAR, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, sort_order := VARCHAR, start_offset := BIGINT, units := VARCHAR) 1 example

Read current FRED observations with optional transformations and frequency aggregation.

Positional arguments
series_id VARCHAR
FRED series identifier, for example GDP or UNRATE.
Named arguments
aggregation_method := VARCHAR
Frequency aggregation: average, sum, or end of period. · default "avg"
frequency := VARCHAR
Lower output frequency; empty preserves native frequency. FRED rejects upsampling. · default ""
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
observation_end := VARCHAR
Last measured period (YYYY-MM-DD), inclusive. · default "9999-12-31"
observation_start := VARCHAR
First measured period (YYYY-MM-DD), inclusive. · default "1776-07-04"
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
sort_order := VARCHAR
Order by observation date, ascending or descending. · default "asc"
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
units := VARCHAR
FRED transformation: lin, chg, ch1, pch, pc1, pca, cch, cca, log. · default "lin"
Returns columns
series_id VARCHAR
FRED series identifier.
date DATE
Period measured by the observation, not its publication date.
value DOUBLE
Numeric observation; FRED's missing marker '.' becomes SQL NULL.
value_text VARCHAR
Original numeric text, preserving decimal precision and the missing marker.
realtime_start DATE
First date this value is valid within the requested real-time window.
realtime_end DATE
Last inclusive validity date; 9999-12-31 denotes an open end.
Example

FRED Observations

SELECT date, value
FROM fred.main.observations('UNRATE', observation_start := '2020-01-01')
ORDER BY date;
Link
release_dates (release_id BIGINT, include_release_dates_with_no_data := BOOLEAN, max_rows := BIGINT, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, sort_order := VARCHAR, start_offset := BIGINT) 1 example

List publisher release dates; these dates do not guarantee when data became available in FRED.

Positional arguments
release_id BIGINT
Positive FRED release identifier.
Named arguments
include_release_dates_with_no_data := BOOLEAN
Include scheduled release dates with no data yet. · default false
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Latest release date, inclusive. · default "9999-12-31"
realtime_start := VARCHAR
Earliest release date, inclusive. · default "1776-07-04"
sort_order := VARCHAR
Order of release dates. · default "asc"
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
Returns columns
release_id BIGINT
Release identifier.
date DATE
Publisher's release date; not necessarily FRED availability time.
Example

FRED Release Calendar

SELECT release_id, date
FROM fred.main.release_dates(53, realtime_start := '2020-01-01', realtime_end := '2020-12-31')
ORDER BY date;
Link
release_series (release_id BIGINT, max_rows := BIGINT, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, start_offset := BIGINT) 1 example

Stream the series belonging to an economic release, with units, frequency and source notes.

Positional arguments
release_id BIGINT
Positive FRED release identifier.
Named arguments
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
Returns columns
id VARCHAR
FRED series identifier.
title VARCHAR
Series title.
observation_start DATE
First observation date.
observation_end DATE
Last observation date.
frequency VARCHAR
Native frequency description.
frequency_short VARCHAR
Native frequency abbreviation.
units VARCHAR
Measurement units.
units_short VARCHAR
Measurement units abbreviation.
seasonal_adjustment VARCHAR
Seasonal adjustment description.
seasonal_adjustment_short VARCHAR
Seasonal adjustment abbreviation.
last_updated TIMESTAMP WITH TIME ZONE
Last upstream update, normalized to UTC.
popularity BIGINT
FRED popularity score.
group_popularity BIGINT
Group popularity, when supplied by the endpoint.
notes VARCHAR
Source notes and attribution; NULL if absent.
realtime_start DATE
First inclusive real-time date for this metadata.
realtime_end DATE
Last inclusive real-time date for this metadata.
Example

FRED Release Series

SELECT id, title
FROM fred.main.release_series(53, max_rows := 100)
ORDER BY id;
Link
releases (max_rows := BIGINT, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, start_offset := BIGINT) 1 example

List economic data releases and publisher links, optionally within a historical real-time window.

Named arguments
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
Returns columns
id BIGINT
Release identifier.
name VARCHAR
Release name.
press_release BOOLEAN
Whether the release has a press release.
link VARCHAR
Upstream publisher URL.
notes VARCHAR
Optional release notes.
realtime_start DATE
First inclusive real-time date.
realtime_end DATE
Last inclusive real-time date.
Example

FRED Releases

SELECT id, name FROM fred.main.releases() ORDER BY id;
Link
search_series (search_text VARCHAR, exclude_tag_names := VARCHAR, filter_value := VARCHAR, filter_variable := VARCHAR, max_rows := BIGINT, order_by := VARCHAR, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, search_type := VARCHAR, sort_order := VARCHAR, start_offset := BIGINT, tag_names := VARCHAR) 2 examples

Search FRED series by text or identifier, optionally restricting tags, metadata and real-time dates.

Positional arguments
search_text VARCHAR
Words to search in series metadata.
Named arguments
exclude_tag_names := VARCHAR
Optional semicolon-separated excluded FRED tags. · default ""
filter_value := VARCHAR
Value paired with filter_variable, e.g. Monthly. · default ""
filter_variable := VARCHAR
Optional metadata property to filter; requires filter_value. · default ""
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
order_by := VARCHAR
Upstream sort field; defaults to search relevance. · default "search_rank"
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
search_type := VARCHAR
Search full metadata or series identifiers. · default "full_text"
sort_order := VARCHAR
Upstream sort direction. · default "desc"
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
tag_names := VARCHAR
Optional semicolon-separated required FRED tags. · default ""
Returns columns
id VARCHAR
FRED series identifier.
title VARCHAR
Series title.
observation_start DATE
First observation date.
observation_end DATE
Last observation date.
frequency VARCHAR
Native frequency description.
frequency_short VARCHAR
Native frequency abbreviation.
units VARCHAR
Measurement units.
units_short VARCHAR
Measurement units abbreviation.
seasonal_adjustment VARCHAR
Seasonal adjustment description.
seasonal_adjustment_short VARCHAR
Seasonal adjustment abbreviation.
last_updated TIMESTAMP WITH TIME ZONE
Last upstream update, normalized to UTC.
popularity BIGINT
FRED popularity score.
group_popularity BIGINT
Group popularity, when supplied by the endpoint.
notes VARCHAR
Source notes and attribution; NULL if absent.
realtime_start DATE
First inclusive real-time date for this metadata.
realtime_end DATE
Last inclusive real-time date for this metadata.
Examples (2)

Search FRED Series

SELECT id, title, popularity
FROM fred.main.search_series('unemployment', max_rows := 20)
ORDER BY popularity DESC, id;

Of the top 100 'unemployment rate' search hits, show the 10 most popular that are filed in FRED's Unemployment Rate category (32447)

SELECT s.id, s.title, s.popularity
FROM fred.main.search_series('unemployment rate', max_rows := 100) AS s
WHERE s.id IN (SELECT id FROM fred.main.category_series(32447))
ORDER BY s.popularity DESC, s.id
LIMIT 10;
Link
series (series_id VARCHAR, max_rows := BIGINT, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, start_offset := BIGINT) 1 example

Read units, frequency, source notes and update timestamps for a series, optionally as historically known.

Positional arguments
series_id VARCHAR
FRED series identifier, for example GDP or UNRATE.
Named arguments
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
Returns columns
id VARCHAR
FRED series identifier.
title VARCHAR
Series title.
observation_start DATE
First observation date.
observation_end DATE
Last observation date.
frequency VARCHAR
Native frequency description.
frequency_short VARCHAR
Native frequency abbreviation.
units VARCHAR
Measurement units.
units_short VARCHAR
Measurement units abbreviation.
seasonal_adjustment VARCHAR
Seasonal adjustment description.
seasonal_adjustment_short VARCHAR
Seasonal adjustment abbreviation.
last_updated TIMESTAMP WITH TIME ZONE
Last upstream update, normalized to UTC.
popularity BIGINT
FRED popularity score.
group_popularity BIGINT
Group popularity, when supplied by the endpoint.
notes VARCHAR
Source notes and attribution; NULL if absent.
realtime_start DATE
First inclusive real-time date for this metadata.
realtime_end DATE
Last inclusive real-time date for this metadata.
Example

FRED Series Metadata

SELECT id, title, units, frequency FROM fred.main.series('GDP') ORDER BY id;
Link
series_categories (series_id VARCHAR, max_rows := BIGINT, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, start_offset := BIGINT) 1 example

Find the categories containing a series, to navigate to related economic indicators.

Positional arguments
series_id VARCHAR
FRED series identifier, for example GDP or UNRATE.
Named arguments
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
Returns columns
id BIGINT
Category identifier.
name VARCHAR
Category name.
parent_id BIGINT
Parent category; root category has identifier zero.
notes VARCHAR
Optional category notes.
Example

FRED Series Categories

SELECT id, name FROM fred.main.series_categories('GDP') ORDER BY id;
Link
sources (max_rows := BIGINT, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, start_offset := BIGINT) 1 example

List economic data publishers and their links, with optional historical real-time bounds.

Named arguments
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Inclusive real-time end (YYYY-MM-DD); empty pins today in St. Louis. · default ""
realtime_start := VARCHAR
Inclusive real-time start (YYYY-MM-DD); empty pins today in St. Louis. · default ""
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
Returns columns
id BIGINT
Source identifier.
name VARCHAR
Data publisher name.
link VARCHAR
Data publisher URL.
notes VARCHAR
Optional source notes.
realtime_start DATE
First inclusive real-time date.
realtime_end DATE
Last inclusive real-time date.
Example

FRED Data Sources

SELECT id, name, link FROM fred.main.sources() ORDER BY id;
Link
vintage_dates (series_id VARCHAR, max_rows := BIGINT, page_size := BIGINT, realtime_end := VARCHAR, realtime_start := VARCHAR, sort_order := VARCHAR, start_offset := BIGINT) 2 examples

Discover dates when observations were added or revised; defaults to all available vintage dates.

Positional arguments
series_id VARCHAR
FRED series identifier, for example GDP or UNRATE.
Named arguments
max_rows := BIGINT
Maximum returned rows; 0 streams all matches. · default 0
page_size := BIGINT
Rows per upstream request, 1-1000. · default 1000
realtime_end := VARCHAR
Latest vintage date, inclusive. · default "9999-12-31"
realtime_start := VARCHAR
Earliest vintage date, inclusive. · default "1776-07-04"
sort_order := VARCHAR
Order of vintage dates. · default "asc"
start_offset := BIGINT
Number of matching upstream rows to skip. · default 0
Returns columns
series_id VARCHAR
FRED series identifier.
vintage_date DATE
Date when observations were added or revised.
Examples (2)

ALFRED Vintage Dates

SELECT vintage_date
FROM fred.main.vintage_dates('GDP', realtime_start := '2020-01-01', realtime_end := '2020-12-31')
ORDER BY vintage_date;

Trace the Q1 2020 GDP value (observation date 2020-01-01) as it stood on each 2020 vintage date: vintage_dates joined to the alfred_revisions validity interval covering it, from the first release on

SELECT v.vintage_date, r.value AS q1_2020_value
FROM fred.main.vintage_dates('GDP', realtime_start := '2020-01-01', realtime_end := '2020-12-31') AS v
JOIN fred.main.alfred_revisions('GDP', observation_start := '2020-01-01', observation_end := '2020-01-01') AS r ON v.vintage_date BETWEEN r.realtime_start AND r.realtime_end
ORDER BY v.vintage_date;
Link

Credentials

The secret type fred declares, as reported by the worker itself.

fred_api

How to get these credentials

FRED API key, shared by FRED and ALFRED queries.

secret.sql
CREATE SECRET fred_api (
    TYPE fred_api,
    api_key '<FRED_API_API_KEY>'  -- secret
);
Key Type Required Description
api_key secret VARCHAR — Your FRED API key.

The worker doesn't mark which keys are required.

Create the secret in the same session, after attaching fred — the worker registers its secret types at ATTACH. Keys marked secret are masked in duckdb_secrets(); angle-bracket values are placeholders. Read credentials from your environment or secret store in your application and pass them through your SQL client’s parameter bindings. Keep real values out of saved SQL and history. Native DuckDB and Haybarn do not provide a SQL getenv() function.

Try these queries

sources_columns — Show the columns sources() returns without an API key: binding the function with LIMIT 0 resolves its schema and makes no FRED API request

SELECT * FROM fred.main.sources() LIMIT 0;

Uses sources

ALFRED Historical Snapshot

SELECT date, value
FROM fred.main.alfred_observations('GDP', '2020-07-30', observation_start := '2020-01-01')
ORDER BY date

Uses alfred_observations

ALFRED Revision History

SELECT date, value, realtime_start, realtime_end
FROM fred.main.alfred_revisions('GDP', observation_start := '2020-01-01', observation_end := '2020-01-01')
ORDER BY date, realtime_start

Uses alfred_revisions

ALFRED Initial Releases

SELECT date, value, realtime_start
FROM fred.main.initial_releases('GDP', observation_start := '2020-01-01')
ORDER BY date

Uses initial_releases

ALFRED Vintage Dates

SELECT vintage_date
FROM fred.main.vintage_dates('GDP', realtime_start := '2020-01-01', realtime_end := '2020-12-31')
ORDER BY vintage_date

Uses vintage_dates

FRED Series Metadata

SELECT id, title, units, frequency FROM fred.main.series('GDP') ORDER BY id

Uses series

12 more examples in the Catalog, each listed under the table or function it uses.

FRED is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.