You need reliable Denmark government bond yields that your models and dashboards can consume directly. By the end of this guide you will be able to fetch Denmark (DK) sovereign yields across maturities, pull historical and intraday data, compute spreads to benchmarks, and assemble a full DK yield curve via simple GET requests to the Bonds API, then integrate those responses in Python, JavaScript, or PHP.
What you get from the Bonds API for Denmark
Bonds API delivers sovereign bond yields as JSON over HTTPS. For Denmark (ISO2: DK), you can request:
- Latest yields by maturity, with official source tags
- Historical yields on a specific date
- Daily time series between two dates
- Spreads versus benchmarks (e.g., US Treasuries)
- Full DK yield curve snapshots (1M out to 30Y and beyond when available)
- Intraday snapshots with UTC timestamps
- Fluctuations: change, min, max over a window
All endpoints are GET-only under the base URL https://bonds-api.com/api/v1/ and authenticated via the X-API-Key header. Yields are expressed as percentages (e.g., 4.52 means 4.52%). Spreads are returned in basis points (bps), where 1 bps = 0.01%.
Reference: see the API and product overview at bonds-api.com. To start making calls, create your key: Register. For managed connectivity and MCP tools, explore MCP.
Domain context: sovereign bonds and yields
Denmark’s sovereign bond market is anchored by government securities issued in DKK. Analysts track the level and slope of the yield curve to infer policy stance, growth expectations, and term premium. Developers need clean maturity keys (e.g., 2Y, 10Y) and consistent date formats to surface real-time insights safely in production systems. Bonds API provides standardized maturity identifiers and date strings formatted as YYYY-MM-DD, suitable for charting, risk calculations, and alerts.
Endpoint: Latest — current Denmark yields
Use this endpoint to fetch the most recent yields for selected DK maturities. If you omit “maturities”, you’ll receive all available tenors for Denmark on the latest business day with data.
cURL
curl -s "https://bonds-api.com/api/v1/latest?countries=US&maturities=10Y&api_key=YOUR_API_KEY"
Official JSON example
{
"success": true,
"date": "2026-11-13",
"rates": {
"US_10Y": 5.129
},
"dates": {
"US_10Y": "2026-11-13"
},
"currencies": {
"US_10Y": "USD"
},
"meta": {
"request_id": "573546fc-f82b-4f15-9f35-4ad21b42c42c",
"timestamp": "2026-11-13T00:04:05+00:00"
}
}
How to read it:
- yield: percentage value, not bps. 4.52 means 4.52%.
- date: YYYY-MM-DD, the market date of the yield, typically the latest business day.
- source: “official” denotes official market or primary data source.
Python (requests)
import requests
headers = {"X-API-Key": "YOUR_API_KEY"}
params = {"countries": "DK", "maturities": "2Y,10Y"}
r = requests.get("https://bonds-api.com/api/v1/latest", headers=headers, params=params)
r.raise_for_status()
data = r.json()
dk_2y = data["data"]["DK"]["2Y"]["yield"]
dk_10y = data["data"]["DK"]["10Y"]["yield"]
dk_date = data["data"]["DK"]["10Y"]["date"]
print("DK 2Y:", dk_2y, "DK 10Y:", dk_10y, "Date:", dk_date)
JavaScript (fetch)
const url = "https://bonds-api.com/api/v1/latest?countries=DK&maturities=2Y,10Y";
fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(json => {
const dk2y = json.data.DK["2Y"].yield;
const dk10y = json.data.DK["10Y"].yield;
const date = json.data.DK["10Y"].date;
console.log("DK 2Y:", dk2y, "DK 10Y:", dk10y, "Date:", date);
});
PHP (file_get_contents)
<?php
$context = stream_context_create([
"http" => [
"method" => "GET",
"header" => "X-API-Key: YOUR_API_KEY\r\n"
]
]);
$url = "https://bonds-api.com/api/v1/latest?countries=DK&maturities=2Y,10Y";
$json = file_get_contents($url, false, $context);
$data = json_decode($json, true);
echo "DK 10Y: " . $data["data"]["DK"]["10Y"]["yield"] . "% on " . $data["data"]["DK"]["10Y"]["date"];
Endpoint: Historical — yield on a specific date
Fetch the Denmark yield for a single maturity on a given historical market date. Useful for point-in-time backtests, event studies, or end-of-period valuations.
cURL
Official JSON example
Interpretation:
- date: the target calendar date; if it is a non-business day, data will be available when the API has a recorded value for that date, based on the dataset policy. Handle 404 for missing observations.
- yield: percent.
Python
import requests
headers = {"X-API-Key": "YOUR_API_KEY"}
params = {"country": "DK", "maturity": "10Y", "date": "2025-06-15"}
r = requests.get("https://bonds-api.com/api/v1/historical", headers=headers, params=params)
r.raise_for_status()
h = r.json()
print(f"DK {h['maturity']} on {h['date']}: {h['yield']}%")
JavaScript
const u = "https://bonds-api.com/api/v1/historical?country=DK&maturity=10Y&date=2025-06-15";
fetch(u, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(h => console.log(`DK ${h.maturity} on ${h.date}: ${h.yield}%`));
PHP (Guzzle)
<?php
require 'vendor/autoload.php';
$client = new \GuzzleHttp\Client([
'base_uri' => 'https://bonds-api.com/api/v1/',
'headers' => ['X-API-Key' => 'YOUR_API_KEY']
]);
$res = $client->get('historical', [
'query' => ['country' => 'DK', 'maturity' => '10Y', 'date' => '2025-06-15']
]);
$h = json_decode($res->getBody(), true);
echo "DK {$h['maturity']} on {$h['date']}: {$h['yield']}%";
Endpoint: Time series — Denmark yields between two dates
Request a daily series for a given maturity across a date range. This is the foundation for charts, regressions, and volatility analysis.
cURL
Official JSON example
Notes:
- series: an array of daily observations, each with date (YYYY-MM-DD) and yield (%).
- Missing days reflect weekends/holidays; do not assume continuity.
Python
import requests
headers = {"X-API-Key": "YOUR_API_KEY"}
params = {"country": "DK", "maturity": "10Y", "start": "2025-11-13", "end": "2026-11-13"}
r = requests.get("https://bonds-api.com/api/v1/timeseries", headers=headers, params=params)
r.raise_for_status()
ts = r.json()["series"]
returns = []
for i in range(1, len(ts)):
prev, cur = ts[i-1]["yield"], ts[i]["yield"]
returns.append(cur - prev)
print("Obs:", len(ts), "First diff:", returns[0] if returns else None)
JavaScript
const params = "country=DK&maturity=10Y&start=2025-11-13&end=2026-11-13";
fetch("https://bonds-api.com/api/v1/timeseries?" + params, {
headers: { "X-API-Key": "YOUR_API_KEY" }
}).then(r => r.json()).then(json => {
const dates = json.series.map(p => p.date);
const yields = json.series.map(p => p.yield);
console.log(dates[0], yields[0]);
});
PHP (file_get_contents)
<?php
$ctx = stream_context_create(["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$url = "https://bonds-api.com/api/v1/timeseries?country=DK&maturity=10Y&start=2025-11-13&end=2026-11-13";
$data = json_decode(file_get_contents($url, false, $ctx), true);
echo "First date: " . $data["series"][0]["date"] . " yield: " . $data["series"][0]["yield"] . "%";
Endpoint: Spread — Denmark vs benchmark
Compute the spread between Denmark and a benchmark country for a given maturity (default 10Y) in basis points. Use this for cross-market relative value, hedging calibration, and risk dashboards.
cURL
Official JSON example
Field meanings:
- spread_bps: Denmark yield minus benchmark yield, in basis points (bps).
- country_yield, benchmark_yield: both in percent.
Python
import requests
r = requests.get(
"https://bonds-api.com/api/v1/spread",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "DK", "benchmark": "US", "maturity": "10Y"}
)
s = r.json()
print(f"DK vs {s['benchmark']} {s['maturity']} spread: {s['spread_bps']} bps")
JavaScript
const qs = "country=DK&benchmark=US&maturity=10Y";
fetch("https://bonds-api.com/api/v1/spread?" + qs, { headers: { "X-API-Key": "YOUR_API_KEY" }})
.then(r => r.json())
.then(s => console.log(`Spread: ${s.spread_bps} bps (DK ${s.country_yield}% vs US ${s.benchmark_yield}%)`));
PHP
<?php
$ctx = stream_context_create(["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$url = "https://bonds-api.com/api/v1/spread?country=DK&benchmark=US&maturity=10Y";
$s = json_decode(file_get_contents($url, false, $ctx), true);
echo "DK vs {$s['benchmark']} {$s['maturity']} spread: {$s['spread_bps']} bps";
Endpoint: Curve — full Denmark yield curve
Request a complete yield curve snapshot for Denmark. Optionally specify a date; otherwise, you get the latest available market day.
cURL
Official JSON example
Key points:
- curve: map of maturity to yield (%). Use the keys exactly as returned (e.g., “1M”, “2Y”).
- inverted: boolean flag, true if short maturities exceed long maturities in aggregate.
- date: the market date of the curve, YYYY-MM-DD.
Build a chart-ready backbone
| Maturity | Typical Usage |
|---|---|
| 1M, 3M, 6M | T-bill rates, front-end policy sensitivity |
| 1Y, 2Y | Policy path expectations, near-term term premium |
| 5Y, 10Y | Benchmark duration points, macro signals |
| 30Y | Long-term discounting, ALM |
Python
import requests
r = requests.get("https://bonds-api.com/api/v1/curve",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "DK"})
curve = r.json()
tenors = ["1M","3M","6M","1Y","2Y","5Y","10Y","30Y"]
points = [(t, curve["curve"].get(t)) for t in tenors if t in curve["curve"]]
print("Inverted:", curve["inverted"], "Points:", points)
JavaScript
const u2 = "https://bonds-api.com/api/v1/curve?country=DK";
fetch(u2, { headers: { "X-API-Key": "YOUR_API_KEY" }})
.then(r => r.json())
.then(c => {
console.log("Date:", c.date, "Inverted:", c.inverted);
Object.entries(c.curve).forEach(([tenor, y]) => console.log(tenor, y));
});
PHP
<?php
$ctx = stream_context_create(["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$cu = json_decode(file_get_contents("https://bonds-api.com/api/v1/curve?country=DK", false, $ctx), true);
echo "Curve date: {$cu['date']}, inverted: " . ($cu['inverted'] ? "true" : "false");
Endpoint: Intraday — DK snapshots through the day
Get multiple yield checkpoints across a given date for a maturity. Useful for trading dashboards and monitoring moves around releases.
cURL
Official JSON example
Fields:
- snapshots: array of yield (%) with fetched_at in ISO 8601 UTC (Z suffix).
- meta.timezone: data timestamps are UTC.
- count: snapshot count for that date.
Python
import requests, datetime
r = requests.get("https://bonds-api.com/api/v1/intraday",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country":"DK","maturity":"10Y","date":"2026-11-13"})
itd = r.json()
for s in itd["snapshots"]:
ts = datetime.datetime.fromisoformat(s["fetched_at"].replace("Z","+00:00"))
print(ts, s["yield"], s["source"])
JavaScript
const q = "country=DK&maturity=10Y&date=2026-11-13";
fetch("https://bonds-api.com/api/v1/intraday?" + q, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(x => x.snapshots.forEach(s => console.log(new Date(s.fetched_at), s.yield)));
PHP
<?php
$ctx = stream_context_create(["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$u = "https://bonds-api.com/api/v1/intraday?country=DK&maturity=10Y&date=2026-11-13";
$j = json_decode(file_get_contents($u, false, $ctx), true);
echo "Snapshots: " . $j["count"] . " TZ: " . $j["meta"]["timezone"];
Endpoint: Fluctuation — change, min, max over a period
Summarize movement over a window for one or more countries at a chosen maturity. Perfect for alerting and weekly/monthly wrap-ups.
cURL
Official JSON example
All yield values are percent. change is end_yield − start_yield in percent points (not bps). Convert to bps by multiplying by 100.
Python
import requests
r = requests.get("https://bonds-api.com/api/v1/fluctuation",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"countries":"DK","maturity":"10Y","start":"2025-11-13","end":"2026-11-13"})
f = r.json()["data"]["DK"]
print("Change (bps):", round(f["change"]*100, 1), "Min:", f["min"], "Max:", f["max"])
JavaScript
const fq = "countries=DK&maturity=10Y&start=2025-11-13&end=2026-11-13";
fetch("https://bonds-api.com/api/v1/fluctuation?" + fq, { headers: { "X-API-Key": "YOUR_API_KEY" }})
.then(r => r.json())
.then(f => {
const d = f.data.DK;
console.log("Δ bps:", (d.change*100).toFixed(1), "range:", d.min, "-", d.max);
});
PHP
<?php
$ctx = stream_context_create(["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$u = "https://bonds-api.com/api/v1/fluctuation?countries=DK&maturity=10Y&start=2025-11-13&end=2026-11-13";
$f = json_decode(file_get_contents($u, false, $ctx), true)["data"]["DK"];
echo "Change: " . $f["change"] . " pp, Min: " . $f["min"] . "%, Max: " . $f["max"] . "%";
Operational details: maturities, schedules, caching, and errors
Maturities: You’ll encounter bill tenors like 1M, 3M, 6M and bond tenors 1Y, 2Y, 5Y, 10Y, 30Y in Denmark. Check the /curve response for the authoritative set per date, or use /latest without the maturities filter to discover currently supported tenors.
Business days and holidays: Daily endpoints align to market business days. Weekends and Danish market holidays will not produce observations; design your front end to handle gaps.
Update frequency: Latest and curve endpoints return the most recent available official day. Intraday provides multiple snapshots during the trading day with fetched_at timestamps in UTC. For streaming-like use, poll intraday with sensible intervals and backoff.
Caching strategies:
- Daily data (latest, curve, historical, timeseries) can be cached by country/date to reduce calls.
- Invalidate cache after the local market close or upon detecting new dates in /latest.
- Intraday responses should be cached for seconds to minutes; merge new snapshots client-side.
Error handling and quotas: The API returns structured errors. Plan for these HTTP statuses:
- 401: Missing or invalid X-API-Key
- 403: Account quota exceeded
- 404: No data for requested combination (e.g., unsupported maturity/date)
- 422: Invalid parameter (date format must be YYYY-MM-DD; ISO2 must be DK)
- 429: Rate limit exceeded; implement retry with exponential backoff
- 500: Server error; retry with jitter
Learn more or contact support at bonds-api.com. For MCP integrations, see Bonds API MCP.
Combining endpoints: assemble a Denmark yield curve and spreads
There are two common paths to a curve:
- Single-call curve: Use /curve for an authoritative DK snapshot across many maturities, including an inverted flag.
- Selective latest: Use /latest with maturities=1M,3M,6M,1Y,2Y,5Y,10Y,30Y if you want to control which tenors to request and combine with other countries in a single call (via countries=DK,DE,... when needed).
For cross-market dashboards, pair /curve (DK) with /spread (DK vs US) at 10Y and 2Y to visualize the slope and the international spread simultaneously. When alerting, use /fluctuation over the last week to summarize change and extremes, then link to /intraday for the most recent session’s microstructure.
End-to-end example: DK 10Y card with today, change, and curve context
Workflow outline:
- Call /latest for DK 10Y to display today’s level and date.
- Call /fluctuation for DK 10Y over the past 5 business days to compute daily change and range.
- Call /curve for DK to show a mini-sparkline across tenors; check inverted to color the slope.
All calls are GET with X-API-Key, and all yields are percent. Dates are strings (YYYY-MM-DD), and intraday timestamps are ISO 8601 UTC.
Code recap patterns
Common GET pattern by language:
- cURL: include X-API-Key header; pass query params in URL.
- Python (requests): headers dict plus params dict; call response.json().
- JavaScript (fetch): add headers; JSON parse with response.json().
- PHP: either file_get_contents with a stream context for the header, or Guzzle with base_uri and query.
These patterns appear in each endpoint section above and can be dropped into your app with minimal edits.
Link library and next steps
- Homepage and docs overview: bonds-api.com
- Create an API key: Register
- Managed Connectivity Platform: MCP
Also useful links required by many readers:
FAQ
Q: What units are yields and spreads in?
A: Yields are percentages (e.g., 4.52 means 4.52%). Spread fields returned by /spread are in basis points (bps). For /fluctuation, change is in percentage points, not bps.
Q: What timezone should I assume for timestamps?
A: Date fields like “date” are market dates in YYYY-MM-DD without a timezone. Intraday fields include fetched_at in ISO 8601 UTC with “Z”. The meta.timezone in /intraday is “UTC”.
Q: How do I handle non-trading days and holidays in Denmark?
A: Daily series will skip weekends and market holidays. Your logic should not assume a value for each calendar day. Use /timeseries to retrieve the exact dates that have observations.
Q: Can I get multiple maturities in one call?
A: Yes, with /latest you can specify maturities=1Y,2Y,10Y (or omit for all available). For a complete snapshot, /curve returns many DK tenors at once with an inverted flag.
Q: What errors should I expect, and how should I retry?
A: Handle 401/403 for auth/quota, 404 for missing data, 422 for invalid params, 429 for rate limits, and 500 for server errors. Use exponential backoff with jitter on 429/500.
Ready to wire DK yields into your pricing, risk, or research stack? Generate your key and ship your integration today: Register. You can also explore the platform at bonds-api.com and connect via MCP when you are ready to promote to production.