Building a UK government bond dashboard requires more than a single yield: you need maturities that can be compared, dates that can be aligned, and changes expressed in consistent units. This guide shows how to retrieve the latest UK yield, assemble a curve, calculate spreads, and handle missing observations in an application using Bonds API.
What a UK yield curve represents
A sovereign bond is debt issued by a government. Its yield summarizes the return implied by its market price and cash flows; as prices change, yields generally move in the opposite direction. Analysts use UK government bond yields to study financing conditions, compare maturities, and assess interest-rate exposure.
A yield curve plots yields against maturities. Short points such as 1M and 1Y represent different horizons from longer points such as 10Y and 30Y. A curve can rise or fall across selected maturities, and its shape can vary across segments rather than moving uniformly from one end to the other.
For a portfolio risk tool, the distinction matters: a move in the short end need not match a move in the long end. An economic researcher may instead track a chosen maturity spread over time, while a dashboard developer may need a current curve with clear observation dates.
Retrieve the latest UK yield
The following official sample requests the latest available UK 10Y yield. Replace YOUR_API_KEY with your key. Because the request places the key in the URL, take care not to expose it in application logs, browser history, or shared diagnostics.
curl -s "https://bonds-api.com/api/v1/latest?countries=GB&maturities=10Y&api_key=YOUR_API_KEY"
The official response is:
{
"success": true,
"date": "2026-12-04",
"rates": {
"GB_10Y": 5.177
},
"dates": {
"GB_10Y": "2026-12-04"
},
"currencies": {
"GB_10Y": "GBP"
},
"sources": {
"GB_10Y": "worldgovbonds"
},
"updated_at": {
"GB_10Y": "2026-12-04T20:00:54+00:00"
},
"changes": {
"GB_10Y": {
"previous_close": 5.249,
"daily": {
"date": "2026-12-03",
"bps": -7.2,
"pct": -1.37
},
"weekly": {
"date": "2026-11-27",
"bps": -0.1,
"pct": -0.02
},
"monthly": {
"date": "2026-11-04",
"bps": 1.5,
"pct": 0.3
},
"annual": {
"date": "2025-12-04",
"bps": 74.8,
"pct": 16.89
}
}
},
"meta": {
"request_id": "6534a5d0-553a-40a8-9c3c-f43a0e47bee9",
"timestamp": "2026-12-05T00:04:04+00:00"
}
}
In this response, rates.GB_10Y is a yield expressed as a percentage, not as a decimal fraction. currencies.GB_10Y identifies the instrument currency as GBP; it is not a currency-conversion rate. The sources entry identifies the source associated with the observation.
The top-level date and the entry in dates are calendar dates in year-month-day form. updated_at is a timestamp with a UTC offset, while meta.timestamp is the response metadata timestamp. Keep the observation date and update timestamp distinct: a response can be generated after the market observation it contains.
Under changes, previous_close is the prior closing yield. Each named period supplies a comparison date, a change in basis points under bps, and a relative percentage change under pct. One percentage point equals 100 basis points; a basis-point change is not the same measure as a relative percentage change. success indicates the request outcome, and meta.request_id can help identify a response when investigating a problem.
Read the sample in Python
This example calls the same endpoint and reads the fields needed to display the observation. It uses the requests library and preserves the sample request’s URL and parameter names.
import requests
url = (
"https://bonds-api.com/api/v1/latest"
"?countries=GB&maturities=10Y&api_key=YOUR_API_KEY"
)
response = requests.get(url, timeout=30)
response.raise_for_status()
payload = response.json()
if not payload["success"]:
raise RuntimeError("The yield request did not succeed")
symbol = "GB_10Y"
print("Yield (%):", payload["rates"][symbol])
print("Observation date:", payload["dates"][symbol])
print("Currency:", payload["currencies"][symbol])
print("Updated at:", payload["updated_at"][symbol])
print("Daily change (bps):", payload["changes"][symbol]["daily"]["bps"])
For production, handle HTTP errors and absent observations before updating a dashboard. The API reference also documents X-API-Key header authentication and a latest-response format with data indexed by country and maturity, containing yield, date, and source. Validate the response format your integration receives rather than assuming the two documented representations are interchangeable.
Choose the right endpoint for the analysis
All endpoints below use GET. Their paths are relative to https://bonds-api.com/api/v1/. The latest endpoint requires countries and accepts a comma-separated maturities parameter; omitting maturities requests all available maturities.
Curve: one country across maturities
GET /api/v1/curve requires country and optionally accepts date in year-month-day format. Without a date, it defaults to the latest available day with data. Use GB to obtain the UK curve rather than making separate requests for each maturity.
The documented response includes success, country, and the curve’s date. The curve object maps maturity labels to percentage yields, while inverted is an inversion indicator. The reference does not specify the indicator’s calculation, so calculate and label your own selected-maturity slope when that definition matters to a model.
Historical: one maturity on one date
GET /api/v1/historical requires country, maturity, and date. It is useful for reproducing a risk report or looking up a particular observation without requesting a full series.
The documented response identifies the request through country, maturity, and date, and returns yield as a percentage and source as its provenance. Check success before using the yield, and handle a missing observation rather than substituting a value silently.
Time series: one maturity over a range
GET /api/v1/timeseries requires country, maturity, start, and end. Dates use year-month-day format, and end must be on or after start. This endpoint supports charts, rolling analysis, and research datasets for a chosen UK maturity.
The response includes success, country, and maturity, plus a series array. Each series entry has a date and a percentage yield. Join series for different maturities by their returned dates; array positions alone do not establish that observations are comparable.
Spread: compare with a benchmark
GET /api/v1/spread requires country and benchmark; maturity is optional and defaults to 10Y. For a UK analysis, GB is the country, and the reference lists US and DE as benchmark codes.
The response identifies country, benchmark, and maturity. It reports country_yield and benchmark_yield as percentages and spread_bps in basis points. The documented example represents the country yield minus the benchmark yield; retain that direction when labeling a chart or interpreting a negative spread.
Intraday: observations within a day
GET /api/v1/intraday requires country, maturity, and date. Its snapshots array contains entries with a percentage yield, a fetched_at timestamp, and a source. The response also includes count, meta.timezone, and the requested country, maturity, and date.
Read each timestamp with its timezone rather than treating it as a local market time. The documented example uses UTC. A fetched timestamp describes when a snapshot was obtained; do not assume it is an exchange trade timestamp or that snapshots arrive at a guaranteed interval.
Fluctuation: summarize a period
GET /api/v1/fluctuation requires comma-separated countries, a maturity, and start and end dates, with the end on or after the start. It returns a country-indexed data object for a period summary.
For each country, start_yield, end_yield, min, and max are yield levels. change is the difference in percentage-point terms in the documented example; multiply it by 100 to express it in basis points. The top-level maturity, start, and end describe the requested period.
Build and interpret a curve
For a current curve, use the curve endpoint when its country-level response meets the application’s needs. Alternatively, request several maturity labels with latest, such as 2Y,10Y, and assemble the returned observations into a maturity-to-yield mapping. The API identifies the country with GB; maturity labels are the curve points, not separate invented bond symbols.
Sort points by actual tenor, not alphabetically. Months and years need a common ordering for plotting, and an unavailable maturity should remain visibly absent rather than being treated as zero. The reference describes coverage from short bills to long bonds, but available UK points can depend on the requested date and data availability.
Before calculating a slope, check the observation date for each selected point. If the dates differ, the calculation may combine observations from different market sessions. Either exclude the mismatch or display it clearly; a stale point can otherwise create an apparent change in curve shape.
For a chosen long and short maturity, subtract the short yield from the long yield in percentage points, then multiply by 100 for basis points. A negative result means that selected long yield is below the selected short yield. It does not by itself establish that every segment of the full curve is inverted.
For historical curve analysis, request the curve for the relevant date or align individual maturity series by observation date. Record the maturity pair, date, units, and calculation direction with each derived spread so that research results and portfolio-risk reports remain reproducible.
Operate the integration reliably
Government bond observations follow market calendars, not an uninterrupted calendar-day sequence. Weekends, UK market holidays, and other unavailable sessions can produce gaps. A request for a particular date can return no data; do not assume the API will automatically substitute the preceding business day.
The curve endpoint’s default is the latest available day with data, which may be earlier than the day on which a user opens a dashboard. Display the returned date alongside the curve. For historical series, preserve gaps and make any forward-fill policy explicit, especially when computing daily changes or aligning maturities.
Update frequency is not specified as a fixed schedule in the reference. Use the returned observation dates and timestamps to assess freshness, and choose a polling interval appropriate to the endpoint and your application rather than assuming every request will produce a new market observation.
Cache responses by endpoint and relevant request parameters, including country, maturity, and date range. Keep the returned observation date and update timestamp with the cached data; use a shorter freshness policy for a current dashboard than for a reproducible historical report. Refresh or revalidate cached historical data when corrections matter to the analysis.
The documented errors distinguish missing or invalid credentials (401), quota exhaustion (403), unavailable data (404), invalid parameters (422), rate limiting (429), and server errors (500). Error responses use success=false and an error message. Correct credentials or parameters where appropriate, and use bounded retries with backoff for transient rate-limit or server failures.
The reference does not describe pagination for these endpoints. Do not build pagination assumptions into a time-series reader; validate the response you receive and retain enough request context to identify the range represented. Teams exploring tool-based access can also use MCP.
FAQ
Are UK yields returned as percentages or basis points?
Yield levels are percentages. Spread and change fields explicitly named spread_bps or bps are basis points; convert a percentage-point difference to basis points by multiplying by 100.
How do I request several UK maturities?
Use latest with countries=GB and a comma-separated maturities value, or use curve for the country-level curve. Check the returned dates before comparing points.
What happens on a market holiday?
An observation may be unavailable, and a specific-date request may return 404. The latest available curve can have an earlier observation date, so show that date rather than implying the data is from the current session.
Can I treat an intraday timestamp as UK local time?
Use the offset in fetched_at and the response’s meta.timezone. Convert for display if necessary, while retaining the original timestamp for storage and comparison.
To start integrating UK yield data, Register for an API key, then test the latest-yield request before adding curve and historical analysis.