You need accurate, machine-readable Nigeria 10-year government bond yields you can pull into code, chart in dashboards, or use for spread and risk analytics. By the end of this guide you will be able to request the Nigeria 10Y yield, fetch historical and intraday data, compute benchmark spreads, build the full Nigeria yield curve, and integrate it cleanly using cURL, Python, JavaScript, or PHP with the Bonds API.
What you will build: programmatic access to Nigeria’s 10Y
Bonds API provides sovereign bond yields as JSON over a REST interface at https://bonds-api.com. You authenticate with an API key via request headers, and every endpoint is a GET. The Nigeria 10-year maturity (ISO2: NG, maturity: 10Y) is accessible across current, historical, time series, intraday, spread, and curve endpoints. Yields are returned as percentages unless otherwise noted, and timestamps are ISO 8601 UTC when present. You can register for access at Register, explore the API methods at MCP, and read more on the homepage at bonds-api.com.
Data model and conventions
Before coding, a few important conventions used throughout Bonds API for Nigeria sovereign yields:
- Countries: two-letter ISO2 codes (Nigeria = NG).
- Maturities: strings like 1M, 3M, 6M, 1Y, 2Y, 5Y, 10Y, 30Y, etc.
- Yields: numeric percentage values (e.g., 4.52 means 4.52%).
- Dates: YYYY-MM-DD in daily endpoints; intraday uses ISO 8601 UTC timestamps in fetched_at fields.
- Spreads: spread_bps is in basis points (1 bp = 0.01%).
- Trading calendar: daily series include business days; local market holidays and weekends are absent (no data row). Use timeseries start/end to span gaps and handle missing days gracefully.
- Caching: for static historical ranges, client-side cache aggressively; for latest/intraday, cache briefly (e.g., 1–5 minutes) depending on your latency needs.
Fetch current Nigeria 10Y: /latest
Use the latest endpoint to pull the most recent available 10Y yield for Nigeria. You can request multiple maturities together to construct a curve snapshot on the fly.
cURL
curl -s "https://bonds-api.com/api/v1/latest?countries=US&maturities=10Y&api_key=YOUR_API_KEY"
JSON response (sample)
{
"success": true,
"date": "2026-11-04",
"rates": {
"US_10Y": 4.949
},
"dates": {
"US_10Y": "2026-11-04"
},
"currencies": {
"US_10Y": "USD"
},
"meta": {
"request_id": "ae76ce25-588b-4972-93ca-7b40ebbf5956",
"timestamp": "2026-11-04T00:04:05+00:00"
}
}
How to read it:
- yield: percentage (e.g., 4.52 = 4.52%).
- date: the market date (YYYY-MM-DD) for which the yield applies.
- source: where the figure was obtained (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": "NG", "maturities": "2Y,10Y"}
)
data = resp.json()
ng_10y = data["data"]["NG"]["10Y"]["yield"]
as_of = data["data"]["NG"]["10Y"]["date"]
print(f"Nigeria 10Y: {ng_10y}% as of {as_of}")
JavaScript (fetch)
const url = new URL("https://bonds-api.com/api/v1/latest");
url.searchParams.set("countries", "NG");
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 tenY = json.data.NG["10Y"].yield;
const d = json.data.NG["10Y"].date;
console.log(`Nigeria 10Y: ${tenY}% (as of ${d})`);
});
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=NG&maturities=2Y,10Y";
$json = file_get_contents($url, false, $context);
$data = json_decode($json, true);
$tenY = $data["data"]["NG"]["10Y"]["yield"];
$date = $data["data"]["NG"]["10Y"]["date"];
echo "NG 10Y: {$tenY}% on {$date}\n";
Get a specific past day: /historical
Request the 10Y yield on a given date. Bonds API returns the yield if available for that business day; if the date is a weekend/holiday, no row is returned (HTTP 404 or 404-style error payload). Choose a nearby previous business day if needed.
cURL
JSON response (sample)
Fields:
- country, maturity: echo your request.
- date: requested market date (YYYY-MM-DD).
- yield: percentage.
- source: data provenance.
Python (requests)
import requests
resp = requests.get(
"https://bonds-api.com/api/v1/historical",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "NG", "maturity": "10Y", "date": "2025-06-15"}
)
print(resp.json())
JavaScript (fetch)
const params = new URLSearchParams({
country: "NG",
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(console.log);
PHP (Guzzle)
<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client([
'base_uri' => 'https://bonds-api.com/api/v1/'
]);
$res = $client->request('GET', 'historical', [
'headers' => ['X-API-Key' => 'YOUR_API_KEY'],
'query' => ['country' => 'NG', 'maturity' => '10Y', 'date' => '2025-06-15']
]);
echo $res->getBody();
Pull a Nigeria 10Y time series: /timeseries
Download the 10Y yield across a time window for modeling, charting, or risk backtests. The series returns business days only and excludes weekends/holidays automatically.
cURL
JSON response (sample)
Fields:
- series: array of daily observations (date, yield).
- date format: YYYY-MM-DD, local market business days only.
Python (requests)
import requests
import pandas as pd
resp = requests.get(
"https://bonds-api.com/api/v1/timeseries",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "NG", "maturity": "10Y", "start": "2025-11-04", "end": "2026-11-04"}
)
series = resp.json()["series"]
df = pd.DataFrame(series) # columns: date, yield
print(df.head())
JavaScript (fetch)
const qs = new URLSearchParams({
country: "NG",
maturity: "10Y",
start: "2025-11-04",
end: "2026-11-04"
});
fetch(`https://bonds-api.com/api/v1/timeseries?${qs}`, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(({ series }) => {
// e.g., feed to a chart library
console.log(series.slice(0, 3));
});
PHP (file_get_contents)
<?php
$hdr = "X-API-Key: YOUR_API_KEY\r\n";
$ctx = stream_context_create(['http' => ['method' => 'GET', 'header' => $hdr]]);
$url = "https://bonds-api.com/api/v1/timeseries?country=NG&maturity=10Y&start=2025-11-04&end=2026-11-04";
$json = file_get_contents($url, false, $ctx);
echo $json;
Measure spread vs benchmark: /spread
To compare Nigeria 10Y vs a benchmark like the US Treasury 10Y, use the spread endpoint. Spreads are returned in basis points to simplify risk and relative-value analysis.
cURL
JSON response (sample)
Fields:
- spread_bps: basis-point difference = (country_yield − benchmark_yield) × 100.
- country_yield, benchmark_yield: both in percent.
Python (requests)
import requests
resp = requests.get(
"https://bonds-api.com/api/v1/spread",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "NG", "benchmark": "US", "maturity": "10Y"}
)
s = resp.json()
print(f"NG 10Y vs US 10Y: {s['spread_bps']} bps")
JavaScript (fetch)
const p = new URLSearchParams({ country: "NG", 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(s => console.log(`Spread: ${s.spread_bps} bps`));
PHP (Guzzle)
<?php
$client = new GuzzleHttp\Client(['base_uri' => 'https://bonds-api.com/api/v1/']);
$res = $client->get('spread', [
'headers' => ['X-API-Key' => 'YOUR_API_KEY'],
'query' => ['country' => 'NG', 'benchmark' => 'US', 'maturity' => '10Y']
]);
echo $res->getBody();
Build the Nigeria yield curve: /curve
Get a full cross-section of yields across maturities for Nigeria on the latest day (or a specified date). The response also indicates whether the curve is inverted.
cURL
JSON response (sample)
Fields:
- curve: mapping from maturity code to yield in percent.
- date: the curve’s market date (YYYY-MM-DD).
- inverted: true if long-tenor yields are broadly below short-tenor levels.
Tabular view of curve maturities
| 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": "NG"}
).json()
curve = r["curve"]
print("NG curve 10Y:", curve["10Y"], "%", "inverted:", r["inverted"])
JavaScript (fetch)
const qs2 = new URLSearchParams({ country: "NG" });
fetch(`https://bonds-api.com/api/v1/curve?${qs2}`, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(c => {
console.log("Curve date:", c.date, "NG 10Y:", c.curve["10Y"], "%", "inverted:", c.inverted);
});
PHP (file_get_contents)
<?php
$ctx = stream_context_create(["http" => ["method" => "GET", "header" => "X-API-Key: YOUR_API_KEY\r\n"]]);
echo file_get_contents("https://bonds-api.com/api/v1/curve?country=NG", false, $ctx);
Intraday Nigeria 10Y snapshots: /intraday
For trading tools and live dashboards, fetch intraday snapshots with UTC timestamps. Each snapshot includes a fetched_at timestamp and the yield at that moment.
cURL
JSON response (sample)
Fields:
- snapshots[].yield: percent at the moment of capture.
- snapshots[].fetched_at: ISO 8601 UTC timestamp.
- meta.timezone: “UTC” confirms timestamp basis.
Python (requests)
import requests
r = requests.get(
"https://bonds-api.com/api/v1/intraday",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"country": "NG", "maturity": "10Y", "date": "2026-11-04"}
).json()
ticks = [(s["fetched_at"], s["yield"]) for s in r["snapshots"]]
print(ticks)
JavaScript (fetch)
const pi = new URLSearchParams({ country: "NG", maturity: "10Y", date: "2026-11-04" });
fetch(`https://bonds-api.com/api/v1/intraday?${pi}`, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(({ snapshots, meta }) => {
console.log("Timezone:", meta.timezone, "points:", snapshots.length);
});
PHP (Guzzle)
<?php
$client = new GuzzleHttp\Client(['base_uri' => 'https://bonds-api.com/api/v1/']);
$res = $client->get('intraday', [
'headers' => ['X-API-Key' => 'YOUR_API_KEY'],
'query' => ['country' => 'NG', 'maturity' => '10Y', 'date' => '2026-11-04']
]);
echo $res->getBody();
Summarize changes over time: /fluctuation
To compute change, min, and max over a period, use the fluctuation endpoint. This is efficient for dashboards that need summary statistics instead of full time series.
cURL
JSON response (sample)
Fields:
- start_yield, end_yield: percent at the boundaries.
- change: arithmetic difference in percent points (end − start).
- min, max: extrema over the window, in percent.
Python (requests)
import requests
r = requests.get(
"https://bonds-api.com/api/v1/fluctuation",
headers={"X-API-Key": "YOUR_API_KEY"},
params={"countries": "NG", "maturity": "10Y", "start": "2025-11-04", "end": "2026-11-04"}
).json()
stats = r["data"]["NG"]
print(f"Δ: {stats['change']} pp, min: {stats['min']}%, max: {stats['max']}%")
JavaScript (fetch)
const pf = new URLSearchParams({
countries: "NG",
maturity: "10Y",
start: "2025-11-04",
end: "2026-11-04"
});
fetch(`https://bonds-api.com/api/v1/fluctuation?${pf}`, {
headers: { "X-API-Key": "YOUR_API_KEY" }
})
.then(r => r.json())
.then(({ data }) => console.log(data.NG));
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/fluctuation?countries=NG&maturity=10Y&start=2025-11-04&end=2026-11-04";
echo file_get_contents($url, false, $ctx);
Error handling and operational notes
Common errors are returned with success=false and an error message. Typical HTTP cases include 401 (missing/invalid key), 403 (quota exceeded), 404 (no data for your country/maturity/date), 422 (invalid parameter formats), 429 (rate limit exceeded), and 500 (server error). Always check the success flag before using numeric fields.
When building resilient clients:
- Retry idempotent GETs on 429/500 with exponential backoff.
- Cache static responses (historical, timeseries) to reduce calls.
- Normalize daily series to a business-day index to align across countries.
- Use UTC consistently for intraday timestamps; the meta.timezone field indicates UTC.
Use cases: from research to production
- Fixed-income dashboards: combine /latest for NG 10Y with /spread vs US 10Y for quick relative-value views.
- Risk tools: feed /timeseries into duration/convexity-aware models; monitor /fluctuation to set alert bands.
- Macro research: query /curve daily and study curve shape transitions using inverted=true/false.
- Trading utilities: display /intraday NG 10Y ticks beside benchmark snapshots to spot dislocations.
For integration planning and endpoint exploration, bookmark bonds-api.com and the MCP reference.
Official sample payload (verbatim)
The following sample shows a latest call and its response block exactly as provided. You can compare its response shape to the Nigeria examples above when adapting your parsers.
Implementation checklist
- Authentication: include X-API-Key in headers for all requests.
- Units: yields in percent; spreads in basis points; timestamps in UTC where provided.
- Calendars: daily endpoints return business days; handle gaps on weekends/holidays.
- Performance: coalesce multiple maturities into one /latest call when building a curve snapshot; cache historical/time series.
- Validation: check success flag; on non-2xx, inspect error message and status code.
Quick reference: all endpoints shown above
- /api/v1/latest — latest Nigeria yields by maturity
- /api/v1/historical — a specific day’s Nigeria 10Y
- /api/v1/timeseries — Nigeria 10Y series between dates
- /api/v1/spread — spread vs benchmark (e.g., US 10Y)
- /api/v1/curve — full Nigeria curve and inversion flag
- /api/v1/intraday — intraday Nigeria 10Y snapshots
- /api/v1/fluctuation — change/min/max over a period
FAQ
How are yields expressed?
All yields are numeric percentages (e.g., 4.52 means 4.52%). Spread values returned by /spread are in basis points (bps).
What timezone are timestamps in?
Daily endpoints show market dates in YYYY-MM-DD. Intraday fetched_at timestamps are ISO 8601 in UTC, with meta.timezone confirming UTC.
How often are values updated?
Latest and intraday endpoints update throughout the trading day when new snapshots are available. Historical, timeseries, and curve reflect official end-of-day or most recently available market data for the stated date.
What if I query a weekend or holiday?
Daily endpoints only return business days; a non-trading date will not have a record. Use the prior business day or query a range via /timeseries.
Can I fetch multiple maturities in one request?
Yes. Use /latest with the maturities parameter (e.g., 1M,3M,6M,1Y,2Y,5Y,10Y,30Y) to build a curve snapshot efficiently, or use /curve for the full cross-section.
Ready to integrate Nigeria’s 10-year yield into your models and dashboards? Get an API key at Register and start testing endpoints in the MCP. For product details and updates, visit bonds-api.com.