Search District
https://rajaongkir.komerce.id/api/v1/destination/district/{city_id}
The Search District Endpoint represents the third vital step in the hierarchical location selection process for the RajaOngkir API. This endpoint retrieves all districts (kecamatan) within a specific city, enabling applications to offer a fully detailed and dynamic location selection experience down to the district level.
By supplying the city ID obtained from the Search City endpoint, users can access structured district data necessary for accurate shipping rate calculations, service availability checks, or address validation. This fine-grained geographic data is particularly beneficial for last-mile delivery logistics, dynamic form population, and e-commerce checkout flows.
This endpoint plays a critical role in systems that require complete administrative breakdowns, ensuring that end users can precisely define their shipping destinations with minimal error.
Endpoint Details
-
Method:
GET
-
Base URL:
https://rajaongkir.komerce.id/api/v1/destination/district/{city_id}
-
Description:
Retrieves a list of all districts within a specified Indonesian city using the city ID. This endpoint provides the third level in the location hierarchy and is essential for completing the destination input needed for shipping cost calculations and logistic planning.
This endpoint serves as the third step in the Step-by-Step Method integration model, following the city selection process and enabling deeper geographic targeting for shipping and service delivery.
Request Body
curl --location 'https://rajaongkir.komerce.id/api/v1/destination/district/575' \
--header 'Key: YOUR_API_KEY'
Response
{
"meta": {
"message": "Success Get District By City ID",
"code": 200,
"status": "success"
},
"data": [
{
"id": 1360,
"name": "JAKARTA SELATAN",
"zip_code": "0"
},
{
"id": 1361,
"name": "JAGAKARSA",
"zip_code": "12630"
},
{
"id": 1362,
"name": "KEBAYORAN BARU",
"zip_code": "12150"
},
{
"id": 1363,
"name": "KEBAYORAN LAMA",
"zip_code": "12230"
},
{
"id": 1364,
"name": "MAMPANG PRAPATAN",
"zip_code": "12730"
},
{
"id": 1365,
"name": "PANCORAN",
"zip_code": "12770"
},
{
"id": 1366,
"name": "PASAR MINGGU",
"zip_code": "12560"
},
{
"id": 1367,
"name": "PESANGGRAHAN",
"zip_code": "12330"
},
{
"id": 1368,
"name": "SETIA BUDI",
"zip_code": "12980"
},
{
"id": 1369,
"name": "TEBET",
"zip_code": "12840"
},
{
"id": 1370,
"name": "CILANDAK",
"zip_code": "12430"
}
]
}