Treasury Yields (Historical)
curl --request GET \
--url https://api.financialdatasets.ai/macro/yield-curve \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.financialdatasets.ai/macro/yield-curve"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.financialdatasets.ai/macro/yield-curve', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.financialdatasets.ai/macro/yield-curve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.financialdatasets.ai/macro/yield-curve"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.financialdatasets.ai/macro/yield-curve")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/macro/yield-curve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"yield_curve": [
{
"date": "<string>",
"1_month": 123,
"1_5_month": 123,
"2_month": 123,
"3_month": 123,
"4_month": 123,
"6_month": 123,
"1_year": 123,
"2_year": 123,
"3_year": 123,
"5_year": 123,
"7_year": 123,
"10_year": 123,
"20_year": 123,
"30_year": 123
}
],
"next_page_url": "<string>"
}{
"error": "Bad Request",
"message": "Invalid request parameters"
}{
"error": "Unauthorized",
"message": "Invalid API key provided"
}{
"error": "Payment Required",
"message": "This endpoint requires a paid subscription. Please upgrade your plan."
}{
"error": "Not Found",
"message": "Ticker XXXX not found"
}Treasury Yields
Treasury Yield Curve API
The daily US Treasury par yield curve since 1990: 14 tenors from 1-month to 30-year, in percent, one row per business day, updated daily.
GET
/
macro
/
yield-curve
Treasury Yields (Historical)
curl --request GET \
--url https://api.financialdatasets.ai/macro/yield-curve \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.financialdatasets.ai/macro/yield-curve"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.financialdatasets.ai/macro/yield-curve', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.financialdatasets.ai/macro/yield-curve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.financialdatasets.ai/macro/yield-curve"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.financialdatasets.ai/macro/yield-curve")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/macro/yield-curve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"yield_curve": [
{
"date": "<string>",
"1_month": 123,
"1_5_month": 123,
"2_month": 123,
"3_month": 123,
"4_month": 123,
"6_month": 123,
"1_year": 123,
"2_year": 123,
"3_year": 123,
"5_year": 123,
"7_year": 123,
"10_year": 123,
"20_year": 123,
"30_year": 123
}
],
"next_page_url": "<string>"
}{
"error": "Bad Request",
"message": "Invalid request parameters"
}{
"error": "Unauthorized",
"message": "Invalid API key provided"
}{
"error": "Payment Required",
"message": "This endpoint requires a paid subscription. Please upgrade your plan."
}{
"error": "Not Found",
"message": "Ticker XXXX not found"
}Overview
The Financial Datasets Treasury yield curve API returns the daily US Treasury par yield curve: one row per business day, with one key for each of 14 tenors from 1-month to 30-year. Values are par yields in percent. It covers 1990 to today, updated daily. The data comes directly from authoritative government sources (data provenance). You can call it as a REST endpoint with an API key, or from Claude, ChatGPT, Cursor, and other AI apps through the MCP server, or pay per request with x402. Pricing starts at $20. To get started, please create an account and grab your API key at financialdatasets.ai. You will use the API key to authenticate your API requests.Coverage
| History | Tenors | Updated |
|---|---|---|
| 1990 to today | 14 | Daily |
Tenors
Each row carriesdate plus these keys: 1_month, 1_5_month, 2_month, 3_month, 4_month, 6_month, 1_year, 2_year, 3_year, 5_year, 7_year, 10_year, 20_year, 30_year.
A tenor is null when it was not published on that date. These gaps are real, not missing data: the 20-year is absent before October 1993, the 30-year is absent from February 2002 to February 2006, the 2-month starts in October 2018, the 4-month starts in October 2022, and the 1.5-month starts in 2025. Weekends and market holidays have no row.
Getting Started
There are only 3 steps for making a successful API call:- Add your API key to the header of the request as
X-API-KEY. - Optionally add
start_dateandend_date(inclusive,YYYY-MM-DD). With no dates you get the trailing year. - Execute the API request.
next_page_url; request it as-is to get the next page. See the pagination guide.
Example
Treasury Yields
import requests
# add your API key to the headers
headers = {
"X-API-KEY": "your_api_key_here"
}
# set parameters
start_date = '2026-01-01' # optional
end_date = '2026-03-31' # optional
# create the URL with parameters
url = (
f'https://api.financialdatasets.ai/macro/yield-curve'
f'?start_date={start_date}'
f'&end_date={end_date}'
)
# make API request
response = requests.get(url, headers=headers)
# parse the yield curves from the response
yield_curve = response.json().get('yield_curve')
Example Response
{
"yield_curve": [
{
"date": "2026-01-02",
"1_month": 3.72,
"1_5_month": 3.71,
"2_month": 3.66,
"3_month": 3.65,
"4_month": 3.62,
"6_month": 3.58,
"1_year": 3.47,
"2_year": 3.47,
"3_year": 3.55,
"5_year": 3.74,
"7_year": 3.95,
"10_year": 4.19,
"20_year": 4.81,
"30_year": 4.86
}
]
}
FAQ
Which maturities are included?
14 tenors: 1, 1.5, 2, 3, 4, and 6 months, and 1, 2, 3, 5, 7, 10, 20, and 30 years.Why are some tenors null?
A tenor isnull when it was not published on that date. The 20-year is absent before October 1993, the 30-year is absent from February 2002 to February 2006, the 2-month starts in October 2018, the 4-month starts in October 2022, and the 1.5-month starts in 2025. Weekends and market holidays have no row.
How do I get the full history?
Pass astart_date in 1990 and follow next_page_url. Each page holds up to 100 rows, newest first. With no dates, you get the trailing year.
Can an AI agent use this data?
Yes. Claude, ChatGPT, Cursor, and other MCP clients reach it through the Financial Datasets MCP server. An agent with a wallet can also pay per request with x402, with no account.Authorizations
API key for authentication.
Query Parameters
The first date to return, inclusive, in YYYY-MM-DD format. Defaults to one year before end_date when both dates are omitted; omit it with an end_date to get all available history through that date.
The last date to return, inclusive, in YYYY-MM-DD format. Defaults to today.
Opaque pagination cursor from a previous response's next_page_url. When provided, all other query parameters are ignored: the cursor carries the original request's filters. Treat it as opaque; do not construct or modify it.