Indonesia Regional API

API lengkap untuk data wilayah administratif Indonesia, meliputi 38 provinsi, kota/kabupaten, kecamatan, dan desa/kelurahan.

API Endpoints

  • /api/provinces - Get all provinces
  • /api/cities/{provinceId} - Get cities by province ID
  • /api/districts/{cityId} - Get districts by city ID
  • /api/villages/{districtId} - Get villages by district ID

Usage Examples

Fetch API Example
Using the native Fetch API
// Get all provinces
fetch('/api/provinces')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

// Get cities by province ID
fetch('/api/cities/11')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

// Get districts by city ID
fetch('/api/districts/1101')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

// Get villages by district ID
fetch('/api/villages/1101010')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));