API to Get Hungary Bond Yields

API to Get Hungary Bond Yields

You need reliable, machine-readable Hungary government bond yields for analytics, dashboards, or risk engines. By the end of this article, you will query Hungary (HU) sovereign yields over REST, stream intraday snapshots, build a daily yield curve, compute spreads versus benchmarks, and cache results efficiently using the Bonds API.

What you can build with Hungary sovereign bond yields

Bonds API provides sovereign yields as JSON for 60+ countries, including Hungary (ISO2: HU), across short bills to long bonds. Yields are expressed in percentage points (e.g., 4.52 means 4.52%). Timestamps are ISO 8601 in UTC when present. With these endpoints you can:

  • Render a live Hungary yield curve (e.g., 1M to 30Y) and flag curve inversion.
  • Pull current 2Y and 10Y yields for top-of-screen indicators.
  • Chart 10Y time series across months or years.
  • Monitor intraday moves for high-touch workflows.
  • Calculate HU–US or HU–DE spreads in basis points for macro context.
  • Track rolling fluctuations (min, max, change) for risk and alerts.

All requests are GET over HTTPS to the base URL https://bonds-api.com/api/v1/ and authenticate with an API key. Learn more and request access at bonds-api.com. For developer tooling, see the MCP and Register for Bonds API.

Authentication, units, dates, and market timing

Add your API key via the X-API-Key header on every request. Yields are percentages, not basis points. Where a spread is returned, spread_bps is in basis points. Dates in responses are in Y-m-d (e.g., 2026-11-12). When timestamps are present, they are ISO 8601 in UTC (e.g., 2026-11-12T12:00:00Z).

Update cadence: daily endpoints typically reflect the latest available business day in Hungary (Budapest market calendar). On Hungary market holidays and weekends, the “latest” date remains the last business day with data. Intraday snapshots aggregate during trading hours and return explicit UTC timestamps. Consider caching daily responses for the trading day and invalidating after settlement; cache intraday snapshots at shorter intervals (e.g., 5–15 minutes) depending on your UI needs.

Endpoint: Latest Hungary yields

Get current Hungary yields for selected maturities. If you omit maturities, you will receive all available points for HU.

cURL

curl -s "https://bonds-api.com/api/v1/latest?countries=US&maturities=10Y&api_key=YOUR_API_KEY"

Python (requests)

import requests

resp = requests.get(
"https://bonds-api.com/api/v1/latest",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"countries": "HU", "maturities": "2Y,10Y"},
timeout=10
)
data = resp.json()
# Read yields: data["data"]["HU"]["2Y"]["yield"], date: data["data"]["HU"]["2Y"]["date"]

JavaScript (fetch)

const url = new URL("https://bonds-api.com/api/v1/latest");
url.search = new URLSearchParams({ countries: "HU", maturities: "2Y,10Y" }).toString();

fetch(url, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(json => {
const y2 = json.data.HU["2Y"].yield; // percentage
const d2 = json.data.HU["2Y"].date; // "YYYY-MM-DD"
const y10 = json.data.HU["10Y"].yield; // percentage
console.log({ y2, d2, y10 });
});

PHP (file_get_contents)

<?php
$url = "https://bonds-api.com/api/v1/latest?countries=HU&maturities=2Y,10Y";
$opts = ["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]];
$ctx = stream_context_create($opts);
$json = file_get_contents($url, false, $ctx);
$data = json_decode($json, true);
// $data["data"]["HU"]["10Y"]["yield"]
?>

JSON response

{
    "success": true,
    "date": "2026-11-12",
    "rates": {
        "US_10Y": 4.998
    },
    "dates": {
        "US_10Y": "2026-11-12"
    },
    "currencies": {
        "US_10Y": "USD"
    },
    "meta": {
        "request_id": "ba467826-ee68-4602-ab9b-d50afbc9d9da",
        "timestamp": "2026-11-12T00:04:05+00:00"
    }
}

Fields: yield is a percentage (e.g., 4.52 means 4.52%); date is the applicable Hungary business date in Y-m-d; source indicates the provenance (e.g., official). Use the same date across maturities to build a same-day curve snapshot.

Endpoint: Historical yield for a specific date

Get the Hungary yield for one maturity on a single date. If the date is a weekend/holiday, the API returns 404 when no fixing exists; use the most recent prior business day as a fallback.

cURL

Python (requests)

import requests

params = {"country": "HU", "maturity": "10Y", "date": "2025-06-15"}
r = requests.get("https://bonds-api.com/api/v1/historical",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params, timeout=10)
hist = r.json()
# hist["yield"] is percentage, hist["date"] is "YYYY-MM-DD"

JavaScript (fetch)

const params = new URLSearchParams({ country: "HU", maturity: "10Y", date: "2025-06-15" });

fetch("https://bonds-api.com/api/v1/historical?" + params.toString(), {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(json => {
console.log(json.yield, json.date);
});

PHP (file_get_contents)

<?php
$q = http_build_query(["country" => "HU", "maturity" => "10Y", "date" => "2025-06-15"]);
$u = "https://bonds-api.com/api/v1/historical?$q";
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$data = json_decode(file_get_contents($u, false, $ctx), true);
// $data["yield"], $data["source"]
?>

JSON response

Fields: country is ISO2; maturity is the tenor; yield is percentage; date is Y-m-d.

Endpoint: Time series between two dates

Pull a daily series for one Hungary maturity between two dates. Days without data (weekends/holidays) are omitted.

cURL

Python (requests)

import requests

p = {"country": "HU", "maturity": "10Y", "start": "2025-11-12", "end": "2026-11-12"}
res = requests.get("https://bonds-api.com/api/v1/timeseries",
headers={"X-API-Key": "YOUR_API_KEY"}, params=p, timeout=15)
ts = res.json()
# Iterate: for row in ts["series"]: row["date"], row["yield"]

JavaScript (fetch)

const params = new URLSearchParams({
country: "HU", maturity: "10Y", start: "2025-11-12", end: "2026-11-12"
});
fetch("https://bonds-api.com/api/v1/timeseries?" + params, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(json => {
json.series.forEach(pt => {
// pt.date: "YYYY-MM-DD"; pt.yield: percentage
});
});

PHP (file_get_contents)

<?php
$params = ["country" => "HU", "maturity" => "10Y", "start" => "2025-11-12", "end" => "2026-11-12"];
$url = "https://bonds-api.com/api/v1/timeseries?" . http_build_query($params);
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$data = json_decode(file_get_contents($url, false, $ctx), true);
// foreach ($data["series"] as $row) { ... }
?>

JSON response

Fields: series is an array of daily observations (business days only). Each yield is a percentage for that date.

Endpoint: Spread versus a benchmark

Compute the HU–benchmark spread at a given maturity (default 10Y). spread_bps is the difference in basis points (1 bp = 0.01%).

cURL

Python (requests)

import requests

p = {"country": "HU", "benchmark": "US", "maturity": "10Y"}
res = requests.get("https://bonds-api.com/api/v1/spread",
headers={"X-API-Key": "YOUR_API_KEY"}, params=p, timeout=10)
sp = res.json()
# sp["spread_bps"] (basis points), sp["country_yield"], sp["benchmark_yield"]

JavaScript (fetch)

const p = new URLSearchParams({ country: "HU", benchmark: "US", maturity: "10Y" });
fetch("https://bonds-api.com/api/v1/spread?" + p, { headers: { "X-API-Key": "YOUR_API_KEY" } })
.then(r => r.json())
.then(json => {
// json.spread_bps is integer/float in basis points
});

PHP (file_get_contents)

<?php
$q = http_build_query(["country" => "HU", "benchmark" => "US", "maturity" => "10Y"]);
$u = "https://bonds-api.com/api/v1/spread?$q";
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$data = json_decode(file_get_contents($u, false, $ctx), true);
// $data["spread_bps"], $data["country_yield"], $data["benchmark_yield"]
?>

JSON response

Fields: spread_bps is in basis points; country_yield and benchmark_yield are percentages. Positive spread_bps means Hungary’s yield is above the benchmark at that maturity.

Endpoint: Full yield curve for Hungary

Retrieve the entire Hungary curve for a single date. This is the most efficient route to plot HU term structure in one call. inverted indicates whether short rates exceed long rates on that date.

cURL

Python (requests)

import requests

res = requests.get("https://bonds-api.com/api/v1/curve",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "HU"}, timeout=10)
curve = res.json()
# curve["curve"] is a dict keyed by tenor (e.g., "1M","2Y","10Y")

JavaScript (fetch)

const params = new URLSearchParams({ country: "HU" });
fetch("https://bonds-api.com/api/v1/curve?" + params, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(json => {
const tenors = Object.keys(json.curve);
const yields = tenors.map(t => json.curve[t]); // percentages
});

PHP (file_get_contents)

<?php
$url = "https://bonds-api.com/api/v1/curve?country=HU";
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$data = json_decode(file_get_contents($url, false, $ctx), true);
// $data["date"], $data["inverted"], $data["curve"]["10Y"]
?>

JSON response

Fields: curve is a map of tenor to yield (percent). date is the Hungary business date for the curve. inverted is a boolean flag you can use to style risk dashboards.

Endpoint: Intraday Hungary snapshots

For high-frequency views, fetch intraday snapshots for a single maturity and date. Each snapshot includes a UTC timestamp.

cURL

Python (requests)

import requests

p = {"country": "HU", "maturity": "10Y", "date": "2026-11-12"}
res = requests.get("https://bonds-api.com/api/v1/intraday",
headers={"X-API-Key": "YOUR_API_KEY"}, params=p, timeout=10)
snap = res.json()
# snap["snapshots"] is an array of {"yield": %, "fetched_at": ISO8601Z, "source": "market"}

JavaScript (fetch)

const p = new URLSearchParams({ country: "HU", maturity: "10Y", date: "2026-11-12" });
fetch("https://bonds-api.com/api/v1/intraday?" + p, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(json => {
json.snapshots.forEach(s => {
// s.fetched_at is UTC (e.g., "2026-11-12T12:00:00Z")
});
});

PHP (file_get_contents)

<?php
$q = http_build_query(["country" => "HU", "maturity" => "10Y", "date" => "2026-11-12"]);
$u = "https://bonds-api.com/api/v1/intraday?$q";
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$data = json_decode(file_get_contents($u, false, $ctx), true);
// foreach ($data["snapshots"] as $s) { $s["yield"], $s["fetched_at"]; }
?>

JSON response

Fields: snapshots is an array of intraday points with fetched_at in UTC. count gives the number of snapshots returned. Use this endpoint to update charts without waiting for end-of-day fixes.

Endpoint: Fluctuation over a period

Summarize start, end, change, low, and high over a date range for one or more countries at one maturity. This is ideal for risk digests or alerting.

cURL

Python (requests)

import requests

p = {"countries": "HU", "maturity": "10Y", "start": "2025-11-12", "end": "2026-11-12"}
res = requests.get("https://bonds-api.com/api/v1/fluctuation",
headers={"X-API-Key": "YOUR_API_KEY"}, params=p, timeout=10)
fl = res.json()
# fl["data"]["HU"]["change"] is end_yield - start_yield (percentage points)

JavaScript (fetch)

const p = new URLSearchParams({
countries: "HU", maturity: "10Y", start: "2025-11-12", end: "2026-11-12"
});
fetch("https://bonds-api.com/api/v1/fluctuation?" + p, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(json => {
const stats = json.data.HU;
// stats.min, stats.max, stats.change
});

PHP (file_get_contents)

<?php
$q = http_build_query(["countries" => "HU", "maturity" => "10Y",
"start" => "2025-11-12", "end" => "2026-11-12"]);
$u = "https://bonds-api.com/api/v1/fluctuation?$q";
$ctx = stream_context_create(["http" => ["header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
$data = json_decode(file_get_contents($u, false, $ctx), true);
// $data["data"]["HU"]["start_yield"], ["end_yield"], ["min"], ["max"], ["change"]
?>

JSON response

Fields: change equals end_yield minus start_yield, in percentage points. All yields in this response are percentages, not bps.

Error handling and resiliency

Error responses follow a common shape with success=false and an error message. Key statuses include: 401 (missing/invalid key), 403 (quota exceeded), 404 (no data for the requested combination), 422 (invalid parameter), 429 (rate limit), 500 (server error). Implement retries only for idempotent 5xx with backoff; do not retry 4xx without correcting input. Cache stable responses per trading day to limit rate usage.

Example: interpreting errors

  • 404 No data: Check ISO2 country code HU, supported maturity (e.g., 10Y), and whether the date is a Hungary business day.
  • 422 Invalid parameter: Ensure dates are Y-m-d and end ≥ start for time series/fluctuation.
  • 429 Rate limit exceeded: Back off and serve from cache when possible.

Building a Hungary yield curve and spreads in practice

For a single-day curve, prefer GET /curve with country=HU to avoid multiple round-trips. It returns a complete tenor map and an inverted flag in one response. If you need only a subset of points for a compact widget (e.g., 2Y,5Y,10Y), GET /latest with maturities=2Y,5Y,10Y is efficient.

To compute cross-market spreads (e.g., HU vs US or DE), call GET /spread with the desired maturity. Use spread_bps directly for charts in basis points, and store the underlying country_yield and benchmark_yield (percent) for auditability. For risk summaries over time windows, GET /fluctuation delivers start, end, change, min, max in one call—perfect for daily emails or Slack alerts.

Business days, holidays, updates, and caching strategy

Daily endpoints (latest, historical, curve, timeseries, spread, fluctuation) align to trading days in Budapest. On weekends and Hungary public holidays, the most recent business date applies. Consider:

  • Cache GET /curve?country=HU and GET /latest?countries=HU for the session/day.
  • Invalidate caches after local end-of-day or when a new date stamp appears.
  • Use GET /intraday for live tiles; cache for 1–5 minutes to balance traffic and freshness.
  • Handle missing days by displaying “last updated” date next to the value.

Data dictionary and units at a glance

  • yield: Percentage (e.g., 4.52 for 4.52%).
  • spread_bps: Basis points (e.g., 215 for 2.15%).
  • date: Y-m-d, local business date for the instrument.
  • fetched_at: Intraday ISO 8601 UTC timestamp (e.g., 2026-11-12T12:00:00Z).
  • inverted: Boolean; true means short maturities exceed long maturities on that date.
  • source: Data provenance flag (e.g., official, market).

Official sample (verbatim)

The following live-format sample is provided verbatim to illustrate response structure as delivered by Bonds API.

Sovereign bond fundamentals (Hungary focus)

Hungary government securities span bills (e.g., 1M, 3M, 6M) and bonds (1Y to 30Y+). The yield curve encodes market expectations for policy rates, inflation, and term premia. Analysts monitor:

  • Level: Are absolute yields rising/falling across the curve?
  • Slope: 2s–10s or 3M–10Y differentials; inversion as a growth signal.
  • Curvature: 2s–5s–10s to track belly vs wings.
  • Spreads: HU vs US or DE for relative value and country risk.

Using the endpoints above, you can derive these metrics in a few requests. Explore additional capabilities at bonds-api.com and the Bonds API MCP to test calls interactively.

Putting it all together: a minimal HU yield dashboard

Suggested flow:

  • On load: GET /curve?country=HU to render the full curve and set “last updated” using date.
  • Topline tiles: GET /latest?countries=HU&maturities=2Y,10Y for headline levels.
  • Chart: GET /timeseries for 10Y across your desired window.
  • Spread panel: GET /spread?country=HU&benchmark=US&maturity=10Y to show HU–US spread_bps.
  • Live card: GET /intraday for 10Y to animate ticks; throttle with short cache.
  • Risk box: GET /fluctuation to show min/max/change over the month/quarter.

Common errors and troubleshooting tips

  • Invalid ISO2 country: Use HU for Hungary.
  • Unknown maturity: Use common tenors like 1M, 3M, 6M, 1Y, 2Y, 5Y, 10Y, 30Y as returned by /curve; ensure case and format (e.g., 10Y).
  • Date format: Always Y-m-d. Ensure end ≥ start for ranges.
  • Empty intraday: Verify the date is a trading day and that you are querying during relevant hours.

Quick reference: endpoint comparison

Endpoint Primary use Key params Returns
/latest Spot levels for selected maturities countries=HU, maturities=2Y,10Y Map of tenors to yields and dates
/historical Specific date point country=HU, maturity, date Single yield and metadata
/timeseries Charting daily history country=HU, maturity, start, end Array of date-yield pairs
/spread HU vs benchmark (bps) country=HU, benchmark (e.g., US), maturity spread_bps plus underlying yields
/curve Full term structure country=HU, date (optional) All tenors with inverted flag
/intraday Live snapshots country=HU, maturity, date UTC timestamped snapshots
/fluctuation Range summary stats countries=HU, maturity, start, end start, end, change, min, max

FAQ

What units are yields and spreads in?
Yields are percentages (e.g., 4.52 means 4.52%). Spreads from /spread are in basis points (spread_bps), where 100 bps = 1%.

How do I handle non-trading days for Hungary?
Daily endpoints reflect the most recent Hungary business day with data. On weekends/holidays, either use the prior date returned by /latest or query a specific business date with /historical.

Can I request multiple Hungary maturities at once?
Yes—use /latest with countries=HU and a comma-separated maturities list for a compact request. For the entire term structure in one call, use /curve.

What timezone are intraday timestamps in?
snapshots[].fetched_at is ISO 8601 UTC (e.g., 2026-11-12T12:00:00Z). Display in your user’s local timezone if needed.

How should I cache these responses?
Cache daily endpoints for the trading day or until a new date appears. For intraday, use a short TTL (1–15 minutes) and invalidate on new snapshots.

Ready to integrate Hungary yields into your stack? Register for an API key and start building. You can also Get started with Bonds API and try requests interactively via the Bonds API MCP.

Start building with bond data today

Get your API key and access sovereign bond yields across 60+ countries. 7-day free trial, no credit card required.