Every developer building a Kenyan app runs into the same problem. You need a list of all 47 counties. Or all Kenyan banks with their codes. Or M-Pesa paybill numbers for KPLC, NHIF, KRA. And every time you end up manually copying data from Wikipedia or a PDF.
I fixed that. I built a free public REST API that serves all of this data in one place.
No authentication. No sign up. Just call the endpoint and get your data.
Live API: https://kenya-api-90wq.onrender.com
GitHub: https://github.com/Carter254g/kenya-api
What the API Serves
Four datasets available right now:
- All 47 Kenya counties with region and capital city
- All Kenyan banks with codes and SWIFT numbers
- M-Pesa paybill numbers by category
- Kenya public holidays
How to Use It
Get all 47 counties
const res = await fetch('https://kenya-api-90wq.onrender.com/api/counties');
const data = await res.json();
console.log(data);
Response:
{
"count": 47,
"data": [
{ "code": 1, "name": "Mombasa", "capital": "Mombasa", "region": "Coast" },
{ "code": 47, "name": "Nairobi", "capital": "Nairobi", "region": "Nairobi" }
]
}
Filter counties by region
GET /api/counties?region=Coast
GET /api/counties?region=Rift Valley
GET /api/counties?region=Nyanza
Search for a bank
const res = await fetch('https://kenya-api-90wq.onrender.com/api/banks?search=equity');
const data = await res.json();
Response:
{
"count": 1,
"data": [
{
"code": "49",
"name": "Equity Bank Kenya",
"shortname": "Equity",
"swift": "EQBLKENX"
}
]
}
Get M-Pesa paybills by category
GET /api/mpesa/paybills?category=Government
GET /api/mpesa/paybills?category=Banking
GET /api/mpesa/paybills?category=Utilities
Government paybills include KRA iTax, NHIF, NSSF, and eCitizen.
Get all public holidays
Government paybills include KRA iTax, NHIF, NSSF, and eCitizen.
Get all public holidays
How I Built It
The API is built with Node.js and Express. The data lives in JSON files inside the project. Each route reads from its JSON file and supports query parameters for filtering.
router.get('/', (req, res) => {
const { region } = req.query;
if (region) {
const filtered = counties.filter(c =>
c.region.toLowerCase() === region.toLowerCase()
);
return res.json({ count: filtered.length, data: filtered });
}
res.json({ count: counties.length, data: counties });
});
Simple, fast, and easy to extend.
I added helmet for security headers, morgan for request logging, and cors so any frontend can call it without issues.
What Is Coming Next
- Constituencies and wards data
- Universities and colleges
- Hospitals and health facilities
- Currency exchange rates
- Rate limiting and optional API keys for high volume users
Use It in Your Project
The API is live and free. No sign up required.
Base URL: https://kenya-api-90wq.onrender.com
If you use it in a project, star the repo and drop a comment below with what you built. I would love to see it.
Top comments (0)