---
title: "Wilayah Indonesia API"
url: "https://ridwaanhall.com/projects/wilayah-indonesia-api"
markdown: "https://ridwaanhall.com/projects/wilayah-indonesia-api.md"
summary: "A free JSON API for Indonesian administrative codes: 38 provinces, 514 regencies and cities, 7,277 districts and 83,731 villages."
---

# Wilayah Indonesia API

> A free JSON API for Indonesian administrative codes: 38 provinces, 514 regencies and cities, 7,277 districts and 83,731 villages.

- Category: web-development
- Status: Deployment Released
- Started: March 7, 2026
- Built with: FastAPI, Python, Jinja2, uv, pytest, Vercel
- Live: https://wilayah.rone.dev
- Source: https://github.com/ridwaanhall/wilayah-indonesia

## About

### The problem

Almost every Indonesian form asks for a province, regency, district and village, yet developers keep copying region lists from spreadsheets that are out of date or missing the official codes.

### The approach

Wilayah Indonesia API serves the full hierarchy from JSON data files through FastAPI, with every record carrying its parent chain, and no key needed. The landing page is a working client rather than a brochure, server-rendered with Jinja2, with one hand-written stylesheet, two small scripts and no build step.

- Four cascading pickers with type-to-filter, full keyboard support and shareable ?code= links.
- A jump-to-code box that accepts full codes or shorthand like 33/01/01/2001.
- A request log that lists every call the page makes, with status and timing.
- Analytics from GET /api/stats/{code}, and a reference generated from the registered routes so it cannot drift.

### The result

Live at wilayah.rone.dev with Swagger UI, documented error codes and hosted-API terms. It is open source under the MIT licence and covered by tests for the API, the data loader and the schema contracts.

## Features

- **Full Hierarchy**: Provinces, regencies and cities, districts and villages, each with its parent chain.
- **Working Demo Client**: An explorer, a jump-to-code box, a request log and analytics, all on the API.
- **Documented Errors**: A consistent error envelope with documented codes, and Swagger UI.
- **Contract Tests**: Tests for the API, the loader and the schema contracts.

## Tags

Django, Python, rest-api, Indonesia, administrative-data, geographical-api, regional-data, Django REST Framework, postgresql, vercel, indonesian-provinces-api, kabupaten-api, kecamatan-api, desa-kelurahan-data, bps-codes, wilayah-indonesia

## Elsewhere

- This page for people: https://ridwaanhall.com/projects/wilayah-indonesia-api
- Index of every page as Markdown: [llms.txt](https://ridwaanhall.com/llms.txt)
