Skip to main content

Subcounties

This endpoint allows you to retrieve subcounties in Uganda.

Get All Subcounties

Fetches a list of all subcounties in Uganda.

Endpoint

GET https://api.opendataug.org/v1/subcounties

Headers

HeaderRequiredDescription
x-api-keyYesYour API key for authentication

Example Request

curl -X GET \
'https://api.opendataug.org/v1/subcounties' \
-H 'x-api-key: your_api_key_here'

Response

{
"status": "success",
"data": [
{
"id": "1",
"name": "Central Division",
"county_id": "1",
"county_name": "Nakawa",
"district_id": "1",
"district_name": "Kampala"
}
]
}

Response Fields

FieldTypeDescription
statusstringThe status of the request ("success" or "error")
dataarrayArray of subcounty objects
data[].idstringUnique identifier for the subcounty
data[].namestringName of the subcounty
data[].county_idstringID of the county this subcounty belongs to
data[].county_namestringName of the county this subcounty belongs to
data[].district_idstringID of the district this subcounty belongs to
data[].district_namestringName of the district this subcounty belongs to

Error Responses

Status CodeDescription
401Invalid or missing API key
429Too many requests - Rate limit exceeded
500Internal server error

Rate Limiting

This endpoint is subject to rate limiting. Please refer to our rate limiting documentation for more details.

Notes

  • Subcounties are administrative divisions within counties
  • The API response is paginated with 100 subcounties per page
  • Subcounties are sorted alphabetically by name

Get Subcounties by County

Fetches all subcounties within a specific county.

Endpoint

GET https://api.opendataug.org/v1/counties/{county_id}/subcounties

Parameters

ParameterTypeRequiredDescription
county_idstringYesID of the county

Example Request

curl -X GET \
'https://api.opendataug.org/v1/counties/1/subcounties' \
-H 'x-api-key: your_api_key_here'

The response format is the same as the Get All Subcounties endpoint.