# Japan Postal Code & Address Normalizer (郵便番号・住所) (`fontom.ai.plus/japan-postal-address`) Actor

Postal code ⇄ address lookup and address normalisation for Japan from Japan Post's official data (refreshed on every run). Bulk, deterministic, no scraping.

- **URL**: https://apify.com/fontom.ai.plus/japan-postal-address.md
- **Developed by:** [FONTOM AI](https://apify.com/fontom.ai.plus) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Japan Postal Code & Address Normalizer (郵便番号・住所)

Bulk **postal code → address**, **address → postal code** and **address normalisation** for Japan, built on Japan Post's official `KEN_ALL` data (124,000+ rows), **downloaded fresh on every run** (a bundled snapshot is the fallback if their site is unreachable).

- Handles `〒１００−０００１`, `100 0001`, full-width digits, kanji numerals (`大通西二十丁目`), `ー` used as a hyphen, `大字` prefixes, omitted prefectures, `ヶ/ケ` variants.
- Picks the right code when a town has several (e.g. 札幌市中央区大通西 1–19丁目 vs 20–28丁目) by reading the block number, and says so when it cannot: every address result carries a **confidence**.
- Deterministic, no scraping, no AI guessing, no API keys. Works through the Apify MCP server, so AI agents can validate addresses instead of inventing postal codes.

### Input

- `items`: postal codes and/or addresses (up to 100,000 per run).
- `mode`: `auto` (7 digits = postal code, otherwise address), `zip`, `address`, `normalize`.

### Output

Address → postal code:

```json
{ "input": "北海道札幌市中央区大通西二十丁目", "prefecture": "北海道", "city": "札幌市中央区", "town": "大通西", "block": "20丁目",
  "normalized": "北海道札幌市中央区大通西20丁目", "zip": "064-0820", "confidence": "town", "found": true }
```

`confidence`: `town` (town and block range matched one code) · `city` (only the city-level general code is known) · `ambiguous` (several codes fit: `zip` is `null`, `candidates` lists them) · `none`.

Postal code → address returns every row with that code (some codes cover several towns): prefecture, city, town, notes, JIS city code, katakana readings.

### Pricing

Pay per event: one `result` event per **found** item. Not-found items and input errors are free.

### Measured accuracy and honest limits

- Self-consistency check (Japan Post's own town names + a dummy block number, 16,580 sampled towns): 99.92% exact code, 0.08% reported as ambiguous, 0 wrong. This tests the matching logic, **not** how people actually write addresses: real-world addresses with building names, typos, or old municipality names will do worse, and the `confidence` field tells you when.
- No geocoding (latitude/longitude) and no building-level matching. Large-office codes (個別事業所) are returned for postal code lookups but not guessed from addresses.
- Municipal mergers: the data reflects Japan Post's current list, so old names (e.g. pre-merger 町村) may return `none`.

Source: 日本郵便「郵便番号データダウンロード」(https://www.post.japanpost.jp/zipcode/download.html). Japan Post states it claims no copyright on this data and it may be freely distributed.

# Actor input Schema

## `items` (type: `array`):

Postal codes (100-0001, 〒1000001, １００−０００１) and/or addresses (東京都千代田区飯田橋1-2-3). Up to 100,000 items per run.

## `mode` (type: `string`):

Auto picks per item. 'address' returns the postal code with a confidence level: town (exact town and block range), city (only the city's general code), ambiguous (several codes, candidates listed), none.

## Actor input object example

```json
{
  "items": [
    "100-0001",
    "東京都千代田区飯田橋1-2-3",
    "北海道札幌市中央区大通西二十丁目",
    "〒6008216"
  ],
  "mode": "auto"
}
```

# Actor output Schema

## `results` (type: `string`):

Result rows in the default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "items": [
        "100-0001",
        "東京都千代田区飯田橋1-2-3",
        "北海道札幌市中央区大通西二十丁目",
        "〒6008216"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("fontom.ai.plus/japan-postal-address").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "items": [
        "100-0001",
        "東京都千代田区飯田橋1-2-3",
        "北海道札幌市中央区大通西二十丁目",
        "〒6008216",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("fontom.ai.plus/japan-postal-address").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "items": [
    "100-0001",
    "東京都千代田区飯田橋1-2-3",
    "北海道札幌市中央区大通西二十丁目",
    "〒6008216"
  ]
}' |
apify call fontom.ai.plus/japan-postal-address --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,fontom.ai.plus/japan-postal-address"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/bYDdJoayaR7wq4Efy/builds/kgz22X2utke7RlvxQ/openapi.json
