You need reliable, machine-readable Thailand sovereign bond yields you can plug straight into your analytics, dashboards, or trading models. By the end of this article, you will be able to fetch current Thai government bond yields, historical values, full yield curves, intraday snapshots, spreads to benchmarks, and quantified fluctuations using the Bonds API, and integrate them with Python, JavaScript, or PHP.
What you’ll build: programmatic access to Thailand (TH) government bond yields
Bonds API exposes sovereign bond yields as simple JSON over HTTPS. For Thailand (ISO2: TH), you can request:
- Current yields across multiple maturities
- Historical yield for a specific date
- Time series between two dates
- Spread versus a benchmark country (e.g., the US)
- A full yield curve snapshot
- Intraday snapshots for a given date
- Fluctuation stats (change, min, max) over any period
All responses return yields as percentages unless otherwise noted. Dates are ISO-8601 (Y-m-d). Intraday timestamps are in UTC. See more on bonds-api.com and explore the Bonds API MCP.
Important note about a US sample format
The following official sample demonstrates an alternative response shape for a US request. Copy this block verbatim if you need to validate connectivity or study the alternative schema:
curl -s "https://bonds-api.com/api/v1/latest?countries=US&maturities=10Y&api_key=YOUR_API_KEY"
{
"success": true,
"date": "2026-11-13",
"rates": {
"US_10Y": 5.15
},
"dates": {
"US_10Y": "2026-11-13"
},
"currencies": {
"US_10Y": "USD"
},
"meta": {
"request_id": "7a777eae-98b0-48ac-8ee9-dc5394203030",
"timestamp": "2026-11-15T00:05:18+00:00"
}
}
For Thailand and the rest of this article, we use the documented endpoints and response formats tailored to country=TH and the production schema shown below. Authentication for those examples uses the X-API-Key header.
Endpoint: Latest Thailand yields (snapshot)
Use this to fetch the most recent published yields. Request multiple maturities at once to build a quick curve or power a quotes widget.
cURL
JSON response
How to read:
- yield: percentage (%). Example: 4.52 means 4.52%.
- date: ISO-8601 calendar date (Y-m-d) for the quoted yield.
- source: origin of the data (e.g., “official”).
Python (requests)
import requests
resp = requests.get(
"https://bonds-api.com/api/v1/latest",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"countries": "TH", "maturities": "2Y,10Y"}
)
data = resp.json()
th_data = data["data"]["TH"]
y2 = th_data["2Y"]["yield"]
y10 = th_data["10Y"]["yield"]
as_of = th_data["10Y"]["date"]
print("TH 2Y:", y2, "% | TH 10Y:", y10, "% | as of", as_of)
JavaScript (fetch)
const url = new URL("https://bonds-api.com/api/v1/latest");
url.searchParams.set("countries", "TH");
url.searchParams.set("maturities", "2Y,10Y");
fetch(url.toString(), {
method: "GET",
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(json => {
const th = json.data.TH;
console.log(`TH 2Y: ${th["2Y"].yield}% | TH 10Y: ${th["10Y"].yield}% (as of ${th["10Y"].date})`);
});
PHP (file_get_contents)
<?php
$endpoint = "https://bonds-api.com/api/v1/latest?countries=TH&maturities=2Y,10Y";
$opts = [
"http" => [
"method" => "GET",
"header" => "X-API-Key: YOUR_API_KEY\r\n"
]
];
$ctx = stream_context_create($opts);
$json = file_get_contents($endpoint, false, $ctx);
$data = json_decode($json, true);
$th = $data["data"]["TH"];
echo "TH 2Y: {$th["2Y"]["yield"]}% | TH 10Y: {$th["10Y"]["yield"]}% (as of {$th["10Y"]["date"]})";
Endpoint: Historical yield for a specific date
Use this to pin a yield as of a known date. This is useful for backtesting, performance attribution, or valuation snapshots.
cURL
JSON response
How to read:
- yield: percentage (%), as of the provided date.
- date: the specific valuation date you requested.
Python (requests)
import requests
params = {"country": "TH", "maturity": "10Y", "date": "2025-06-15"}
resp = requests.get(
"https://bonds-api.com/api/v1/historical",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params
)
h = resp.json()
print(f'TH {h["maturity"]} on {h["date"]}: {h["yield"]}%')
JavaScript (fetch)
const url = new URL("https://bonds-api.com/api/v1/historical");
url.searchParams.set("country", "TH");
url.searchParams.set("maturity", "10Y");
url.searchParams.set("date", "2025-06-15");
fetch(url.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" }})
.then(r => r.json())
.then(j => console.log(`TH ${j.maturity} on ${j.date}: ${j.yield}%`));
PHP (file_get_contents)
<?php
$q = http_build_query(["country" => "TH", "maturity" => "10Y", "date" => "2025-06-15"]);
$endpoint = "https://bonds-api.com/api/v1/historical?$q";
$opts = ["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]];
$ctx = stream_context_create($opts);
$data = json_decode(file_get_contents($endpoint, false, $ctx), true);
echo "TH {$data["maturity"]} on {$data["date"]}: {$data["yield"]}%";
Endpoint: Time series between two dates
Pull continuous daily yields to plot trends, compute rolling risk metrics, or feed factor models.
cURL
JSON response
How to read:
- series: list of daily yields as percentages (%), one object per business day with available data.
- date: each entry’s valuation date (Y-m-d), in local market calendar terms; no intraday timestamps here.
Python (requests)
import requests
import pandas as pd
params = {"country": "TH", "maturity": "10Y", "start": "2025-11-15", "end": "2026-11-15"}
resp = requests.get("https://bonds-api.com/api/v1/timeseries",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
js = resp.json()
df = pd.DataFrame(js["series"])
df["date"] = pd.to_datetime(df["date"])
print(df.head())
JavaScript (fetch)
const u = new URL("https://bonds-api.com/api/v1/timeseries");
u.searchParams.set("country", "TH");
u.searchParams.set("maturity", "10Y");
u.searchParams.set("start", "2025-11-15");
u.searchParams.set("end", "2026-11-15");
fetch(u.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" }})
.then(r => r.json())
.then(j => {
const points = j.series.map(pt => [pt.date, pt.yield]);
console.log(points.slice(0, 3));
});
PHP (Guzzle)
<?php
require "vendor/autoload.php";
$client = new \GuzzleHttp\Client([ "base_uri" => "https://bonds-api.com" ]);
$res = $client->request("GET", "/api/v1/timeseries", [
"headers" => [ "X-API-Key" => "YOUR_API_KEY" ],
"query" => [ "country" => "TH", "maturity" => "10Y", "start" => "2025-11-15", "end" => "2026-11-15" ]
]);
$js = json_decode($res->getBody(), true);
foreach ($js["series"] as $row) {
echo $row["date"] . ": " . $row["yield"] . "%\n";
}
Endpoint: Spread versus a benchmark
Quantify Thailand’s risk premium versus a benchmark sovereign. Spreads are returned in basis points (bps).
cURL
JSON response
How to read:
- spread_bps: basis points difference. 215 means 2.15% higher than the benchmark.
- country_yield, benchmark_yield: both in percent (%), aligned to the same valuation date.
Python (requests)
import requests
q = {"country": "TH", "benchmark": "US", "maturity": "10Y"}
res = requests.get("https://bonds-api.com/api/v1/spread",
headers={"X-API-Key": "YOUR_API_KEY"},
params=q)
j = res.json()
print(f'{j["country"]} vs {j["benchmark"]} {j["maturity"]} spread: {j["spread_bps"]} bps')
JavaScript (fetch)
const s = new URL("https://bonds-api.com/api/v1/spread");
s.searchParams.set("country", "TH");
s.searchParams.set("benchmark", "US");
s.searchParams.set("maturity", "10Y");
fetch(s.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" }})
.then(r => r.json())
.then(j => console.log(`TH vs US 10Y spread: ${j.spread_bps} bps`));
PHP (file_get_contents)
<?php
$q = http_build_query(["country" => "TH", "benchmark" => "US", "maturity" => "10Y"]);
$endpoint = "https://bonds-api.com/api/v1/spread?$q";
$opts = ["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]];
$res = file_get_contents($endpoint, false, stream_context_create($opts));
$j = json_decode($res, true);
echo "TH vs US 10Y spread: {$j["spread_bps"]} bps";
Endpoint: Full Thailand yield curve
Pull a country’s entire curve on a given date to value portfolios, calibrate term-structure models, or compute curve-based risk measures.
cURL
JSON response
How to read:
- curve: maturity keys mapped to yields in percent (%).
- inverted: boolean, whether shorter maturities yield more than longer ones in aggregate.
- date: valuation date of the curve snapshot (Y-m-d).
Table: Selected Thailand curve points
| Maturity | Yield (%) |
|---|---|
| 1M | 5.31 |
| 3M | 5.27 |
| 6M | 5.18 |
| 1Y | 4.98 |
| 2Y | 4.25 |
| 5Y | 4.39 |
| 10Y | 4.52 |
| 30Y | 4.71 |
Python (requests)
import requests
r = requests.get("https://bonds-api.com/api/v1/curve",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "TH"})
curve = r.json()
yc = curve["curve"]
print("Inverted:", curve["inverted"], "| Date:", curve["date"])
for m, y in yc.items():
print(m, ":", y, "%")
JavaScript (fetch)
const c = new URL("https://bonds-api.com/api/v1/curve");
c.searchParams.set("country", "TH");
fetch(c.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" }})
.then(r => r.json())
.then(j => {
console.log("Date:", j.date, "Inverted:", j.inverted);
Object.entries(j.curve).forEach(([mat, y]) => console.log(`${mat}: ${y}%`));
});
PHP (Guzzle)
<?php
require "vendor/autoload.php";
$g = new \GuzzleHttp\Client([ "base_uri" => "https://bonds-api.com" ]);
$res = $g->request("GET", "/api/v1/curve", [
"headers" => [ "X-API-Key" => "YOUR_API_KEY" ],
"query" => [ "country" => "TH" ]
]);
$j = json_decode($res->getBody(), true);
echo "Date: {$j["date"]} | Inverted: " . ($j["inverted"] ? "true" : "false") . "\n";
foreach ($j["curve"] as $m => $y) {
echo "$m: {$y}%\n";
}
Endpoint: Intraday snapshots
Get multiple yield readings within the same day to monitor moves and volatility. All intraday timestamps are UTC.
cURL
JSON response
How to read:
- yield: percentage (%).
- fetched_at: ISO-8601 timestamp with Z (UTC) suffix.
- count: number of intraday snapshots returned.
Python (requests)
import requests
from datetime import datetime
params = {"country": "TH", "maturity": "10Y", "date": "2026-11-15"}
resp = requests.get("https://bonds-api.com/api/v1/intraday",
headers={"X-API-Key": "YOUR_API_KEY"},
params=params)
j = resp.json()
for s in j["snapshots"]:
ts = datetime.fromisoformat(s["fetched_at"].replace("Z","+00:00"))
print(ts.isoformat(), "TH 10Y:", s["yield"], "%")
JavaScript (fetch)
const intr = new URL("https://bonds-api.com/api/v1/intraday");
intr.searchParams.set("country", "TH");
intr.searchParams.set("maturity", "10Y");
intr.searchParams.set("date", "2026-11-15");
fetch(intr.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" }})
.then(r => r.json())
.then(j => j.snapshots.forEach(s => console.log(`${s.fetched_at} TH 10Y: ${s.yield}%`)));
PHP (file_get_contents)
<?php
$q = http_build_query(["country" => "TH", "maturity" => "10Y", "date" => "2026-11-15"]);
$endpoint = "https://bonds-api.com/api/v1/intraday?$q";
$opts = ["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]];
$j = json_decode(file_get_contents($endpoint, false, stream_context_create($opts)), true);
foreach ($j["snapshots"] as $s) {
echo $s["fetched_at"] . " TH 10Y: " . $s["yield"] . "%\n";
}
Endpoint: Fluctuation statistics over a period
Summarize period-to-period movement: start, end, absolute change, min, and max. Ideal for risk summaries, alerts, and weekly change reports.
cURL
JSON response
How to read:
- All values are in percent (%). change is absolute percentage point move (e.g., 0.31 = +31 bps).
- min and max: the observed extremes within the requested interval.
Python (requests)
import requests
q = {"countries": "TH", "maturity": "10Y", "start": "2025-11-15", "end": "2026-11-15"}
r = requests.get("https://bonds-api.com/api/v1/fluctuation",
headers={"X-API-Key": "YOUR_API_KEY"},
params=q)
j = r.json()
th = j["data"]["TH"]
print(f"TH 10Y change: {th['change']} pp (start {th['start_yield']}%, end {th['end_yield']}%, min {th['min']}%, max {th['max']}%)")
JavaScript (fetch)
const f = new URL("https://bonds-api.com/api/v1/fluctuation");
f.searchParams.set("countries", "TH");
f.searchParams.set("maturity", "10Y");
f.searchParams.set("start", "2025-11-15");
f.searchParams.set("end", "2026-11-15");
fetch(f.toString(), { headers: { "X-API-Key": "YOUR_API_KEY" }})
.then(r => r.json())
.then(j => {
const th = j.data.TH;
console.log(`TH 10Y change: ${th.change} pp (range: ${th.min}% to ${th.max}%)`);
});
PHP (Guzzle)
<?php
require "vendor/autoload.php";
$client = new \GuzzleHttp\Client(["base_uri" => "https://bonds-api.com"]);
$res = $client->request("GET", "/api/v1/fluctuation", [
"headers" => [ "X-API-Key" => "YOUR_API_KEY" ],
"query" => [ "countries" => "TH", "maturity" => "10Y", "start" => "2025-11-15", "end" => "2026-11-15" ]
]);
$j = json_decode($res->getBody(), true);
$th = $j["data"]["TH"];
echo "TH 10Y change: {$th["change"]} pp (start {$th["start_yield"]}%, end {$th["end_yield"]}%, min {$th["min"]}%, max {$th["max"]}% )";
Practical considerations: maturities, calendars, updates, caching
Supported Thailand maturities typically cover bills to long bonds (e.g., 1M through 30Y), as seen in the curve response. When calling /latest, you can explicitly select maturities (2Y,10Y) or omit to retrieve all available. For multi-maturity workflows, use /curve to avoid stitching data from separate requests.
Business days and market holidays affect availability. Daily endpoints (latest, historical, timeseries, curve) return values for days with published data; weekends and Thai market holidays will not have observations. For charting, align your date axis to observed dates returned by the API rather than assuming continuous calendar days.
Update frequency: daily endpoints refresh when official data is published; the /intraday endpoint provides multiple snapshots within a day with UTC timestamps. If you need streaming-like updates during the trading day, poll /intraday periodically and apply idempotent writes.
Caching and retries: cache successful daily responses keyed by country+maturity+date. For intraday, you may cache the latest payload per 5–10 minutes depending on your UI tolerance. Handle transient HTTP 500s with exponential backoff and respect 429 rate-limit responses by backing off before retrying.
Error handling: the common error shape is consistent across endpoints: success=false with an error message. Typical codes include 401 (invalid API key), 403 (quota exceeded), 404 (no data for the requested combo), 422 (invalid parameter), 429 (rate limit), 500 (server error). Always inspect HTTP status and the JSON body.
Building a Thailand yield curve and spreads for analytics
For curve-driven analytics like DV01 approximation or curve trades, the /curve endpoint gives you a synchronized snapshot of the full term structure. To compute simple slopes:
- 2s10s = curve["10Y"] - curve["2Y"] (in percentage points)
- 10s30s = curve["30Y"] - curve["10Y"]
Spreads vs. a benchmark (e.g., US) are available in basis points via /spread. If you maintain your own analytics, you can combine /curve for Thailand with /latest for the benchmark, but /spread encapsulates this in one response and returns spread_bps directly.
Sovereign bond fundamentals (brief)
Sovereign bonds are debt securities issued by national governments. The yield reflects market expectations for policy rates, inflation, growth, and country risk. Short maturities (e.g., 1M–1Y) are typically sensitive to policy expectations, while long maturities (e.g., 10Y–30Y) embed term premium and long-run macro outlook. Analysts track Thailand’s curve shape for growth and inflation signaling, and monitor spreads to benchmarks for risk appetite shifts.
Authentication, headers, and endpoints recap
Base URL: https://bonds-api.com/api/v1/ for all endpoints. Authenticate with the HTTP header X-API-Key: YOUR_API_KEY. All endpoints are HTTP GET. The JSON fields you will read most often are yields (percent), dates (Y-m-d), and, for intraday, fetched_at timestamps (UTC ISO-8601). Spreads are returned in basis points (bps), while changes from /fluctuation are in percentage points (pp).
Explore more datasets and tools at bonds-api.com. To begin integrating, use the following links:
Or jump directly to: Register and MCP.
Common error responses (shape and handling)
When an error occurs, the API responds with success=false and an error message. Typical HTTP status codes:
- 401: Missing or invalid X-API-Key
- 403: Account quota exceeded
- 404: No data for requested country/maturity/date
- 422: Invalid parameter (date format, ISO2 code, maturity)
- 429: Rate limit exceeded
- 500: Server error
In clients, check both the HTTP status and parse the JSON to present actionable messages. For 422, surface parameter validation hints; for 429, implement backoff; for 404, fall back to the previous available date if your UX allows.
Use cases: from dashboards to research pipelines
- Financial dashboards: display TH 2Y, 5Y, 10Y tiles from /latest and a sparkline fed by /timeseries.
- Portfolio risk: compute DV01 approximations by mapping holdings to nearest curve nodes from /curve.
- Macro research: compare TH 10Y vs. US 10Y via /spread; run rolling regressions on /timeseries returns.
- Alerts: trigger a notification if /fluctuation change exceeds a threshold over the past week.
- Intraday monitoring: track /intraday mid-day shifts to adjust hedges or update dealer quotes.
FAQ
How are yields expressed?
Yields are percentages (%). For example, 4.52 means 4.52%. Spreads from /spread are in basis points (bps). Changes from /fluctuation are percentage points (pp).
What timezone are timestamps in?
Daily endpoints use date fields (Y-m-d) without a time component. Intraday snapshots include fetched_at timestamps in UTC (e.g., 2026-11-15T12:00:00Z).
Do weekends and Thai market holidays have data?
No. Daily observations are available for business days with published data. Use the dates returned by the API rather than assuming continuous calendar coverage.
How do I authenticate?
Send your key in the X-API-Key header. All endpoints are HTTP GET at https://bonds-api.com/api/v1/.
How do I build a full curve with minimal requests?
Use /api/v1/curve with country=TH to get all standard nodes in a single call; the response also indicates if the curve is inverted.
If you are ready to fetch Thailand yields and wire them into your stack, create your key and start calling the endpoints now. Register for your API key, then explore, test, and manage requests with the MCP.