Whether you are building a fixed-income dashboard, a macro research tool or just need a reliable source of sovereign bond yields inside your application, the Bonds API gives you a single REST endpoint for yields, yield curves and spreads across 60+ countries. In this post we'll walk through getting an API key, making your first call and plotting a basic yield curve.
What the API gives you
Latest yields for any sovereign maturity (1M to 30Y) with intraday updates.
Historical time series reaching back 5+ years so you can backtest models.
Yield curves pre-aggregated by country and date.
Spreads between any two countries for any tenor.
Sovereign credit ratings from S&P, Moody's and Fitch.
Every plan starts with a 7-day free trial. All endpoints are available on every tier — only rate limits differ.
1. Get your API key
Create a free account at bonds-api.com/register. Once logged in, open Dashboard → API Keys and copy the key. The key is passed as a query parameter on every request:
?api_key=YOUR_API_KEY
2. Your first call: latest US 10Y
Fetch the latest yield on the 10-year US Treasury:
curl "https://www.bonds-api.com/api/v1/yields/latest?country=US&maturity=10Y&api_key=YOUR_API_KEY"
Typical response:
{
"country_code": "US",
"maturity": "10Y",
"yield": 4.217,
"change_bps": -2.5,
"date": "2026-04-14T20:00:00Z",
"source": "US Treasury"
}
3. Build a yield curve in Python
Once you have the key, pulling a full curve is a two-line call:
import requests
API_KEY = "YOUR_API_KEY"
BASE = "https://www.bonds-api.com/api/v1"
r = requests.get(f"{BASE}/yields/curve", params={
"country": "US",
"date": "2026-04-14",
"api_key": API_KEY,
})
curve = r.json()["data"]
for point in curve:
print(point["maturity"], point["yield"])
Output:
1M 5.31
3M 5.24
6M 5.02
1Y 4.78
2Y 4.42
5Y 4.21
10Y 4.22
30Y 4.47
4. Comparing countries: US vs Germany 10Y spread
The /yields/spread endpoint returns a time series of the yield difference between two sovereigns:
curl "https://www.bonds-api.com/api/v1/yields/spread?base=US"e=DE&maturity=10Y&from=2026-01-01&to=2026-04-14&api_key=YOUR_API_KEY"
This is useful for monitoring the transatlantic spread, often a leading indicator of EUR/USD moves.
5. Rate limits and pagination
Starter — 1,000 calls/month, 60 req/min
Professional — 10,000 calls/month, 120 req/min
Enterprise — 100,000 calls/month, 300 req/min
Historical endpoints are paginated with page and limit query parameters. Max limit is 1,000 rows per page.
6. Error handling
All errors return a JSON envelope with an error key and an appropriate HTTP status:
{
"error": "API key is required. Pass it via api_key query parameter."
}
401 — missing or invalid key
402 — quota exhausted
404 — country or maturity not found
429 — rate limit hit
Where to go next
Head to the interactive API documentation at bonds-api.com/docs to try every endpoint live from the browser. If you need coverage, features or SLAs beyond the Enterprise plan, reach out at [email protected].
Happy building.
How to fetch sovereign bond yields with the Bonds API