Counties API

Access county and sub-county information across Kenya

List Counties

GET/api/v1/countiesPublic Key

Get a list of all Kenyan counties

Example Request

Request

curl -X GET "https://api.shambarecords.com/api/v1/counties" \
  -H "X-API-Key: sr_pub_your_public_key"

Response

{
  "data": [
    {
      "id": 1,
      "code": "001",
      "name": "Mombasa",
      "capital": "Mombasa City",
      "population": 1208333,
      "area_sq_km": 229.7,
      "sub_counties": [
        { "id": 1, "name": "Changamwe" },
        { "id": 2, "name": "Jomvu" },
        { "id": 3, "name": "Kisauni" },
        { "id": 4, "name": "Likoni" },
        { "id": 5, "name": "Mvita" },
        { "id": 6, "name": "Nyali" }
      ]
    },
    {
      "id": 47,
      "code": "047",
      "name": "Nairobi",
      "capital": "Nairobi City",
      "population": 4397073,
      "area_sq_km": 696.0,
      "sub_counties": [
        { "id": 285, "name": "Dagoretti North" },
        { "id": 286, "name": "Dagoretti South" },
        { "id": 287, "name": "Embakasi Central" },
        { "id": 288, "name": "Embakasi East" }
      ]
    }
  ]
}

Get County by ID

GET/api/v1/counties/:idPublic Key

Retrieve detailed information about a specific county

Path Parameters

Parameters

idintegerrequired

County ID (1-47)

Example Request

Request

curl -X GET "https://api.shambarecords.com/api/v1/counties/47" \
  -H "X-API-Key: sr_pub_your_public_key"

Response

{
  "data": {
    "id": 47,
    "code": "047",
    "name": "Nairobi",
    "capital": "Nairobi City",
    "population": 4397073,
    "area_sq_km": 696.0,
    "coordinates": {
      "latitude": -1.286389,
      "longitude": 36.817223
    },
    "sub_counties": [
      {
        "id": 285,
        "name": "Dagoretti North",
        "wards": ["Kilimani", "Kawangware", "Gatina", "Kileleshwa", "Kabiro"]
      },
      {
        "id": 286,
        "name": "Dagoretti South",
        "wards": ["Mutu-ini", "Ngand'o", "Riruta", "Uthiru/Ruthimitu", "Waithaka"]
      },
      {
        "id": 287,
        "name": "Embakasi Central",
        "wards": ["Kayole North", "Kayole Central", "Kayole South", "Komarock", "Matopeni/Spring Valley"]
      }
    ],
    "economy": {
      "main_activities": ["Services", "Manufacturing", "Trade"],
      "agricultural_products": ["Vegetables", "Dairy", "Poultry"]
    },
    "created_at": "2024-01-01T00:00:00Z",
    "updated_at": "2024-01-01T00:00:00Z"
  }
}

Get Sub-Counties

GET/api/v1/counties/:id/sub-countiesPublic Key

Get all sub-counties for a specific county

Example Request

Request

curl -X GET "https://api.shambarecords.com/api/v1/counties/22/sub-counties" \
  -H "X-API-Key: sr_pub_your_public_key"

Response

{
  "data": {
    "county": {
      "id": 22,
      "name": "Kiambu"
    },
    "sub_counties": [
      {
        "id": 181,
        "name": "Gatundu North",
        "wards": ["Gituamba", "Githobokoni", "Chania", "Mang'u"]
      },
      {
        "id": 182,
        "name": "Gatundu South",
        "wards": ["Kiamwangi", "Kiganjo", "Ndarugu", "Ngenda"]
      },
      {
        "id": 183,
        "name": "Githunguri",
        "wards": ["Githunguri", "Githiga", "Ikinu", "Ngewa", "Komothai"]
      },
      {
        "id": 184,
        "name": "Kiambaa",
        "wards": ["Cianda", "Karuri", "Ndenderu", "Muchatha", "Kihara"]
      }
    ]
  }
}

County Object Schema

Response Schema

idinteger

County ID (1-47)

codestring

Three-digit county code (e.g., '001', '047')

namestring

County name

capitalstring

County capital/headquarters

populationintegernullable

Population count (latest census)

area_sq_kmnumbernullable

Area in square kilometers

coordinatesobjectnullable

Geographic coordinates (latitude, longitude)

sub_countiesarray of objects

List of sub-counties with IDs, names, and wards

economyobjectnullable

Economic information (main activities, agricultural products)