apyhub
Back

US Treasury Yield Curve API

What it does

The US Treasury Yield Curve API returns U.S. yield curve data in one request. Send a mode, choose a curve, and add date or range fields when you need them. Use latest for the newest curve, date for one day, history for a time series, spreads for spread rows, or inversion for negative spread periods.

Choose nominal, real, bills, or longterm. For history-style calls, set startDate, endDate, and frequency to control the range and spacing. Use limit to cap the number of rows. Add maturities when you want only some terms, such as 2Y or 10Y.

The response gives billed units, row count, and an items list. Each row can include the date, curve name, source, yield values, spread values, a source link, and inversion flags.

Teams use it to build rate charts, Treasury dashboards, and macro data tools. They also use the US Treasury Yield Curve API to flag yield spread changes in alert jobs and internal reports.

POST
Treasury Yields API - US Yield Curve, Daily Rates, History
https://api.eu.apyhub.com/martin10291/us-treasury-yield-curve

QUICKSTART

GUIDE

Quickstart

Fetch the latest treasury yields with the default nominal curve.

curl -X POST "https://api.eu.apyhub.com/martin10291/us-treasury-yield-curve" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode":"latest","curve":"nominal"}'

What you'll get back

Returns a JSON object with billed as an integer, count as an integer, and items as an array of result objects.

Each item may include date, unit, curve, source, yields, spreads, sourceUrl, inverted10y2y, and inverted10y3m.

{
  "billed": 1,
  "count": 1,
  "items": [
    {
      "date": "2024-03-15",
      "unit": "percent",
      "curve": "nominal",
      "source": "Treasury",
      "yields": {},
      "spreads": {},
      "sourceUrl": "https://www.treasury.gov",
      "inverted10y2y": false,
      "inverted10y3m": false
    }
  ]
}
TRY ITLIVE · 100 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body
For mode date: the day you want, YYYY-MM-DD, for example 2024-03-15.
latest = the newest yield curve; date = one day (a holiday or weekend returns the previous business day and says so); history = every business day between Start and End date; spreads = spread time series only; inversion = periods when 10Y-2Y or 10Y-3M was negative inside the range.
nominal = daily par yield curve (1M-30Y, since 1990); real = real yield curve / TIPS (5Y-30Y, since 2003); bills = T-bill bank discount and coupon equivalent rates (since 2002); longterm = long-term composite and 20Y CMT (since 2000). Spreads and inversions use the nominal curve.

About this endpoint

What it does

Retrieves U.S. Treasury yield data for the selected curve and mode, including latest, date-specific, historical, spreads, or inversion results. The request body controls the date range, curve type, frequency, and optional maturity filter; the response returns a JSON object with billed units, row count, and an items array.

Request Body

ParameterTypeMandatoryDescription
dateStringNoFor mode: date, the day you want in YYYY-MM-DD format.
modeENUMNoOne of latest, date, history, spreads, inversion. latest returns the newest yield curve; date returns one day (a holiday or weekend returns the previous business day); history returns every business day between startDate and endDate; spreads returns spread time series only; inversion returns periods when 10Y-2Y or 10Y-3M was negative inside the range.
curveENUMNoOne of nominal, real, bills, longterm. nominal is the daily par yield curve (1M-30Y, since 1990); real is the real yield curve / TIPS (5Y-30Y, since 2003); bills is T-bill bank discount and coupon equivalent rates (since 2002); longterm is the long-term composite and 20Y CMT (since 2000). spreads and inversion use the nominal curve.
limitIntegerNoMaximum rows returned. Default 20. Must be between 1 and 100.
endDateStringNoFor history, spreads, and inversion: last day in YYYY-MM-DD format. Default is today.
frequencyENUMNoFor history and spreads, one of daily, weekly, monthly. daily means every business day; weekly means the last business day of each week; monthly means the last business day of each month.
startDateStringNoFor history, spreads, and inversion: first day in YYYY-MM-DD format. Default is 30 days before endDate. Maximum range is 40 years.
maturitiesString ArrayNoOptional filter for maturities such as 2Y, 10Y, 3M, or 30Y. Empty means every maturity of the curve. Maximum 100 items.

Response

Returns a JSON object with billed as an integer, count as an integer, and items as an array of objects. Each item contains date, unit, curve, source, yields, spreads, sourceUrl, inverted10y2y, and inverted10y3m.

ParameterTypeMandatoryDescription
billedIntegerNoUnits charged for this call. Only result rows are billed; not-found, unavailable, and invalid rows are free.
countIntegerNoNumber of rows in items.
itemsObject ArrayNoArray of result objects. Each object includes date, unit, curve, source, yields, spreads, sourceUrl, inverted10y2y, and inverted10y3m.
items[].dateStringNoResult date.
items[].unitStringNoUnit for the row.
items[].curveStringNoCurve identifier for the row.
items[].sourceStringNoData source for the row.
items[].yieldsObjectNoYield values for the row.
items[].spreadsObjectNoSpread values for the row.
items[].sourceUrlStringNoSource URL for the row.
items[].inverted10y2yBooleanNoWhether the 10Y-2Y spread is inverted for the row.
items[].inverted10y3mBooleanNoWhether the 10Y-3M spread is inverted for the row.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.