Historical Portugal government bond yields are useful only if your application can distinguish a valid observation from a missing trading day, align maturities, and preserve the date of each value. This guide explains how to request and analyze those data with Bonds-API, and how to build a Portugal yield curve and spread workflow when the required observations are available.
The published live sample below is for a US Treasury, not Portugal: the supplied live catalog sample does not establish Portugal availability. Use it to test the request and response-handling pattern, then verify Portugal coverage before relying on a production integration.
Portugal yields and the data you need
A sovereign bond is debt issued by a government. Its yield summarizes the return implied by its price and cash flows under a particular yield convention; as prices and expected cash flows change, the yield can change too. For Portugal, analysts commonly compare yields across maturities to study the shape of the government curve and the market’s assessment of risk.
Bonds-API identifies Portugal with the country code PT. Its reference describes coverage across maturities from short-term bills to long-dated bonds, but availability of any particular Portugal maturity or historical date must be checked against returned data. A maturity such as 10Y is a tenor label, not a promise that a specific bond issue or observation exists on every date.
The MCP link provides another way to explore Bonds-API. For a REST integration, the base URL is https://bonds-api.com/api/v1/, and the endpoint reference specifies GET requests.
Test the request and read a live sample
The following official sample requests the latest available US 10Y yield. It is a connectivity and parsing example only; its values must not be used as Portugal observations. Replace YOUR_API_KEY with your own key before running it.
curl -s "https://bonds-api.com/api/v1/latest?countries=US&maturities=10Y&api_key=YOUR_API_KEY"
The endpoint reference specifies authentication using the X-API-Key header, while this published live sample puts the key in the query string. Treat that as a documentation discrepancy: verify the accepted authentication method before deployment, and avoid exposing a key in logs, shell history, or shared URLs. The sample response is:
{
"success": true,
"date": "2026-11-27",
"rates": {
"US_10Y": 4.94
},
"dates": {
"US_10Y": "2026-11-27"
},
"currencies": {
"US_10Y": "USD"
},
"sources": {
"US_10Y": "us_treasury"
},
"updated_at": {
"US_10Y": "2026-11-27T20:00:07+00:00"
},
"changes": {
"US_10Y": {
"previous_close": 4.85,
"daily": {
"date": "2026-11-25",
"bps": 9,
"pct": 1.86
},
"weekly": {
"date": "2026-11-20",
"bps": 2,
"pct": 0.41
},
"monthly": {
"date": "2026-10-27",
"bps": -5,
"pct": -1
},
"annual": {
"date": "2025-11-27",
"bps": 94.1,
"pct": 23.53
}
}
},
"meta": {
"request_id": "608e8e22-3e1a-4cc0-b6cf-a2601ba1401a",
"timestamp": "2026-11-28T00:06:36+00:00"
}
}
Here, success indicates whether the request succeeded, and rates.US_10Y is the yield in percent: 4.94 means 4.94%, not a decimal rate of 4.94. The sample’s currencies entry identifies USD for that US observation; it is not a Portugal currency field or a currency-conversion instruction.
dates gives the observation date for the symbol, while updated_at records an update timestamp. The +00:00 offset indicates UTC. The top-level meta.timestamp is associated with the response metadata, so it should not be substituted for the observation date; request_id is useful when investigating a request.
The changes object includes a previous close and changes over several comparison periods. Its bps values are basis-point changes: one basis point is 0.01 percentage point. Its pct values are percentage changes, not basis-point values. The associated comparison date matters because the comparison day may not be the immediately preceding calendar day.
Read the same sample in Python
This example uses the same URL and fields as the published sample. It reads the key from an environment variable rather than embedding it in the source, although the sample’s query-string authentication still means the resulting URL contains the key.
import os
from urllib.parse import quote
import requests
key = quote(os.environ["BONDS_API_KEY"], safe="")
url = (
"https://bonds-api.com/api/v1/latest"
"?countries=US&maturities=10Y&api_key=YOUR_API_KEY"
).replace("YOUR_API_KEY", key)
response = requests.get(url, timeout=10)
response.raise_for_status()
payload = response.json()
if not payload.get("success"):
raise RuntimeError(payload.get("error", "API request failed"))
symbol = "US_10Y"
print("Yield percent:", payload["rates"][symbol])
print("Observation date:", payload["dates"][symbol])
print("Updated at:", payload["updated_at"][symbol])
print("Currency:", payload["currencies"][symbol])
The reference also shows a different latest response structure, with maturities nested beneath a country in data. Do not assume that parser and the live-sample parser are interchangeable. Check the actual response contract for the authentication method and request you use, and validate required fields before storing a value.
Retrieve historical Portugal observations
The endpoint reference describes several GET routes that can support a Portugal workflow. Portugal is specified as PT in the reference; a successful request still depends on the country, maturity, and date combination being available. The following parameter descriptions are not evidence that any specific Portugal observation exists.
Latest and single-date values
Use /latest for current available yields. It requires countries, which accepts comma-separated ISO2 codes, and optionally accepts comma-separated maturities; omitting the latter requests all available maturities. For a Portugal dashboard, request the tenors you intend to display and retain each returned observation date rather than labeling every value with the request day.
Use /historical for one country, maturity, and date. Its required parameters are country, maturity, and date, with dates written as YYYY-MM-DD. The documented response fields are success, country, maturity, date, yield, and source; the yield is expressed in percent.
A single-date lookup is useful for a portfolio valuation checkpoint or a reproducible research input. Record the returned date and source alongside the value. If the requested combination has no data, handle the documented 404 response rather than silently replacing it with another date.
Time series and period changes
Use /timeseries for a series between two dates. It requires country, maturity, start, and end; the end date must not precede the start date. The documented response identifies the country and maturity and returns a series array whose entries contain date and yield.
For research, sort and join series by their returned dates before calculating changes or comparing maturities. A calendar day without an observation is not automatically a zero yield or a zero daily change. The reference does not specify pagination or a guaranteed observation for every date, so verify the returned range and coverage before treating a series as complete.
Use /fluctuation for a period summary. It requires comma-separated countries, a maturity, start, and end. Its documented country-level fields are start_yield, end_yield, change, min, and max. The example expresses change in percentage points; multiply a percentage-point change by 100 to express it in basis points.
A fluctuation summary is useful for dashboard ranges or a quick risk review, but it does not replace the underlying series when you need to inspect gaps, compute a custom window, or reproduce a calculation. Check which observations underpin the summary before comparing it with a separately sampled portfolio time series.
Intraday snapshots
Use /intraday with country, maturity, and date for snapshots on a specified day. The reference response includes a snapshots array, a count, and meta.timezone. Each snapshot has a yield, fetched_at, and source.
A timestamp ending in Z is in UTC. Treat fetched_at as the documented fetch time, not necessarily the time of an underlying trade or quote. Snapshot availability and spacing can differ by day; do not infer a fixed intraday publication schedule from an example.
Build curves and measure spreads
The reference’s /curve endpoint requires country and accepts an optional date. Without a date, it defaults to the latest available day with data. Its documented response contains country, date, inverted, and a curve object mapping maturity labels to yields.
Use the returned date as part of the curve’s identity, especially when storing historical curves. The inverted field is a boolean indicator, but the reference does not specify the exact tenors or rule used to calculate it. If your risk system has its own inversion definition, calculate that separately from the relevant returned maturities and label the rule you used.
You can also build a curve from a /latest request for several maturities. Order the returned tenors by term rather than alphabetically, retain their individual dates, and display gaps where a requested tenor is unavailable. If observations have different dates, label the result accordingly instead of presenting it as a synchronized curve.
For historical curve analysis, request the relevant dated curve when available, or align separate maturity series by observation date. Avoid filling a missing tenor without an explicit interpolation or carry-forward policy; either choice changes the analytical meaning of the curve. Keep raw observations separate from derived values so researchers can reproduce the transformation.
The /spread endpoint compares a country with a benchmark. It requires country and benchmark, and accepts maturity, which defaults to 10Y. The documented fields include country_yield, benchmark_yield, and spread_bps; the yields are percentages and the spread is in basis points.
For a Portugal comparison, select a documented benchmark code and ensure that the comparison matches your risk question. A spread against another country can reflect differences beyond sovereign credit risk, including currency and market conditions. The documented spread response does not include an observation date, so do not attach an assumed date or use it as a historical spread without verifying the underlying timing.
Operate the integration reliably
Business days, weekends, and market holidays affect whether observations are available. A request for a non-trading day may return no data; the reference does not establish a universal previous-business-day fallback. Decide explicitly whether your application should show a gap, ask the user for another date, or apply a separately documented carry-forward rule.
The reference does not state a fixed update frequency. Poll according to your application’s freshness needs, inspect returned dates and timestamps, and avoid treating a newly fetched response as a newly observed yield. Cache latest responses for a bounded period, but retain observation timestamps so users can see how fresh the underlying data is.
Cache historical results by endpoint and complete request parameters, including country, maturity, and date range. Use a refresh policy that permits corrections rather than assuming past observations can never change. For intraday data, distinguish a partially populated day from a completed historical record and refresh it accordingly.
Handle the documented error shape, success=false with an error message, as well as HTTP errors. A 401 indicates missing or invalid credentials; 403 indicates an account quota issue; 404 indicates no data for the requested combination; and 422 indicates invalid parameters. For 429 or 500 responses, use bounded retries with backoff, and surface persistent failures rather than substituting stale values without a label.
These controls serve different consumers: a financial dashboard needs visible freshness, a portfolio risk tool needs consistent valuation dates, and economic research needs a reproducible series with missing observations preserved. In each case, store the raw response or the relevant source, date, maturity, and transformation details alongside derived analytics.
FAQ
Can I request historical Portugal yields immediately?
The endpoint reference describes Portugal using PT, but the supplied live catalog sample does not establish Portugal availability. Verify coverage for the maturity and dates you need, and handle a 404 without substituting another country’s yield.
How do I convert a yield move into basis points?
Subtract the earlier yield percentage from the later yield percentage, then multiply the percentage-point difference by 100. Keep that result distinct from a relative percentage change in the yield.
Does a curve marked as not inverted mean every tenor rises?
Not necessarily. The reference does not define the calculation behind inverted. Inspect the relevant maturities and apply your own documented inversion rule when a particular segment matters.
How should I handle a missing holiday observation?
Preserve the gap unless your application has an explicit, labeled policy for selecting or carrying forward another observation. A missing value is not a zero yield.
To obtain an API key and test the documented workflow, Register. Confirm Portugal coverage and the accepted authentication and response format before integrating the data into production tools.