Search City
https://rajaongkir.komerce.id/api/v1/destination/city/{province_id}The Search City Endpoint represents the second crucial step in the hierarchical location selection process for
RajaOngkir API. This endpoint retrieves all cities within a specific province, allowing applications to build
comprehensive cascading location selection systems. By providing the province ID obtained from the Search Province
endpoint, users can access detailed city information required for precise shipping calculations.
This endpoint is essential for applications that implement structured address selection, enabling users to narrow down
their location choice progressively. It's particularly valuable for e-commerce platforms, logistics management systems,
and shipping calculators that require accurate city-level geographic data for cost calculations and delivery planning.
Endpoint Details
- Method:
GET - Base URL:
https://rajaongkir.komerce.id/api/v1/destination/city/{province_id} - Description:
Retrieves a comprehensive list of all cities within a specified Indonesian province using the province ID. This data serves as the second level in the location hierarchy and is required to subsequently fetch districts within each selected city.
This endpoint is the second step in the Step-by-Step Method integration approach, building upon the province selection
to provide more granular location data for shipping calculations.
Request Body
curl --location 'https://rajaongkir.komerce.id/api/v1/destination/city/12' \ --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" } ] }