Indonesia Region API

A free, static JSON API of Indonesia's administrative regions: provinces, regencies/cities, districts and villages. No API key, no rate limits, and any website can call it (CORS enabled).

38provinces
514regencies / cities
7,285districts
83,762villages

Endpoints

All endpoints are GET requests for static files under https://your-site.pages.dev/api/.

EndpointReturnsExample
/api/provinces.jsonAll provincesprovinces.json
/api/regencies/{provinceCode}.jsonRegencies and cities in a provinceregencies/11.json
/api/districts/{regencyCode}.jsonDistricts in a regency or citydistricts/11.01.json
/api/villages/{districtCode}.jsonVillages in a districtvillages/11.01.01.json

Response format

Every endpoint returns a JSON array of { code, name } objects, sorted by code.

[
  { "code": "11.01", "name": "Kabupaten Aceh Selatan" },
  { "code": "11.02", "name": "Kabupaten Aceh Tenggara" }
]

Region codes

Codes follow the official Kemendagri format. Each level adds a dot-separated segment to its parent's code, so a region's parent can always be read from its own code.

LevelFormatExample
ProvincePP11 Aceh
Regency / cityPP.RR11.01 Kabupaten Aceh Selatan
DistrictPP.RR.DD11.01.01 Bakongan
VillagePP.RR.DD.VVVV11.01.01.2001 Keude Bakongan

Errors

A code that does not exist returns HTTP 404. Always check response.ok before parsing the body.

Calling from the browser (CORS)

Every /api/* response includes these headers, so JavaScript on any website can call the API directly with fetch: from your own domain, another domain, or localhost during development. No proxy or backend is needed.

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, HEAD

To keep requests working from the browser:

Examples

JavaScript

const BASE = "https://your-site.pages.dev/api";

async function getRegions(path) {
  const res = await fetch(`${BASE}/${path}.json`);
  if (!res.ok) throw new Error(`Region not found: ${path}`);
  return res.json();
}

const provinces = await getRegions("provinces");
const regencies = await getRegions(`regencies/${provinces[0].code}`);

curl

curl https://your-site.pages.dev/api/districts/11.01.json

Try it

Each selection fetches the next level from this API.