QVeris
Yield Curve Data API Guide

Free Yield Curve API
Treasury Data

Compare free US Treasury yield curve data sources, then make a verified JSON or Python request across maturities.

Free Yield Curve API: Treasury Data Guide

TL;DR

What users need

A practical shortlist of free official or aggregated APIs, plus enough detail to make a first verified request.

Curve data people compare

Daily Treasury par yields, real yields, bill rates, maturities, history, and common curve spreads.

What “free” means

Check registration, API keys, quotas, licensing, attribution, formats, and production restrictions.

Best next step

Choose one source, inspect metadata, make a small request, validate provenance, then add caching.

What people want from a free yield curve API

Current results are dominated by API documentation, free tool pages, official Treasury feeds, and implementation guides. The primary intent is practical informational: find a free endpoint and retrieve current or historical yield curve observations programmatically. A secondary commercial-investigation intent appears when users compare key requirements, quotas, history, country coverage, and normalized JSON.

Data and features repeated across ranking pages

Recurring entities include the U.S. Treasury, FRED, Treasury par yield curve rates, real yield curves, 1-month through 30-year maturities, curve slope, historical observations, REST or XML access, JSON output, API keys, quotas, dates, units, and provenance.

Par, spot, forward, and real yield curves are different datasets

Before choosing a yield curve API, define what every point means. A curve is a set of rates indexed by maturity, but providers may publish different curve concepts, use different instruments as inputs, and apply different interpolation methods. The U.S. Treasury’s official nominal curve is a par curve: its constant-maturity values are read at fixed tenors from an estimated curve and may not equal the yield of any single outstanding security. It is not a live trade feed and it is not automatically a zero-coupon discount curve.

CurveMeaningTypical useDo not assume
Par curveCoupon rates that would price hypothetical bonds at par under the curve methodology.Market-rate overview, tenor comparison, benchmark communication.That each point is an actual traded bond.
Spot or zero curveRates for discounting one cash flow at each maturity.Present value, discount factors, cash-flow valuation.That a published par curve can be used without bootstrapping.
Forward curveRates implied between future dates by a spot curve and convention.Scenario analysis and implied-rate comparisons.That forward rates are unbiased forecasts.
Real curveInflation-indexed government-bond curve, such as Treasury TIPS inputs.Real discounting and inflation-compensation analysis.That nominal minus real is pure expected inflation.

Know the official U.S. Treasury methodology

Treasury states that its current par curve uses indicative bid-side quotations—not actual transactions—for recently auctioned securities near 3:30 PM Eastern on trading days. Prices are converted to yields, instantaneous forward rates are bootstrapped at input maturities, and a monotone-convex interpolation constructs the curve. The method replaced the former quasi-cubic Hermite approach on December 6, 2021. A historical pipeline should preserve this methodology break instead of treating the entire series as if it were generated identically.

Free yield curve API sources to evaluate

SourceTypical coverageInterfaceCheck before use
U.S. Treasury XML feedOfficial daily par yield curve rates and other Treasury rate datasets.Keyless GET requests returning XML.Dataset parameter, year filter, XML parsing, dates, and attribution.
FRED APIIndividual Treasury constant-maturity series with long histories.REST XML or JSON; free API key required.Series IDs, frequency, units, revisions, and joining maturities by date.
ECB Data PortalEuro-area government-bond par, spot, and forward curve series.ECB Data API and downloadable SDMX/CSV formats.Rating universe, curve type, maturity parameter, methodology, and calendar.
Other aggregatorsNormalized sovereign curves, sometimes across several countries.Usually REST JSON with provider-specific free terms.Original source, transformations, latency, licensing, and current status.

“Free” does not mean identical terms. Verify each provider’s documentation on the day you integrate it because authentication, quotas, acceptable use, and dataset availability can change.

How to use a free yield curve API with Python

1. Define the curve type, country, and maturities

Specify whether you need a nominal par curve, real curve, bill rates, spot curve, or forward curve; then define country, maturities, observation date, frequency, units, and required history. These curve types are not interchangeable.

2. Inspect metadata, authentication, and limits

Confirm curve type, tenor labels, unit, compounding basis, observation time, timezone, methodology, API-key requirement, rate limits, reuse license, and attribution before writing production code. Treat “10Y” as a tenor label until documentation confirms whether it is a constant-maturity point, a specific bond, or a modeled zero rate.

3. Make a small request and validate it

This Python example retrieves the official Treasury XML feed, extracts 2-year and 10-year constant-maturity par yields, and calculates the 2s10s slope in basis points. It keeps the observation date and source so the output remains auditable. It is an end-of-day curve example, not a real-time executable quote.

Python · Treasury 2s10s yield-curve slope
import requests
import xml.etree.ElementTree as ET

url = (
    "https://home.treasury.gov/resource-center/data-chart-center/"
    "interest-rates/pages/xml"
)
params = {
    "data": "daily_treasury_yield_curve",
    "field_tdr_date_value": "2025",
}
response = requests.get(url, params=params, timeout=30)
response.raise_for_status()
root = ET.fromstring(response.content)

ns = {
    "atom": "http://www.w3.org/2005/Atom",
    "m": "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata",
    "d": "http://schemas.microsoft.com/ado/2007/08/dataservices",
}

rows = []
for entry in root.findall("atom:entry", ns):
    props = entry.find("atom:content/m:properties", ns)
    if props is None:
        continue
    date = props.findtext("d:NEW_DATE", default="", namespaces=ns)
    y2 = props.findtext("d:BC_2YEAR", default="", namespaces=ns)
    y10 = props.findtext("d:BC_10YEAR", default="", namespaces=ns)
    if date and y2 and y10:
        rows.append({
            "date": date,
            "2y_percent": float(y2),
            "10y_percent": float(y10),
            "2s10s_bp": round((float(y10) - float(y2)) * 100, 1),
            "source": "U.S. Department of the Treasury",
        })

assert rows, "No complete 2Y/10Y observations returned"
print(rows[-1])

4. Add caching, retries, and provenance

Cache to match the release schedule, respect retry guidance, record retrieval time and series metadata, preserve the source URL, and monitor schema changes.

Validate a yield curve API response before publishing it

A successful HTTP response does not prove that a valid curve was returned. Validate provider, country, currency, curve family, nominal or real status, par/spot/forward type, tenor, unit, compounding convention, observation date, publication time and methodology version. Verify that all points in one curve share the same observation date. Missing tenors must remain missing; interpolating them is a model decision that needs a separate flag and method.

Use a wide-curve integrity check

Build a composite key from provider, curve type, country, currency, observation date and tenor. Reject duplicate tenor rows, percentages parsed as decimals without conversion, impossible tenor ordering, dates in the future, and curves assembled from mixed publication days. Compare several official values to the visible Treasury table. Preserve raw XML or JSON, request parameters, HTTP headers and retrieval time so a later reviewer can reproduce the snapshot.

Calculate 2s10s and other yield-curve spreads correctly

A curve spread is normally the longer-maturity yield minus the shorter-maturity yield for the same curve and observation date. For rates expressed in percent, multiply the percentage-point difference by 100 to report basis points. If the 10-year rate is 4.20% and the 2-year rate is 4.55%, then 2s10s equals −35 basis points. A negative slope is commonly described as an inversion. Do not reverse the subtraction silently, mix a real yield with a nominal yield, or combine closing observations from different dates.

An inversion is a signal, not a standalone forecast

2s10s, 3m10y and 10s30s measure different curve segments and can tell different stories. Their relationship with future growth depends on the sample, policy regime, market expectations and chosen horizon. A dashboard should state the exact legs, subtraction direction, units and observation date. An agent should describe what changed and cite the data, but avoid presenting one inverted spread as proof that a recession will occur on a specific date.

Build point-in-time yield-curve history without look-ahead bias

Align calendars and preserve the data available at the time

Yield curves are usually published on business days, so weekends and holidays are not zeros. A backtest must define whether a missing date remains missing or carries the most recent published curve forward; either choice should be explicit. Store observation time separately from retrieval time. If a provider later corrects history or changes methodology, a research pipeline may need both the latest corrected series and the snapshot originally available to the strategy. FRED’s observation API supports real-time periods and vintage parameters for applicable series, but those controls still require careful documentation and do not automatically make every derived spread point-in-time safe.

Do not manufacture unavailable maturities

The set of published Treasury maturities has changed over time. Some tenors begin later, and the 30-year constant-maturity series has a historical discontinuation and resumption. A stable modern column set can therefore create large historical gaps. Keep availability metadata, avoid backfilling a tenor before its official start, and flag any interpolation or proxy. When methodology changes, segment analysis or include a method indicator so apparent structural shifts are not mistaken for market signals.

Official Treasury feeds vs aggregated yield curve APIs

The U.S. Treasury feed is the strongest starting point when authority and direct provenance matter most. It publishes the curve observations and supporting definitions, but its XML format requires parsing and may be less convenient than a normalized JSON endpoint. Aggregators can simplify curve snapshots, spreads, cross-country coverage, and agent integrations, but their transformations and free-tier terms must be inspected.

When an aggregator is the better engineering choice

An aggregator is useful when the application needs one query model across several providers or countries. A normalized catalog can reduce discovery time, standardize common fields, and simplify prototypes, dashboards, comparative research, or agent tools. That convenience does not transfer authority to the aggregator. Always retain the original provider code, dataset code, series identifier, unit, frequency, retrieval timestamp, and source URL. Review whether the aggregator transforms values, renames dimensions, changes missing-value markers, delays updates, or applies a separate license. For high-impact outputs, compare representative observations with the original portal and define a fallback path to the producer’s service.

Validate metadata, revisions, and data quality before use

Do not treat a series label as a complete definition

Two “10-year Treasury” fields can represent different concepts: a constant-maturity par-curve point, a specific on-the-run bond quote, a monthly average, a real TIPS yield, or a derived spread leg. Capture title, curve family, input universe, methodology, unit, compounding convention, frequency, timezone, valuation time and publication schedule. Keep dimension codes together with their labels instead of relying on compact names such as 10Y.

Design explicitly for revisions and missing observations

Providers may correct observations, add a newly issued tenor, modify curve inputs, or change interpolation methodology. Decide whether the product shows the latest official history or preserves the curve retrieved on each date. Never convert a blank value to zero. Keep status flags and detect duplicated dates, unexpected tenor changes, unit shifts, mixed curve types, implausible jumps and a latest observation that is older than the documented publishing window.

Build a reliable production integration

Separate discovery, retrieval, normalization, and delivery

A maintainable pipeline gives each stage one responsibility. Discovery resolves a human request to a provider, dataset, and series. Retrieval calls the documented endpoint and stores the raw response with HTTP status, headers, request parameters, and retrieval time. Normalization converts dates, units, codes, and missing-value conventions into an internal schema without destroying the source representation. Delivery exposes the verified records to a dashboard, research notebook, database, API, or agent capability. Keeping the raw payload makes later debugging and reprocessing possible when a provider changes its schema or a transformation rule is corrected.

Match polling, caching, and retries to the release schedule

Treasury says its rates are usually available by 6:00 PM Eastern on trading days, although publication can be delayed. Poll around the documented window instead of continuously. Cache successful curves by provider, type and observation date; update the latest partition without rebuilding every year. Use bounded retry with backoff for temporary failures, never retry invalid parameters forever, and protect API keys outside client-side code. Alert on stale curves, missing tenors, schema changes and a sudden shift from percent to decimal units. A fallback source must represent the same curve concept—not merely return rates with similar maturity labels.

Common applications for yield curve data

Research, dashboards, alerts, and AI agents

Developers use the curve for fixed-income dashboards, maturity comparisons, 2s10s or 10s30s spread monitoring, recession-research inputs, discount-rate context, backtests, and data-aware agents. Historical research needs reproducible snapshots, while operational dashboards need the latest observation plus separate observation and retrieval timestamps.

For an AI agent, expose narrow operations such as “get the latest nominal par curve,” “retrieve a curve for one observation date,” or “calculate a named spread from matching tenors.” Define country, curve type, units, supported maturities, error states and provenance. The agent should cite the producer, state the observation date, distinguish sourced values from calculated spreads, and avoid treating forward rates or inversions as certain forecasts. QVeris can help discover, inspect, call and audit these capabilities while the original producer remains authoritative for values and methodology.

How QVeris helps with yield curve APIs

QVeris can help an agent discover, inspect, call, and audit real-world capabilities. For yield-curve data, each API should remain an inspectable capability with documented inputs, outputs, and provenance. QVeris does not own or change the underlying official data.

FAQ

Is there a free yield curve API?

Yes. The U.S. Treasury provides a keyless official XML feed, FRED exposes individual Treasury maturity series with a free key, and some aggregators offer limited free JSON access.

Where can I get US Treasury yield curve data?

Start with the U.S. Treasury daily interest-rate feed for direct provenance. FRED is useful when you want individual constant-maturity series and a JSON API.

Does FRED have a yield curve API?

FRED provides individual Treasury constant-maturity series through its API. To build a curve, request the required maturities and align observations by date.

How do I get yield curve data in Python?

Use requests or a maintained client, send a small date-bounded query, check HTTP status and JSON fields, then store the series ID, units, date, and source.

Is the Treasury yield curve a spot curve?

No. The main nominal constant-maturity table is a par yield curve. A zero-coupon spot curve must be obtained from a documented spot dataset or derived with a stated bootstrapping method.

How is the 2s10s yield spread calculated?

Subtract the 2-year yield from the 10-year yield for the same curve and observation date. Multiply a percentage-point difference by 100 to report basis points.

Does an inverted yield curve guarantee a recession?

No. Inversion is a market signal whose interpretation depends on the spread, sample, policy regime, and forecast horizon. It is not proof of a recession on a specific date.

Can QVeris replace the official provider?

No. QVeris helps agents discover and call capabilities; the provider remains authoritative for data, methods, licensing, and releases.

External references