# Kodepos API

> Returns Indonesian postal codes matched by village, district, city or province, and the areas sharing a postal code.

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

Postal codes whose village, district, city or province matches a name.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes | Village, district, city or province name, such as Menteng, or a postal code. (e.g. Menteng) |
| `limit` | integer | no | Items per page, 1 to 100. (default 20) |
| `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: `city` (string), `district` (string), `postalCode` (string), `province` (string), `village` (string)

```bash
curl "https://api.hoshime.com/v1/kodepos/search?query=Menteng" -H "Authorization: Bearer $HOSHIME_TOKEN"
```

## GET /v1/kodepos/postalCode

The villages, districts and cities that share one five-digit postal code.

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

| Parameter | Type | Required | Description |
|---|---|---|---|
| `code` | string | yes | Five-digit postal code, such as 10310. (e.g. 10310) |
| `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: `city` (string), `district` (string), `postalCode` (string), `province` (string), `village` (string)

```bash
curl "https://api.hoshime.com/v1/kodepos/postalCode?code=10310" -H "Authorization: Bearer $HOSHIME_TOKEN"
```
