# Wilayah Indonesia API

> Returns Indonesian provinces, regencies, districts and villages with their administrative codes.

Category: Government & Open Data. Region: ID. 5 endpoints at `https://api.hoshime.com/v1/wilayah/<endpoint>`, `GET` with query parameters, answering `{data, meta}` (see https://hoshime.com/docs/responses.md). Reference: https://hoshime.com/docs/platforms/wilayah
## GET /v1/wilayah/provinces

All Indonesian provinces with their codes.

Scope: `social:read` · Units: 1 · Cached: 1440 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `id` (string), `name` (string), `parentId` (string)

```bash
curl "https://api.hoshime.com/v1/wilayah/provinces" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wilayah/regencies

The regencies and cities of one province.

Scope: `social:read` · Units: 1 · Cached: 1440 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `province` | string | yes | Province code, such as 31 for DKI Jakarta. (e.g. 31) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `id` (string), `name` (string), `parentId` (string)

```bash
curl "https://api.hoshime.com/v1/wilayah/regencies?province=31" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wilayah/districts

The districts (kecamatan) of one regency or city.

Scope: `social:read` · Units: 1 · Cached: 1440 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `regency` | string | yes | Regency or city code, such as 3171 for South Jakarta. (e.g. 3171) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `id` (string), `name` (string), `parentId` (string)

```bash
curl "https://api.hoshime.com/v1/wilayah/districts?regency=3171" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wilayah/villages

The villages (kelurahan or desa) of one district.

Scope: `social:read` · Units: 1 · Cached: 1440 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `district` | string | yes | District code, such as 3171010 for Jagakarsa. (e.g. 3171010) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `id` (string), `name` (string), `parentId` (string)

```bash
curl "https://api.hoshime.com/v1/wilayah/villages?district=3171010" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/wilayah/region

One region by its administrative code, such as 3171010, with the regions above it: its province, regency, district and village names.

Scope: `social:read` · Units: 1 · Cached: 1440 min · Paginated: cursor

| Parameter | Type | Required | Description |
|---|---|---|---|
| `code` | string | yes | Administrative code: 2 digits for a province, 4 for a regency or city, 7 for a district, 10 for a village. (e.g. 3171010) |
| `tunnel` | string | no | Id or name of one of your tunnels: the call reads the source from the machine that runs `hoshime tunnel`, through its own connection. Fails with 409 tunnel_unavailable when no machine is connected. Cannot be combined with proxy. |
| `proxy` | string | no | Your own http:// or https:// proxy, such as http://user:pass@proxy.example.com:8080, on a public address. The call reads the source only through it. |
| `profileId` | string | no | Browser profile whose login the call sends (its cookies), so the source answers as that account. Without tunnel or proxy it leaves through the profile's own residential IP. Needs the browser:read scope. Data read logged in is for your account only. |

Response data fields: `id` (string), `name` (string), `parentId` (string)

```bash
curl "https://api.hoshime.com/v1/wilayah/region?code=3171010" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
