Logo Wilayah Indonesia

Wilayah Indonesia

Cộng đồng
emsifa
wilayah-indonesia

Schemas for Indonesian administrative data — API responses and downloadable files for app integration

Tổng quan

Nhà phát hànhemsifa
Kho mãapi-wilayah-indonesia
Tên kỹ năngwilayah-indonesia
Sao
755
Bản fork
1.4K
Tệp đi kèm
53
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 53 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được emsifa công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Wilayah Indonesia trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/emsifa/api-wilayah-indonesia/tree/master
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/emsifa/api-wilayah-indonesia.git \
  .claude/skills/wilayah-indonesia
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Wilayah Indonesia trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Wilayah Indonesia ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Wilayah Indonesia với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

SKILL — Wilayah Indonesia

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.

1. Which Source Should You Use?

  • Static API: Best for MVPs, frontend-only apps, or edge functions. No database needed — just fetch JSON. Includes polygons for maps. Data is cached on CDN.
  • Download: Best when you need offline validation, foreign keys, or complex queries (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?”

2. API — What You Get

Base URL: https://www.emsifa.com/api-wilayah-indonesia/v2

Every response has the same wrapper:

json
{
  "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/postal

2.1 What you get for provinces & regencies (detailed)

For provinces.json, provinces/{code}.json, regencies/{province}.json, regencies/{regency}.json you receive rich objects:

json
{
  "id": "32",
  "name": "Jawa Barat",
  "capital": "Bandung",
  "lat": -6.90,
  "lng": 107.61,
  "elv": 739,
  "tz": 7,
  "population": 51316378,
  "total_area": 37053.33,
  "has_path": true,
  "province": { "id": "32", "name": "Jawa Barat" },
  "regency": { "id": "32.73", "name": "Kota Bandung" }
}
  • You'll always get id, name, and has_path (boolean, true if /paths/{id}.json exists). For provinces and regencies you also get capital, lat, lng (for map marker), elv, tz, population, total_area.
  • has_path is always present (true/false) — check it before fetching /paths/{id}.json to avoid 404.
  • Detail endpoints also include their parent: a regency includes province, a district includes province + regency, a village includes all three.

2.2 What you get for districts & villages (lists)

For lists, you get a compact form to keep files small:

json
// districts/{regency}.json
{ "id": "32.73.01", "name": "Sukasari", "lat": -6.87, "lng": 107.59, "has_path": true }

// villages/{district}.json
{ "id": "32.73.01.1001", "name": "Sukarasa", "postal_code": "40152", "lat": -6.87, "lng": 107.59, "has_path": true }
  • District lists have id, name, lat, lng, and has_path (compact but with coordinates).
  • Village lists add postal_code + has_path so you can filter by postal code and know if polygon is available without a separate lookup.
  • Detail endpoints (districts/{code}.json, villages/{code}.json) also include has_path alongside lat/lng and parent objects.

2.3 All endpoints

PathWhat it returns
/stats.jsonTotals for all levels
/provinces.jsonAll provinces (detailed)
/provinces/{code}.jsonOne province, e.g. 32
/regencies/{province_code}.jsonRegencies in that province
/regencies/{regency_code}.jsonOne regency + its province
/districts/{regency_code}.jsonDistricts in that regency (compact) + has_path
/districts/{district_code}.jsonOne district + its province/regency + has_path
/villages/{district_code}.jsonVillages in that district + postal_code + has_path
/villages/{village_code}.jsonOne village + postal_code + all parents + has_path
/postal-codes/{postal_code}.jsonAll villages that use that postal code
/paths/{code}.jsonBoundary polygon for any level (fetch only if has_path=true)
/missings.jsonWilayah dimana has_path==false OR has_latlng==false (flat {id,name,has_path,has_latlng} + summary by_level)

2.4 Totals (stats)

json
{
  "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,
  "total_endpoints": 201309,
  "total_filesize": 300423246,
  "total_filesize_human": "286.51 MB",
  "total_disk_usage": 915771392,
  "total_disk_usage_human": "873.35 MB"
}

2.5 Boundaries (polygons)

json
{
  "data": {
    "id": "32",
    "name": "Jawa Barat",
    "path": [[[ -6.98, 106.39 ], [-6.93, 106.39 ]], [[ ... ]]]
  }
}
  • Polygons are available for all levels when has_path=true — check has_path on any provinces/regencies/districts/villages response before fetching /paths/{id}.json. Some have one ring (single island), others have many (e.g., Jakarta 2 rings, Aceh 28, Papua Barat 1455). Your map code should handle both: if the first element is a point [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.

2.6 Missings (incomplete data)

json
// GET /missings.json
{
  "data": [
    { "id": "53.09.14.2011", "name": "Watu Pangan", "has_path": false, "has_latlng": false },
    { "id": "32.73.01.1005", "name": "Sukajadi", "has_path": false, "has_latlng": true }
  ],
  "meta": { "updated_at": "2026-09-03", "level": 0 },
  "summary": {
    "total_missing": 360,
    "total_missing_path": 320,
    "total_missing_latlng": 40,
    "total_missing_both": 12,
    "by_level": { "province": 0, "regency": 0, "district": 0, "village": 360 }
  }
}
  • has_path: true if /paths/{id}.json exists, else false.
  • has_latlng: true if lat and lng present and not 0/null/undefined, else false.
  • List is flat across all levels; entry appears if has_path==false OR has_latlng==false.
  • summary.by_level counts per level (province=0 dots, regency=1, district=2, village=3).

3. Downloaded Files — What You Get

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.

3.1 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 name

The json version has the same rows as an array of {kode, nama}.

3.2 Rich data for provinces & regencies

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 endpoint

3.3 Postal code mapping

kode,kodepos
32.73.01.1001,40152
  • kode: village id
  • kodepos: postal code used to build postal-codes/{code}.json. One postal code can map to many villages.

3.4 What each download format gives you

  • 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.

4. How IDs and Relationships Work

  • The 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.
  • Hierarchy is always province → regency → district → village.
  • postal_code lives on the village. Use postal-codes/{code}.json to find all villages sharing a code.

5. How to Use (for the AI)

  • If the user wants to fetch: call the endpoints in Section 2 in order provinces → regencies/{prov} → districts/{reg} → villages/{dist}. Always use the real kode from the previous response, never guess. Check has_path before fetching /paths/{id}.json.
  • If the user wants to self-host: suggest npx wilayah download --format <...> and point to the columns above. Let the user choose the format that fits their database.
  • For maps, all levels have lat/lng and may have polygons when has_path=true — check the flag first.
  • To monitor coverage: fetch /missings.json — each entry {id,name,has_path,has_latlng} appears if !has_path || !has_latlng; use summary to see totals by level.

References

  • Live API: https://www.emsifa.com/api-wilayah-indonesia/v2
  • Spec: openapi.yml and wilayah-postman.json at the same base URL
  • Stats: api/stats.json, api/provinces.json

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Wilayah Indonesia làm được gì?

Schemas for Indonesian administrative data — API responses and downloadable files for app integration

Vì sao nên dùng Wilayah Indonesia trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Wilayah Indonesia là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Wilayah Indonesia trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/emsifa/api-wilayah-indonesia/tree/master. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Wilayah Indonesia?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Wilayah Indonesia với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Wilayah Indonesia với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Wilayah Indonesia có miễn phí không?

Kỹ năng này được emsifa phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇