Peta Kuesus

API Docs

Peta Kuesus API

Indonesian administrative region data, search, boundaries, and spatial queries for provinces, regencies, districts, and villages.

Which endpoint should I use?

NeedUse
Browse hierarchyRegion Data endpoints: provinces, regencies, districts, and villages.
Autocomplete form inputAutocomplete endpoint: /autocomplete.
Search by name, code, or postal codeSearch endpoint: /search.
Embed a form pickerWidget script: /embed/region-picker.js.
Get one regionRegion detail endpoint: /regions/{code}.
Get children or ancestorsRegion relationship endpoints: /regions/{code}/children and /regions/{code}/ancestors.
Get boundary GeoJSONBoundary endpoint: /regions/{code}/boundary.
Export selected boundariesBatch boundary endpoint: /boundaries returns a GeoJSON FeatureCollection.
Reverse lookup or containmentSpatial endpoints: /spatial/reverse and /spatial/contains.

Hierarchy endpoints

GET

Metadata

Dataset metadata, source references, region counts, and boundary coverage notes.

https://peta.kues.us/api/v1/meta.json
{
  "name": "Peta Kuesus API",
  "counts": { "province": 38, "regency": 514, "district": 7285, "village": 83762 },
  "boundaries": { "included": true, "required": false }
}
GET

Provinces

All Indonesian provinces.

https://peta.kues.us/api/v1/provinces.json
[
  { "code": "33", "name": "Jawa Tengah", "boundary": { "available": true } }
]
GET

Regencies by province

Regencies and cities under one province code.

https://peta.kues.us/api/v1/regencies/by-province/33.json
[
  { "code": "33.75", "province_code": "33", "name": "Kota Pekalongan", "boundary": { "available": true } }
]
GET

Districts by regency

Districts under one regency or city. Path parameters use compact codes without dots.

https://peta.kues.us/api/v1/districts/by-regency/3375.json
[
  { "code": "33.75.03", "regency_code": "33.75", "province_code": "33", "name": "Pekalongan Barat" }
]
GET

Villages by district

Villages under one district. Path parameters use compact codes without dots.

https://peta.kues.us/api/v1/villages/by-district/337503.json
[
  { "code": "33.75.03.1001", "district_code": "33.75.03", "name": "Medono", "postal_code": "51111" }
]
GET

Advanced region search shard

Advanced/offline region data helper grouped by province. Most clients should use /search instead.

https://peta.kues.us/api/v1/search/villages-by-province/33.json
[
  { "code": "33.75.03.1001", "name": "Medono", "search": "3375031001 medono", "province_code": "33" }
]

Autocomplete and search endpoints

GET

Autocomplete

Compact Indonesian region autocomplete for forms, checkout pages, CRM apps, and postal-code autofill.

https://api.peta.kues.us/autocomplete?q=banyumudal&limit=10
{
  "data": [
    {
      "label": "Banyumudal, Moga, Pemalang, Jawa Tengah",
      "level": "village",
      "code": "33.27.07.2006",
      "name": "Banyumudal",
      "postal_code": "52354",
      "components": {
        "province": { "code": "33", "name": "Jawa Tengah" },
        "regency": { "code": "33.27", "name": "Kabupaten Pemalang" },
        "district": { "code": "33.27.07", "name": "Moga" },
        "village": { "code": "33.27.07.2006", "name": "Banyumudal" }
      },
      "boundary": { "available": true }
    }
  ],
  "meta": { "query": "banyumudal", "limit": 10, "count": 1 }
}
GET

Search

Search regions by name, code, compact code, and postal-code signals.

https://api.peta.kues.us/search?q=air+nusa&limit=20
{
  "data": [
    {
      "level": "village",
      "code": "21.03.19.2002",
      "name": "Air Nusa",
      "parent_path": "Kepulauan Riau / Natuna / Serasan Timur",
      "postal_code": "29780",
      "boundary": { "available": true }
    }
  ],
  "meta": { "query": "air nusa", "limit": 20, "count": 1 }
}

Details and relationships

GET

Region detail

Return one normalized region by dotted or compact code.

https://api.peta.kues.us/regions/21.03.19.2002
{
  "data": {
    "level": "village",
    "code": "21.03.19.2002",
    "code_plain": "2103192002",
    "name": "Air Nusa",
    "parent_path": "Kepulauan Riau / Natuna / Serasan Timur",
    "province_code": "21",
    "regency_code": "21.03",
    "district_code": "21.03.19",
    "postal_code": "29780",
    "boundary": { "available": true },
    "bbox": [109.0, 2.0, 109.2, 2.2]
  }
}
GET

Region children

List direct child regions below a province, regency, or district.

https://api.peta.kues.us/regions/21.03/children?limit=100&offset=0
{
  "data": [
    { "level": "district", "code": "21.03.19", "name": "Serasan Timur", "parent_path": "Kepulauan Riau / Natuna" }
  ],
  "meta": { "limit": 100, "offset": 0, "count": 1 }
}
GET

Region ancestors

Return the ancestor chain for a region.

https://api.peta.kues.us/regions/21.03.19.2002/ancestors
{
  "data": [
    { "level": "province", "code": "21", "name": "Kepulauan Riau" },
    { "level": "regency", "code": "21.03", "name": "Natuna" },
    { "level": "district", "code": "21.03.19", "name": "Serasan Timur" }
  ]
}

Boundary GeoJSON

GET

Region boundary

Return a GeoJSON Feature for one selected region when boundary data is available.

https://api.peta.kues.us/regions/21.03.19.2002/boundary?simplify=true&tolerance=0.001
GeoJSON Feature response.
Coordinates are omitted from this example to avoid sample or placeholder geometry.
POST

Selected boundary export

Return a GeoJSON FeatureCollection for selected regions. Parent regions export exactly by default.

https://api.peta.kues.us/boundaries
{
  "codes": ["21.03.19.2002", "33.27"],
  "scope": "selected",
  "simplify": false
}
POST

Expanded boundary export

Explicitly expand parent regions to regency/city, district, or village boundaries. Village expansion can be large.

https://api.peta.kues.us/boundaries
{
  "codes": ["33.27"],
  "scope": "districts",
  "simplify": false
}

Point lookup and containment

GET

Reverse spatial lookup

Find regions whose available boundaries contain a latitude/longitude point.

https://api.peta.kues.us/spatial/reverse?lat=2.0&lng=109.1
{
  "data": {
    "point": { "lat": 2.0, "lng": 109.1 },
    "matches": [
      { "level": "village", "code": "21.03.19.2002", "name": "Air Nusa" }
    ]
  }
}
GET

Point containment

Check whether a specific region boundary contains a latitude/longitude point.

https://api.peta.kues.us/spatial/contains?code=21.03.19.2002&lat=2.0&lng=109.1
{
  "data": {
    "contains": true,
    "region": { "level": "village", "code": "21.03.19.2002", "name": "Air Nusa" }
  }
}

Sumber data

Data wilayah dari cahyadsn/wilayah, kode pos dari cahyadsn/wilayah_kodepos, dan boundary tersedia dari cahyadsn/wilayah_boundaries jika cakupan datanya ada.

Embed a region picker in your form

Drop-in picker

Autocomplete Indonesian provinces, regencies, districts, villages, and postal codes from a plain HTML form. The widget calls /autocomplete and emits peta-kuesus:select when a user selects a region.

<script src="https://peta.kues.us/embed/region-picker.js"></script>

<div
  data-peta-kuesus-picker
  data-placeholder="Cari wilayah..."
  data-postal-code="true"
></div>
document.addEventListener('peta-kuesus:select', (event) => {
  console.log(event.detail);
});

For local HTML testing, prefer a local static server instead of opening the file with file://.

python3 -m http.server 8080

/autocomplete is public by design for embedded forms: it uses no credentials, returns public region data only, and remains rate-limited. Other API endpoints keep stricter cross-origin rules.

Client snippets

Autocomplete

const apiUrl = 'https://api.peta.kues.us';
const params = new URLSearchParams({ q: 'moga pemalang', limit: '10' });

const suggestions = await fetch(`${apiUrl}/autocomplete?${params}`).then((res) => res.json());

Region data

const baseUrl = 'https://peta.kues.us/api/v1';

const provinces = await fetch(`${baseUrl}/provinces.json`).then((res) => res.json());
const regencies = await fetch(`${baseUrl}/regencies/by-province/33.json`).then((res) =>
  res.json()
);

Search

const apiUrl = 'https://api.peta.kues.us';
const params = new URLSearchParams({ q: 'air nusa', limit: '5' });

const results = await fetch(`${apiUrl}/search?${params}`).then((res) => res.json());

Region details

const apiUrl = 'https://api.peta.kues.us';

const region = await fetch(`${apiUrl}/regions/21.03.19.2002`).then((res) => res.json());
const ancestors = await fetch(`${apiUrl}/regions/21.03.19.2002/ancestors`).then((res) =>
  res.json()
);

Boundary export

const apiUrl = 'https://api.peta.kues.us';

const collection = await fetch(`${apiUrl}/boundaries`, {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    codes: ['21.03.19.2002', '33.27'],
    scope: 'selected',
    simplify: false
  })
}).then((res) => res.json());

Client artifacts

OpenAPI JSON

/downloads/peta-kuesus-api.openapi.json

Region Data OpenAPI JSON

/api/v1/openapi.json

Postman collection

/downloads/peta-kuesus-api.postman_collection.json