Skip to main content

Counties

This endpoint allows you to retrieve counties in Uganda.

Get All Counties

Fetches a list of all counties in Uganda.

Endpoint

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

Headers

HeaderRequiredDescription
x-api-keyYesYour API key for authentication

Example Request

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

Response

{
"status": "success",
"data": [
{
"id": "1",
"name": "Nakawa",
"district_id": "1",
"district_name": "Kampala"
},
{
"id": "2",
"name": "Kawempe",
"district_id": "1",
"district_name": "Kampala"
}
]
}

Response Fields

FieldTypeDescription
statusstringThe status of the request ("success" or "error")
dataarrayArray of county objects
data[].idstringUnique identifier for the county
data[].namestringName of the county
data[].district_idstringID of the district this county belongs to
data[].district_namestringName of the district this county 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

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

Get Counties by District

Fetches all counties within a specific district.

Endpoint

GET https://api.opendataug.org/v1/districts/{district_id}/counties

Parameters

ParameterTypeRequiredDescription
district_idstringYesID of the district

Example Request

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

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