Kenya Bond Curve API

Kenya Bond Curve API

Teams building dashboards, analytics, and risk tools for East African markets often struggle to source clean, machine-readable Kenya sovereign yields across maturities and dates. By the end of this guide you will be able to fetch Kenya’s latest government bond yields, request specific historical dates, build time series and yield curves, compare spreads to benchmarks, and retrieve intraday snapshots—directly into your applications using the Bonds API over HTTPS.

What you can build with Kenya sovereign yields

Kenya issues Treasury bills and bonds across the curve, from short T-bills to multi-year bonds. The yield is the annualized return expected by investors and is expressed in percentage points. With bonds-api.com, you can:

Illustration: Kenya Bond Curve API
  • Render a Kenya yield curve and detect slope or inversion for macro signals.
  • Monitor 10Y KE yields versus US Treasuries to track risk premium (spread in basis points).
  • Backtest strategies using daily time series and compute carry/roll or DV01 impacts.
  • Streamline dashboards with intraday snapshots for the most traded tenors.

All endpoints are HTTP GET under https://bonds-api.com/api/v1/. Authentication is via the X-API-Key header only. Responses use ISO date strings (YYYY-MM-DD) and, for timestamps, ISO 8601 with UTC offset (e.g., 2026-10-20T12:00:00Z). Yields are returned as percentages (e.g., 4.52 means 4.52%). Spreads are in basis points (bps).

Kenya maturities and building the curve

The API covers common bill and bond tenors. For Kenya (ISO2: KE), typical maturities include short bills (1M, 3M, 6M), medium bonds (1Y, 2Y, 5Y), and long bonds (10Y, 30Y). You can query discrete maturities or request a full curve snapshot. Market data aligns with business days; weekends and Kenyan market holidays will have no new values. When backfilling, request a date range to skip non-trading days automatically. Cache the latest response for the same trading day and use If-Modified-Since logic client-side if you poll intraday snapshots to minimize your calls.

Endpoint: Latest yields for Kenya

Fetch current yields for one or more maturities. Omitting maturities returns all available for the country.

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': 'KE', 'maturities': '2Y,10Y'}
)
data = resp.json()
# Access: data['data']['KE']['10Y']['yield'] (percent), data['data']['KE']['10Y']['date'] (YYYY-MM-DD)
print(data)

JavaScript (fetch)

async function fetchLatestKE() {
const url = new URL('https://bonds-api.com/api/v1/latest');
url.searchParams.set('countries', 'KE');
url.searchParams.set('maturities', '2Y,10Y');

const res = await fetch(url.toString(), {
method: 'GET',
headers: {'X-API-Key': 'YOUR_API_KEY'}
});
const json = await res.json();
// Example access: json.data.KE['2Y'].yield
console.log(json);
}
fetchLatestKE();

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=KE&maturities=2Y,10Y";
$json = file_get_contents($url, false, $context);
$data = json_decode($json, true);
// $data['data']['KE']['2Y']['yield']
print_r($data);
?>

Sample JSON response

{
"success": true,
"date": "2026-10-20",
"rates": {
"US_10Y": 5.149
},
"dates": {
"US_10Y": "2026-10-20"
},
"currencies": {
"US_10Y": "USD"
},
"meta": {
"request_id": "ab72d313-4c90-4fb4-92c0-df33b6440e10",
"timestamp": "2026-10-20T00:06:27+00:00"
}
}

Interpretation: yields are percentages; date is the market date (YYYY-MM-DD). “source” shows provenance (official or market). If you cache, key by country+date+maturity to avoid mixing days.

Endpoint: Historical yield for Kenya on a specific date

Use this to read the Kenya yield at a known valuation date, such as end-of-month or a portfolio snapshot date.

cURL

Python (requests)

import requests

params = {'country': 'KE', '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)
hist = r.json()
# hist['yield'] is a percent for the requested YYYY-MM-DD
print(hist)

JavaScript (fetch)

async function fetchHistoricalKE() {
const url = new URL('https://bonds-api.com/api/v1/historical');
url.searchParams.set('country', 'KE');
url.searchParams.set('maturity', '10Y');
url.searchParams.set('date', '2025-06-15');

const res = await fetch(url, { headers: {'X-API-Key': 'YOUR_API_KEY'} });
const json = await res.json();
console.log(json);
}
fetchHistoricalKE();

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/historical?country=KE&maturity=10Y&date=2025-06-15";
$out = file_get_contents($url, false, $ctx);
echo $out;
?>

Sample JSON response

Interpretation: yield is a percentage for the exact date requested. If the date falls on a non-business day without a fixing, expect a 404 error; request the closest business day instead or query a range and select the previous available date.

Endpoint: Time series for Kenya

Retrieve daily yields across a period to compute changes, min/max, rolling averages, or to chart trends. Start and end are inclusive when data is available.

cURL

Python (requests)

import requests
p = {'country': 'KE', 'maturity': '10Y', 'start': '2025-10-20', 'end': '2026-10-20'}
res = requests.get('https://bonds-api.com/api/v1/timeseries',
headers={'X-API-Key': 'YOUR_API_KEY'},
params=p)
ts = res.json()
# ts['series'] is a list of {date: 'YYYY-MM-DD', yield: float in percent}
print(ts)

JavaScript (fetch)

async function fetchKETS() {
const url = new URL('https://bonds-api.com/api/v1/timeseries');
url.searchParams.set('country', 'KE');
url.searchParams.set('maturity', '10Y');
url.searchParams.set('start', '2025-10-20');
url.searchParams.set('end', '2026-10-20');
const res = await fetch(url, { headers: {'X-API-Key': 'YOUR_API_KEY'} });
const json = await res.json();
// Example: compute daily change
if (json.series?.length > 1) {
const d0 = json.series[0].yield, d1 = json.series.at(-1).yield;
console.log('Change (pp):', (d1 - d0).toFixed(2));
}
console.log(json);
}
fetchKETS();

PHP (file_get_contents)

<?php
$h = ["X-API-Key: YOUR_API_KEY\r\n"];
$ctx = stream_context_create(['http' => ['method' => 'GET', 'header' => implode('', $h)]]);
$url = "https://bonds-api.com/api/v1/timeseries?country=KE&maturity=10Y&start=2025-10-20&end=2026-10-20";
$json = file_get_contents($url, false, $ctx);
echo $json;
?>

Sample JSON response

Interpretation: each element is a business-day fixing for the specified tenor, in percent. Gaps indicate weekends/holidays. Use these to compute realized volatility, rolling beta to benchmarks, or to validate signals.

Endpoint: Spread vs benchmark (Kenya vs US Treasury)

Compute the spread between Kenya and a benchmark country’s yield, typically the US (ISO2: US) or DE for Bunds, at a given maturity. The response includes the spread in basis points and both absolute yields.

cURL

Python (requests)

import requests
p = {'country': 'KE', 'benchmark': 'US', 'maturity': '10Y'}
r = requests.get('https://bonds-api.com/api/v1/spread',
headers={'X-API-Key': 'YOUR_API_KEY'},
params=p)
sp = r.json()
# sp['spread_bps'] is basis points; yields are in percent
print(sp)

JavaScript (fetch)

async function keSpread() {
const url = new URL('https://bonds-api.com/api/v1/spread');
url.searchParams.set('country', 'KE');
url.searchParams.set('benchmark', 'US');
url.searchParams.set('maturity', '10Y');
const res = await fetch(url, { headers: {'X-API-Key': 'YOUR_API_KEY'} });
const json = await res.json();
// Spread in bps, e.g., 215 means 2.15 percentage points
console.log(json);
}
keSpread();

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/spread?country=KE&benchmark=US&maturity=10Y";
echo file_get_contents($url, false, $ctx);
?>

Sample JSON response

Interpretation: spread_bps is 215 bps (2.15 percentage points). country_yield and benchmark_yield are both in percent on the evaluation date. Use this to watch Kenya’s risk premium in real time.

Endpoint: Full Kenya yield curve

This endpoint returns a single-day snapshot of the entire curve so you can fit a spline, compute forward rates, or flag inversions.

cURL

Python (requests)

import requests
r = requests.get('https://bonds-api.com/api/v1/curve',
headers={'X-API-Key': 'YOUR_API_KEY'},
params={'country': 'KE'})
curve = r.json()
# curve['curve'] is a mapping from tenor string to yield percent
print(curve)

JavaScript (fetch)

async function keCurve() {
const url = new URL('https://bonds-api.com/api/v1/curve');
url.searchParams.set('country', 'KE');
const res = await fetch(url, { headers: {'X-API-Key': 'YOUR_API_KEY'} });
const json = await res.json();
// Example: detect inversion 10Y < 2Y
const y2 = json.curve?.['2Y'];
const y10 = json.curve?.['10Y'];
console.log('Inverted 2s10s:', y10 !== undefined && y2 !== undefined ? y10 < y2 : null);
console.log(json);
}
keCurve();

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/curve?country=KE";
$out = file_get_contents($url, false, $ctx);
echo $out;
?>

Sample JSON response

Interpretation: curve holds tenor-to-yield pairs in percent. “inverted” flags any generalized inversion across major points; you can still compute localized slopes (e.g., 2s10s). Date is the valuation day for the snapshot.

Endpoint: Intraday snapshots for Kenya

Use this when you want multiple snapshots within a day for a given maturity, with UTC timestamps. Helpful for trading dashboards or monitoring during auction days.

cURL

Python (requests)

import requests, datetime
p = {'country': 'KE', 'maturity': '10Y', 'date': '2026-10-20'}
r = requests.get('https://bonds-api.com/api/v1/intraday',
headers={'X-API-Key': 'YOUR_API_KEY'}, params=p)
snap = r.json()
# snap['snapshots'] contains {yield: percent, fetched_at: ISO8601 UTC}
print(snap)

JavaScript (fetch)

async function keIntraday() {
const url = new URL('https://bonds-api.com/api/v1/intraday');
url.searchParams.set('country', 'KE');
url.searchParams.set('maturity', '10Y');
url.searchParams.set('date', '2026-10-20');
const res = await fetch(url, { headers: {'X-API-Key': 'YOUR_API_KEY'} });
const json = await res.json();
// Example: get last snapshot of the day
const last = json.snapshots?.at(-1);
console.log('Last snapshot:', last);
}
keIntraday();

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/intraday?country=KE&maturity=10Y&date=2026-10-20";
echo file_get_contents($url, false, $ctx);
?>

Sample JSON response

Interpretation: yields are percentages; fetched_at is an ISO 8601 UTC timestamp. Use count to validate completeness. Cache by date+maturity and merge new snapshots if you poll during the day.

Endpoint: Fluctuation over a period

Summarize start and end yields, absolute change (percentage points), and observed min/max over a window. This is a convenient alternative to pulling a time series and computing stats yourself.

cURL

Python (requests)

import requests
p = {'countries': 'KE', 'maturity': '10Y', 'start': '2025-10-20', 'end': '2026-10-20'}
r = requests.get('https://bonds-api.com/api/v1/fluctuation',
headers={'X-API-Key': 'YOUR_API_KEY'}, params=p)
fx = r.json()
# fx['data']['KE'] has start_yield, end_yield, change (pp), min, max
print(fx)

JavaScript (fetch)

async function keFluctuation() {
const url = new URL('https://bonds-api.com/api/v1/fluctuation');
url.searchParams.set('countries', 'KE');
url.searchParams.set('maturity', '10Y');
url.searchParams.set('start', '2025-10-20');
url.searchParams.set('end', '2026-10-20');
const res = await fetch(url, { headers: {'X-API-Key': 'YOUR_API_KEY'} });
const json = await res.json();
console.log(json);
}
keFluctuation();

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=KE&maturity=10Y&start=2025-10-20&end=2026-10-20";
echo file_get_contents($url, false, $ctx);
?>

Sample JSON response

Interpretation: change is in percentage points (end minus start). min and max are observed extrema within the period, in percent. Use this to compute drawdowns or alerting thresholds.

Error handling, dates, units, and caching details

  • Authentication: include X-API-Key: YOUR_API_KEY in every GET request.
  • Status and shape: errors return success=false with an error message. Handle 401 (key issues), 403 (quota), 404 (no data for combination), 422 (invalid parameter), 429 (rate limit), 500 (server).
  • Units: yields are percentages; spreads are in basis points. Convert bps to percentage points by dividing by 100.
  • Dates: all date fields are YYYY-MM-DD. Intraday timestamps are ISO 8601 UTC.
  • Business days: no fixings on weekends/holidays. For range queries, you’ll see gaps—this is expected.
  • Caching: for latest and curve endpoints, cache by country and date to minimize redundant traffic within the same valuation day. For intraday, upsert by fetched_at to avoid duplicates.

How to assemble and compare Kenya curve points

When an endpoint supports multiple symbols (e.g., /latest with maturities list), you can build a mini-curve without additional calls, then compute slopes or spreads across the tenors returned. For a full snapshot, /curve is simpler and also includes an “inverted” boolean.

TenorUse caseEndpoint
1M, 3M, 6MFunding curve, carry estimates/api/v1/curve or /api/v1/latest
1Y, 2YFront-end macro signals, policy expectations/api/v1/curve or /api/v1/latest
5Y, 10YBenchmark macro duration, beta to global rates/api/v1/curve, /api/v1/latest, /api/v1/timeseries
30YLiability matching, long-duration risk/api/v1/curve

Official sample block (verbatim) from live source

The following sample block is provided verbatim and demonstrates a latest-yield request and response format. Note that it uses a query parameter for the API key and targets US 10Y; your Kenya integration should follow the X-API-Key header pattern and KE examples shown above.

Fields: rates contains instrument-to-yield mappings in percent; date and dates are valuation dates; currencies map instruments to currency; meta.timestamp is the UTC timestamp of the response.

Putting it together: common patterns for fixed-income apps

  • Yield curve visualization: call /curve daily after local market close; cache by country+date; annotate inversion or 2s10s slope in the UI.
  • Risk dashboards: poll /latest for a subset of tenors (2Y, 5Y, 10Y) and /spread for KE vs US to track risk premium in bps alongside FX and equities.
  • Backtesting: for strategy research, pull /timeseries per maturity and compute rolling mean-reversion signals; summarize with /fluctuation to validate stability ranges.
  • Event monitoring: on auction or policy days, request /intraday for 10Y to capture multiple snapshots and display a mini-tape of yields with UTC timestamps.

How to read and normalize dates, time zones, and units

Yields are decimals representing percentage points (4.52 equals 4.52%). For spreads, 100 bps equals 1.00 percentage point. Dates are strings “YYYY-MM-DD” in the local market calendar context. Intraday timestamps are ISO 8601 in UTC; convert to your user’s time zone on the client if needed. When exporting to CSV or a database, use ISO formats to preserve ordering and avoid locale issues.

Operational notes: resilience and quotas

Implement retries with exponential backoff only for idempotent GETs when encountering transient 500s. Respect 429 responses by pausing before retrying. For 404/422, correct inputs rather than retrying. If you distribute data to multiple microservices, centralize a small caching layer keyed by endpoint+params to reduce duplicate calls.

Get an API key and explore the endpoints

You can start experimenting in minutes. Use the following resources to register and browse the APIs and schemas. Both links open in a new tab.

You can also browse the homepage for additional context: bonds-api.com.

FAQ

How often are Kenya yields updated?
Daily updates align with business days. Use /intraday for same-day snapshots. For non-trading days (weekends/holidays), the latest remains unchanged until the next fixing.

What units should my UI display?
All yields are in percentage points (e.g., 4.52%). Spreads are in basis points (bps). If you display spreads alongside yields, label units clearly.

How do I handle missing dates in a time series?
Gaps correspond to weekends or holidays. Use a forward-fill rule only if your analytics require continuous daily inputs; otherwise, keep business-day frequency.

Can I query multiple maturities at once?
Yes, with /latest pass a comma-separated maturities list (e.g., 2Y,10Y). For an entire snapshot across many tenors, use /curve.

What’s the difference between date and fetched_at?
date is the valuation day for the yield. fetched_at in /intraday is the precise UTC timestamp when that snapshot was observed.

Ready to integrate Kenya yields into your stack? Fetch your key and start calling the endpoints today: Register. Explore schemas and try queries in the 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.

Related posts

All posts →