# 2. Get City List by Province ID

Get Cities — Retrieve the reference list of cities filtered by the selected province; returns a standard response envelope for populating area selectors.

# Overview

Auth
--
Method
GET

# Path

https://partners-api.tocobagus.net/api/v1 /partner/reference/areas/cities

# Request

# Query Parameters

Name Type Required Description
provinceId string

Required headers: None.

# Request Payload

Request payload: Not used for GET.

# Example Request

curl -X GET "http:///partner/reference/areas/cities?provinceId=%3CprovinceId%3E" \
  -H "Content-Type: application/json" \
const qs = new URLSearchParams({
  "provinceId": "<provinceId>"
});
const url = "http:///partner/reference/areas/cities" + (qs.toString() ? "?" + qs.toString() : "");
const res = await fetch(url, {
  method: "GET",
  headers: {}
});
const json = await res.json();
console.log(json);
qs := url.Values{}
qs.Set("provinceId", "<provinceId>")
u := "http:///partner/reference/areas/cities"
if q := qs.Encode(); q != "" { u = u + "?" + q }
req, _ := http.NewRequest("GET", u, nil)

req.Header.Set("Content-Type","application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
b, _ := io.ReadAll(resp.Body)
fmt.Println(string(b))
var client = java.net.http.HttpClient.newHttpClient();
var req = java.net.http.HttpRequest.newBuilder()
    .uri(java.net.URI.create("http:///partner/reference/areas/cities?provinceId=%3CprovinceId%3E"))
    .header("Content-Type","application/json")
    
    .method("GET", java.net.http.HttpRequest.BodyPublishers.noBody())
    .build();
var res = client.send(req, java.net.http.HttpResponse.BodyHandlers.ofString());
System.out.println(res.body());

# Responses

# Example Responses

{
  "success": true,
  "message": "Cities retrieved successfully",
  "data": [
    {
      "id": "24061b25-1723-4ba7-baa3-c5328c185d46",
      "name": "Kabupaten Pakpak Bharat"
    },
    {
      "id": "76245be2-f29d-4524-9af8-d0318bdb504b",
      "name": "Kota Medan"
    },
    {
      "id": "7c332924-e5ce-46fe-935e-29718b9109bf",
      "name": "Kabupaten Humbang Hasundutan"
    },
    {
      "id": "106a1b23-c2ab-451d-9e59-2dd9889f9f2d",
      "name": "Kabupaten Labuhanbatu Selatan"
    },
    {
      "id": "4780ab61-b420-43a1-b9cf-453d4fc252c6",
      "name": "Kabupaten Labuhanbatu Utara"
    },
    {
      "id": "ab45b6c4-6fa2-48c4-9a39-7970c85bd186",
      "name": "Kota Pematangsiantar"
    },
    {
      "id": "3d15b010-688e-44c4-88a5-5d1e609830bc",
      "name": "Kabupaten Batu Bara"
    },
    {
      "id": "0a875897-7a6d-4dd0-b507-889630252f80",
      "name": "Kota Tanjung Balai"
    },
    {
      "id": "bebef322-cc6e-4790-a1dd-d2b85a691f9e",
      "name": "Kabupaten Tapanuli Tengah"
    },
    {
      "id": "87a36be2-b3df-4020-a711-c1b813bda26c",
      "name": "Kota Binjai"
    },
    {
      "id": "71938e91-9eb8-434e-9001-aef42e9327bd",
      "name": "Kabupaten Dairi"
    },
    {
      "id": "c1c573f2-d928-423d-a2e1-dd40035721ff",
      "name": "Kabupaten Langkat"
    },
    {
      "id": "7939ccef-233c-4220-ae4c-846722d39329",
      "name": "Kabupaten Mandailing Natal"
    },
    {
      "id": "c6d74d9f-2e69-478d-aa72-ce0ba5991e5b",
      "name": "Kabupaten Padang Lawas Utara"
    },
    {
      "id": "feed2c42-912b-4c50-858f-3be83f8d9c7c",
      "name": "Kabupaten Asahan"
    },
    {
      "id": "3e00ea65-b53c-47c3-8a6d-d77d26349c34",
      "name": "Kabupaten Karo"
    },
    {
      "id": "9e26f5d5-d9ef-4978-a23a-fee5109e6461",
      "name": "Kabupaten Simalungun"
    },
    {
      "id": "acea22c8-1c1a-44a8-a45b-990351b438ce",
      "name": "Kabupaten Nias Utara"
    },
    {
      "id": "8d55f75c-92bf-462e-8d4f-a75c77151b5f",
      "name": "Kabupaten Nias"
    },
    {
      "id": "9c172715-86cb-4efc-aa58-84024a754f80",
      "name": "Kabupaten Nias Selatan"
    },
    {
      "id": "9dfcf7d7-f5b8-46f8-bdbb-ab6d16df49af",
      "name": "Kabupaten Tapanuli Utara"
    },
    {
      "id": "a994854b-0ef7-4acb-9b30-030d8ab2dbf3",
      "name": "Kabupaten Samosir"
    },
    {
      "id": "07bd8da9-9e81-4bd3-a596-090990b9dfed",
      "name": "Kota Gunungsitoli"
    },
    {
      "id": "87bf4776-6ba9-4674-8f3d-cb2f24d6ee95",
      "name": "Kabupaten Labuhanbatu"
    },
    {
      "id": "93d7638b-05a5-4f4e-b0ec-eeba1a34093a",
      "name": "Kabupaten Serdang Bedagai"
    },
    {
      "id": "df52ebb5-173b-4552-9519-90840db6b2cc",
      "name": "Kota Sibolga"
    },
    {
      "id": "6e6db78e-ed05-4f79-a6e3-27cb753fec48",
      "name": "Kabupaten Deli Serdang"
    },
    {
      "id": "4ca32fa8-d678-4a37-97d9-ce6054cb99a0",
      "name": "Kota Tebing Tinggi"
    },
    {
      "id": "ec4ad1c4-3d52-4cb2-8b4b-ea9f97127a80",
      "name": "Kabupaten Padang Lawas"
    },
    {
      "id": "8829af3a-55e6-4e87-9f2d-1da1901084db",
      "name": "Kabupaten Tapanuli Selatan"
    },
    {
      "id": "1fa2b39b-bf1a-4b94-aea4-acab5880a9bd",
      "name": "Kabupaten Toba Samosir"
    },
    {
      "id": "0fd38c11-065e-4876-8c9c-72e3c86436f4",
      "name": "Kota Padangsidimpuan"
    },
    {
      "id": "328321c2-eb8f-4bdd-bb24-31045de664a4",
      "name": "Kabupaten Nias Barat"
    }
  ]
}

# Dictionary

None for this endpoint.

# Notes

None for this endpoint.