claude-handoff
MAmattpocock/skills337k近 7 天新增 4,978 个 star
Schemas for Indonesian administrative data — API responses and downloadable files for app integration
Use this skill when a developer wants to integrate Indonesian administrative data (provinces, regencies/cities, districts, villages, postal codes, boundaries) into their app. Data is available in two interchangeable ways: Static API (https://www.emsifa.com/api-wilayah-indonesia/v2) and Downloaded files (npx wilayah download --format csv|sql|json). This file only describes what you will receive — columns, keys, and response shapes — so you can build for any stack.
fetch JSON. Includes polygons for maps. Data is cached on CDN.WHERE postal_code = ?). You get the full dataset to self-host in your own database or static hosting.Ask the user: “Do you want to fetch from the API or self-host the data?”
Base URL: https://www.emsifa.com/api-wilayah-indonesia/v2
Every response has the same wrapper:
{
"data": <object or array>,
"meta": {
"generated_at": "2026-09-02T03:35:49Z",
"level": 1
}
}
data: the actual payload (see below)meta.generated_at: when the file was generated (RFC3339)meta.level: depth 0=stats, 1=province, 2=regency, 3=district, 4=village/postalFor provinces.json, provinces/{code}.json, regencies/{province}.json, regencies/{regency}.json you receive rich objects:
{
"id": "32",
"name": "Jawa Barat",
"capital": "Bandung",
"lat": -6.90,
"lng": 107.61,
"elv": 739,
"tz": 7,
"population": 51316378,
"total_area": 37053.33,
"province": { "id": "32", "name": "Jawa Barat" },
"regency": { "id": "32.73", "name": "Kota Bandung" }
}
id and name. For provinces and regencies you also get capital, lat, lng (for map marker), elv, tz, population, total_area.province, a district includes province + regency, a village includes all three.For lists, you get a compact form to keep files small:
// districts/{regency}.json
{ "id": "32.73.01", "name": "Sukasari" }
// villages/{district}.json
{ "id": "32.73.01.1001", "name": "Sukarasa", "postal_code": "40152" }
id and name (no coordinates or polygon here).postal_code so you can filter by postal code without a separate lookup.| Path | What it returns |
|---|---|
/stats.json | Totals for all levels |
/provinces.json | All provinces (detailed) |
/provinces/{code}.json | One province, e.g. 32 |
/regencies/{province_code}.json | Regencies in that province |
/regencies/{regency_code}.json | One regency + its province |
/districts/{regency_code}.json | Districts in that regency (compact) |
/districts/{district_code}.json | One district + its province/regency |
/villages/{district_code}.json | Villages in that district + postal_code |
/villages/{village_code}.json | One village + postal_code + all parents |
/postal-codes/{postal_code}.json | All villages that use that postal code |
/paths/{province_or_regency_code}.json | Boundary polygon for a province/regency |
{
"total_provinces": 38,
"total_regencies": 514,
"total_districts": 7285,
"total_villages": 83762,
"total_postal_codes": 10632,
"total_paths": 551,
"total_population": 284973643,
"total_area": 1889518.25
}
{
"data": {
"id": "32",
"name": "Jawa Barat",
"path": [[[ -6.98, 106.39 ], [-6.93, 106.39 ]], [[ ... ]]]
}
}
[lat,lng] it's a single polygon, if it's an array of points it's already a list of rings — collect all rings that have more than 2 points.Run npx wilayah download --format <csv|sql|json> --output ./wilayah.<ext> to get the full dataset to host yourself. You can also get the same shapes via the API, but as static files you control.
wilayah.csv / wilayah.json (full hierarchy)Every row is one administrative area:
kode,nama
11,Aceh
11.01,Kabupaten Aceh Selatan
11.01.01,Bakongan
11.01.01.2001,Keude Bakongan
kode: the ID. Count the dots to know the level: no dot = province (2 chars, e.g. 11), one dot = regency (5 chars, 11.01), two dots = district (8 chars, 11.01.01), three dots = village (13 chars, 11.01.01.2001)nama: the display nameThe json version has the same rows as an array of {kode, nama}.
When you need coordinates, capital, population, area, or polygon, use the level 1/2 data. In the download this is available as extra columns (for sql/json) or as the API rich objects:
kode,nama,ibukota,lat,lng,elv,tz,luas,penduduk,path
11,Aceh,Banda Aceh,5.57,95.34,11,7,56835.019,5623479,"[[[2.07,97.07],...]]"
ibukota = capital, luas = total_area, penduduk = population, path = same polygon as /paths endpointkode,kodepos
32.73.01.1001,40152
kode: village idkodepos: postal code used to build postal-codes/{code}.json. One postal code can map to many villages.wilayah.json / api/*.json: same structures as Section 2 — ready to serve as static files.wilayah.sql: INSERT statements with columns kode, nama, capital, lat, lng, elv, tz, total_area, population, postal_code — import into MySQL/Postgres.wilayah.csv: merged table with kode,nama,postal_code plus rich columns for provinces/regencies.kode / id is the primary key. Split by . to get the parent: 32.73.01.1001 → province 32, regency 32.73, district 32.73.01.province → regency → district → village.postal_code lives on the village. Use postal-codes/{code}.json to find all villages sharing a code.provinces → regencies/{prov} → districts/{reg} → villages/{dist}. Always use the real kode from the previous response, never guess.npx wilayah download --format <...> and point to the columns above. Let the user choose the format that fits their database.https://www.emsifa.com/api-wilayah-indonesia/v2openapi.yml and wilayah-postman.json at the same base URLapi/stats.json, api/provinces.jsonMAmattpocock/skills337k近 7 天新增 4,978 个 star
MAmattpocock/skills337k近 7 天新增 4,978 个 star
AFaffaan-m/ECC315k近 7 天新增 4,381 个 star
AFaffaan-m/ECC315k近 7 天新增 4,381 个 star
AFaffaan-m/ECC315k近 7 天新增 4,381 个 star
DIDietrichGebert/ponytail203k近 7 天新增 4,904 个 star