Kenya-info npm package
# 🇰🇪 kenya-info2
**kenya-info2** is a lightweight JavaScript wrapper for the Kenya Info API, providing easy access to data about **counties**, **constituencies**, and **wards** in Kenya.
It simplifies fetching regional data for applications, research, and location-based services.
---
## 📦 Installation
```bash
npm install kenya-info2
import {
getCounties,
getCountyDetails,
getConstituencies,
getConstituencyDetails,
getWards,
getWardDetails,
checkAPIHealth
} from "kenya-info2";
(async () => {
const counties = await getCounties();
console.log("Counties:", counties);
const county = await getCountyDetails(1);
console.log("County Details:", county);
const constituencies = await getConstituencies(1);
console.log("Constituencies:", constituencies);
const health = await checkAPIHealth();
console.log("API Health:", health);
})();
Available Functions
Function Description
getCounties() Returns a list of all Kenyan counties
getCountyDetails(countyId) Returns details of a specific county
getConstituencies(countyId) Returns constituencies within a given county
getConstituencyDetails(constituencyId) Returns details of a specific constituency
getWards(constituencyId) Returns wards under a constituency
getWardDetails(wardId) Returns details of a specific ward
checkAPIHealth() Checks if the API is online and responsive
Example Output
Sample Response for getCounties()
{
"success": true,
"data": [
{
"id": "6908ea00b854bc22ec3e04b9",
"code": 1,
"name": "Mombasa",
"capital": "",
"population": 0,
"area": 0,
"created_at": "2025-11-03T17:44:32.571Z",
"updated_at": "2025-11-03T17:44:32.571Z"
},
{
"id": "6908ea00b854bc22ec3e04ba",
"code": 2,
"name": "Kwale",
"capital": "",
"population": 0,
"area": 0,
"created_at": "2025-11-03T17:44:32.571Z",
"updated_at": "2025-11-03T17:44:32.571Z"
},
API Base URL
All data is sourced from the official Kenya Info API
.
You can also call the endpoints directly if neede …