PHPackages                             basoro/api-wilayah - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. basoro/api-wilayah

ActiveProject[API Development](/categories/api)

basoro/api-wilayah
==================

Public API Wilayah Indonesia

1.0(1y ago)010MITHTML

Since Apr 23Pushed 1y agoCompare

[ Source](https://github.com/basoro/api-wilayah-indonesia)[ Packagist](https://packagist.org/packages/basoro/api-wilayah)[ RSS](/packages/basoro-api-wilayah/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

API Data Wilayah Indonesia
==========================

[](#api-data-wilayah-indonesia)

Repository ini berisi source code untuk generate (REST) API statis berisi data wilayah Indonesia serta perintah untuk mendeploynya ke *static hosting* [Github Page](https://pages.github.com/).

Demo:

#### Apa yang dimaksud API statis?

[](#apa-yang-dimaksud-api-statis)

API statis adalah API yang *endpoint*-nya terdiri dari file statis.

#### Keuntungan API statis?

[](#keuntungan-api-statis)

- Dapat dihosting pada *static file hosting* seperti Github Page, Netlify, dsb.
- Proses lebih cepat karena tidak membutuhkan server-side scripting.

#### Bagaimana cara kerjanya?

[](#bagaimana-cara-kerjanya)

- Daftar provinsi, kab/kota, kecamatan, kelurahan/desa disimpan pada folder `data` berupa file `csv` (agar mudah diedit).
- Kemudian script `generate.php` dijalankan. Script ini akan membaca file `csv` didalam folder `data`, kemudian men-generate ribuan endpoint (file) kedalam folder `static/api`.
- API siap 'dihidangkan'.

#### Saya mau hosting di Github saya sendiri, bagaimana caranya?

[](#saya-mau-hosting-di-github-saya-sendiri-bagaimana-caranya)

- Klik fork di pojok kanan atas.
- Pada halaman forking, **HAPUS CENTANG** "Copy the master branch only".
- Klik "Create Fork".
- Setelah selesai di Fork, klik Settings (bukan setting account, tapi setting repository).
- Klik menu "Pages" untuk masuk ke menu pengaturan GitHub Pages.
- Pada menu pengaturan GitHub Pages:
    - Pilih Source: Deploy from a Branch
    - Branch: `gh-pages`
    - Direktori: `/root`
    - Klik Save
- Tunggu beberapa menit (5-10 menitan), kembali ke halaman home repository ().
- Kalau halaman sudah terdeploy, di bagian kanan halaman, akan muncul informasi "Environments". Kalau belum tunggu lagi beberapa menit, lalu refresh.
- Kalau sudah muncul informasi Environmentsnya, klik bagian "🚀 github-pages".
- Di halaman Deployments, klik "View Deployment" untuk melihat halaman yang berhasil terdeploy.

ENDPOINTS
---------

[](#endpoints)

#### 1. Mengambil Daftar Provinsi

[](#1-mengambil-daftar-provinsi)

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/provinces.json

```

Contoh Response:

```
[
  {
    "id": "11",
    "name": "ACEH"
  },
  {
    "id": "12",
    "name": "SUMATERA UTARA"
  },
  ...
]

```

#### 2. Mengambil Daftar Kab/Kota pada Provinsi Tertentu

[](#2-mengambil-daftar-kabkota-pada-provinsi-tertentu)

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/regencies/{provinceId}.json

```

Contoh untuk mengambil daftar kab/kota di provinsi Aceh (ID = 11):

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/regencies/11.json

```

Contoh Response:

```
[
  {
    "id": "1101",
    "province_id": "11",
    "name": "KABUPATEN SIMEULUE"
  },
  {
    "id": "1102",
    "province_id": "11",
    "name": "KABUPATEN ACEH SINGKIL"
  },
  ...
]

```

#### 3. Mengambil Daftar Kecamatan pada Kab/Kota Tertentu

[](#3-mengambil-daftar-kecamatan-pada-kabkota-tertentu)

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/districts/{regencyId}.json

```

Contoh untuk mengambil daftar kecamatan di Aceh Selatan (ID = 1103):

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/districts/1103.json

```

Contoh Response:

```
[
  {
    "id": "1103010",
    "regency_id": "1103",
    "name": "TRUMON"
  },
  {
    "id": "1103011",
    "regency_id": "1103",
    "name": "TRUMON TIMUR"
  },
  ...
]

```

#### 4. Mengambil Daftar Kelurahan pada Kecamatan Tertentu

[](#4-mengambil-daftar-kelurahan-pada-kecamatan-tertentu)

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/villages/{districtId}.json

```

Contoh untuk mengambil daftar kelurahan di Trumon (ID = 1103010):

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/villages/1103010.json

```

Contoh Response:

```
[
  {
    "id": "1103010001",
    "district_id": "1103010",
    "name": "KUTA PADANG"
  },
  {
    "id": "1103010002",
    "district_id": "1103010",
    "name": "RAKET"
  },
  ...
]

```

#### 5. Mengambil Data Provinsi berdasarkan ID Provinsi

[](#5-mengambil-data-provinsi-berdasarkan-id-provinsi)

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/province/{provinceId}.json

```

Contoh untuk mengambil data provinsi Aceh (ID = 11):

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/province/11.json

```

Contoh Response:

```
{
  "id": "11",
  "name": "ACEH"
}

```

#### 6. Mengambil Data Kab/Kota berdasarkan ID Kab/Kota

[](#6-mengambil-data-kabkota-berdasarkan-id-kabkota)

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/regency/{regencyId}.json

```

Contoh untuk mengambil data kabupaten Aceh Selatan (ID = 1103):

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/regency/1103.json

```

Contoh Response:

```
{
  "id": "1103",
  "province_id": "11",
  "name": "KABUPATEN ACEH SELATAN"
}

```

#### 7. Mengambil Data Kecamatan berdasarkan ID Kecamatan

[](#7-mengambil-data-kecamatan-berdasarkan-id-kecamatan)

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/district/{districtId}.json

```

Contoh untuk mengambil data kecamatan Trumon Timur (ID = 1103011):

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/district/1103011.json

```

Contoh Response:

```
{
  "id": "1103011",
  "regency_id": "1103",
  "name": "TRUMON TIMUR"
}

```

#### 8. Mengambil Data Kelurahan berdasarkan ID Kelurahan

[](#8-mengambil-data-kelurahan-berdasarkan-id-kelurahan)

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/village/{villageId}.json

```

Contoh untuk mengambil data kelurahan Jambo Dalem (ID = 1103011010):

```
GET https://emsifa.github.io/api-wilayah-indonesia/api/village/1103011010.json

```

Contoh Response:

```
{
  "id": "1103011010",
  "district_id": "1103011",
  "name": "JAMBO DALEM"
}

```

LIMITASI
--------

[](#limitasi)

Karena API ini dihosting di Github Page, Github Page sendiri memberikan batasan bandwith 100GB/bulan. Rata-rata endpoint disini memiliki ukuran 1KB/endpoint, jadi kurang lebih request yang dapat digunakan adalah 100.000.000 request per bulan, atau sekitar 3.000.000 request/hari.

Karena limitasi ini, disarankan untuk hosting API ini di github kamu sendiri.

Untuk lebih detail tentang limitasi Github Page, bisa dilihat [disini](https://help.github.com/en/articles/about-github-pages#usage-limits).

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

649d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/286fcba079ac152bdd7e3c78773e36dfa47e286fb33e76c8d5c958c7deecbacd?d=identicon)[basoro](/maintainers/basoro)

---

Top Contributors

[![emsifa](https://avatars.githubusercontent.com/u/6297931?v=4)](https://github.com/emsifa "emsifa (16 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![basoro](https://avatars.githubusercontent.com/u/14934712?v=4)](https://github.com/basoro "basoro (1 commits)")

### Embed Badge

![Health badge](/badges/basoro-api-wilayah/health.svg)

```
[![Health](https://phpackages.com/badges/basoro-api-wilayah/health.svg)](https://phpackages.com/packages/basoro-api-wilayah)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
