Data API
African government auctions, as JSON
The datasets behind the T-bill monitor and borrowing-cost measures, open to any script or spreadsheet. The latest 12 months, up to 100 rows a call, need no key and no sign-up: call it, keep the credit line, and link back. Full history, larger calls and any commercial use, including internal use at a fund, bank or firm, need a pilot or paid key; see the terms and Afronomics Data.
Endpoints
Four calls cover everything
| Request | Returns |
|---|---|
GET /api/v1/tbills | Every market with its latest 91-, 182- and 364-day result, the previous rate, the source document and where the history starts. |
GET /api/v1/tbills/{market} | One market’s auction history. Optional: tenor=91|182|364, from and to (YYYY-MM-DD), limit. Newest first. No key: the latest 12 months, up to 100 rows a call. With a key: full history, limit default 500, up to 5,000. |
GET /api/v1/bonds | Government bond auctions: each market with data (Kenya, Zambia, Egypt, Nigeria, Uganda, Morocco and the eight WAEMU markets), where its history starts, whether its dates are auction or settlement dates (date_kind), and its latest results. |
GET /api/v1/bonds/{market} | One market’s bond auction history: ISIN, tenor, amounts offered, bid and accepted, bid-to-cover, rate and coupon, with the source. Optional: isin, issue (the WAEMU country, e.g. issue=senegal), from and to (YYYY-MM-DD), limit. Newest first. Same free and keyed limits as bills. |
GET /api/v1/index | The Afronomics African Sovereign Bill Index: latest weekly reading, changes, each market’s contribution and the weekly series (the latest 12 months without a key, the full series with one). tenor=91 for the three-month version. |
GET /api/v1/measures | Real yields on one-year bills, bids-to-offer demand over the last 90 days, and each market’s expected next result. |
Markets: kenya, nigeria, ghana, uganda, tanzania, egypt, southafrica, zambia, malawi, mozambique. Rates are percent per annum as each central bank publishes them; amounts are in local currency, millions.
Python
From Python
import requests
base = "https://www.afronomicsfeed.com/api/v1"
# Latest one-year rate in every market
for m in requests.get(f"{base}/tbills").json()["markets"]:
one_year = m["latest"].get("364")
if one_year:
print(m["country"], one_year["rate"], one_year["date"])
# Kenya's 91-day rate over the last 12 months (free), into pandas
import pandas as pd
rows = requests.get(f"{base}/tbills/kenya", params={"tenor": 91}).json()["rows"]
df = pd.DataFrame(rows).set_index("date").sort_index()
# Full history: send your pilot or licence key
key = {"Authorization": "Bearer afk_YOUR_KEY"}
rows = requests.get(f"{base}/tbills/kenya", params={"tenor": 91, "from": "2010-01-01"}, headers=key).json()["rows"]Shell
From the command line
curl "https://www.afronomicsfeed.com/api/v1/tbills/nigeria?tenor=364&limit=10"
# With a key: full history, up to 5,000 rows a call
curl -H "Authorization: Bearer afk_YOUR_KEY" \
"https://www.afronomicsfeed.com/api/v1/tbills/nigeria?tenor=364&from=2010-01-01"Responses are cached for five minutes and allow calls from any website (CORS open), so you can fetch them straight from a browser page. Every response carries an attribution line; show it wherever the numbers appear.
Free tier and keys
What a call without a key returns
- History calls (
/tbills/{market},/bonds/{market}and the CSV files under/api/data/) return rows dated in the latest 12 months, by auction or settlement date, up to 100 a call. Nothing is cut silently: whenever a key would have returned more, the response says"truncated": truewith anupgradelink. It also carries afree_tiernote, withfree_tier.nextfor the next page inside the free window, and every keyless response has the headerX-Afronomics-Free-Tier: true. CSV files say the same in the#lines at the top. - Send a key as
Authorization: Bearer afk_…(orX-API-Key: afk_…) for the full history and up to 5,000 rows a call; a CSV file with a key is the whole file. Keyed calls are served fresh and counted per key. - In a browser, where a link cannot send a header, sign in once at /downloads with your key: for 12 hours the site's CSV links give the full history, counted against the key. The key never goes into a link. Analyst keys work for CSV files only, not the JSON API.
- A key that is unknown, revoked or expired is not an error: the call gets the free tier, with
"key_status": "not_recognised"and the headerX-Afronomics-Key: not-recognised.
Licensed keys
Webhooks: an event for each new auction result
Team and API and Enterprise licences can receive an auction.published event at an https address of their choice, once per market, tenor and auction date, within minutes of the result reaching the site. Ask the desk to set it up; you receive a signing secret. Every request carries X-Afronomics-Signature: t=<unix seconds>,v1=<hex>, the HMAC-SHA256 of <t>.<body> with your secret. Reject a timestamp more than five minutes old, and answer 2xx within ten seconds; anything else is retried on the next run for up to four days.
import hashlib, hmac, time
def verify(secret: str, header: str, body: bytes) -> bool:
parts = dict(p.split("=", 1) for p in header.split(","))
t = int(parts["t"])
if abs(time.time() - t) > 300:
return False
want = hmac.new(secret.encode(), f"{t}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(want, parts["v1"])
# Body: {"id": "kenya:tbill:91:2026-10-26", "type": "auction.published", "market": "kenya",
# "instrument": "tbill", "tenor_days": 91, "value_date": "2026-10-26", "rate_pct": 8.7478,
# "offered_m": 8000, "received_m": 14336.6, "accepted_m": 14334.2, "source_url": "https://..."}Terms
Free to read and cite; a key for history and commercial use
Free, no key
- Reading the site: every page, table and chart.
- Quoting and citing figures with the credit “Source: Afronomics” and a link.
- The JSON API and CSV downloads for the latest 12 months (by auction or settlement date), up to 100 rows a call.
- For research, journalism, teaching and non-commercial apps.
A key: pilot or paid licence
- Full history (rows older than 12 months), more than 100 rows a call, and bulk CSV beyond the free window.
- Any commercial use, including internal use at a fund, bank, insurer, DFI or other firm: analysis, models, committee papers and client work.
- Start with a free 30-day pilot key, then Analyst, Team and API, or the Startup licence for one product.
Enterprise only: redistribution
- Passing the data, or files and feeds built from it, to clients or other third parties, or reselling it.
- No other plan includes redistribution. Enterprise also covers several teams, custom delivery and a service agreement, from $5,000 a month.
Can a fund, bank or firm use the free API for its own internal analysis? No. Internal use at a fund, bank or firm is commercial use and needs a pilot key or a paid licence. The free tier is for research, journalism, teaching and non-commercial apps.
Fair use: please cache on your side rather than calling on every page view. Plans and prices are on the licensing page.
Licence