Treasury Yields (Snapshot)
curl --request GET \
--url https://api.financialdatasets.ai/macro/yield-curve/snapshot \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.financialdatasets.ai/macro/yield-curve/snapshot"
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/snapshot', 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/snapshot",
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/snapshot"
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/snapshot")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/macro/yield-curve/snapshot")
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
}
}{
"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
Snapshot
Get the latest US Treasury par yield curve: 1-month to 30-year yields for the most recent business day.
GET
/
macro
/
yield-curve
/
snapshot
Treasury Yields (Snapshot)
curl --request GET \
--url https://api.financialdatasets.ai/macro/yield-curve/snapshot \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.financialdatasets.ai/macro/yield-curve/snapshot"
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/snapshot', 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/snapshot",
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/snapshot"
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/snapshot")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/macro/yield-curve/snapshot")
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
}
}{
"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 Treasury Yields Snapshot API returns the most recent business day’s par yield curve as one object with one key per tenor. We source the data directly from authoritative government sources. The snapshot refreshes each evening after the day’s final curve is published. 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 |
|---|---|---|
| Latest business day | 14 | Daily |
Tenors
The object 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 that day.
Getting Started
There are only 2 steps for making a successful API call:- Add your API key to the header of the request as
X-API-KEY. - Execute the API request.
Example
Treasury Yields Snapshot
import requests
# add your API key to the headers
headers = {
"X-API-KEY": "your_api_key_here"
}
# create the URL
url = 'https://api.financialdatasets.ai/macro/yield-curve/snapshot'
# make API request
response = requests.get(url, headers=headers)
# parse the latest yield curve 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
}
}