Address to ZIP JA EN My Page
API Reference v1

Documentation

Base URL: https://api.example.jp — authenticate with the x-api-key header. All responses are JSON (UTF-8). New here? The quick-start guide gets you running in about 5 minutes.

Endpoints

GET /api/v1/search — address to postal code

ParameterRequiredDescription
addressrequiredAddress string (up to 256 chars) in kanji, kana, or romaji. Real-world input like “Marunouchi 1-2-3, Chiyoda-ku, Tokyo” is interpreted down to the town level automatically — building names and block numbers are stripped.
limitoptionalNumber of results, 1–50. Default 10.
langoptionalLanguage of error messages. en for English (defaults to the Accept-Language header). Error codes never change with language.
curl --get "https://api.example.jp/api/v1/search" \
  --data-urlencode "address=Marunouchi, Chiyoda-ku, Tokyo" \
  -H "x-api-key: YOUR_KEY"

{
  "query": "Marunouchi, Chiyoda-ku, Tokyo",
  "count": 1,
  "results": [
    { "zipcode": "100-0005", "prefecture": "東京都",
      "city": "千代田区", "town": "丸の内",
      "address": "東京都千代田区丸の内", "kana": "...",
      "prefecture_romaji": "Tokyo", "city_romaji": "Chiyoda-ku",
      "town_romaji": "Marunochi", "romaji": "Marunochi, Chiyoda-ku, Tokyo",
      "score": 93 }
  ]
}

GET /api/v1/lookup — postal code to address

ParameterRequiredDescription
zipcoderequired100-0005 or 1000005 (exact match).
langoptionalSame as above.
curl "https://api.example.jp/api/v1/lookup?zipcode=100-0005" \
  -H "x-api-key: YOUR_KEY"

GET /api/v1/health — status and data freshness (no auth)

Returns record count, data timestamp, and datastore reachability. During an outage it returns 503 {"status":"degraded"}. Handy for monitoring.

Romanization

Every result includes prefecture_romaji / city_romaji / town_romaji, plus a composed romaji field in Western order (town, city, prefecture) — safe to store in Latin-1 systems.

Code examples

Calling address → postal code (/api/v1/search). Replace YOUR_KEY with your API key. For reverse lookup, switch to /api/v1/lookup with a zipcode parameter.

curl --get "https://api.example.jp/api/v1/search" \
  --data-urlencode "address=Marunouchi, Chiyoda-ku, Tokyo" \
  -H "x-api-key: YOUR_KEY"
Sending Japanese text: the examples above URL-encode the query automatically. If you build query strings by hand and pass kanji/kana input, make sure the address is URL-encoded — raw Japanese characters in a URL violate the HTTP spec and the CDN will return an empty-body 400.

MCP (for AI agents)

AI agents such as Claude and Cursor can call the API directly as tools via the Model Context Protocol. The endpoint is https://api.example.jp/mcp, authenticated with the same x-api-key header. Two tools are exposed: search_address (address → postal code) and lookup_zipcode (postal code → address). Usage counts toward the same rate limits and billing as the regular API.

Claude Code (CLI) — replace YOUR_KEY with your API key.

claude mcp add address-to-zip \
  --transport http \
  --url https://api.example.jp/mcp \
  --header "x-api-key: YOUR_KEY"

Claude Desktop / Cursor (config file)

{
  "mcpServers": {
    "address-to-zip": {
      "url": "https://api.example.jp/mcp",
      "headers": { "x-api-key": "YOUR_KEY" }
    }
  }
}
Supported clients: any MCP client that can send custom HTTP headers (Claude Code, Claude Desktop, Cursor, etc.). Claude.ai (web) custom connectors currently support OAuth only, so they cannot connect.

The server is listed in the official MCP Registry as jp.addresstozip/address-to-zip.

Errors

Add lang=en (or send Accept-Language: en) to get error messages in English. The error codes below are stable across languages.

HTTPerrorMeaning and what to do
400invalid_parameterBad parameter. The reason is in message.
401unauthorizedMissing or invalid key. After a reissue, the old key stops working immediately.
403key_suspendedSuspended because payment could not be confirmed. Update your payment method in the Stripe portal and the key resumes automatically.
403origin_not_allowedBrowser call from an origin that is not on the allow list (see CORS below).
429rate_limitedRate limit exceeded. Wait until x-ratelimit-reset (unix seconds) and retry.
503service_unavailableTemporary outage. Retry after retry-after seconds.

Rate limits

Each key has a rate limit. The effective values are returned on every response in the x-ratelimit-limit / remaining / reset headers — read them at runtime. There is no monthly cap.

CORS (calling directly from a browser)

Server-side calls are never origin-restricted. Origin checks only apply to requests that carry a browser-set Origin header. With the recommended setup (calling the API through your own server), you don't need to register any origins.

For direct browser calls, requests are accepted from the allowed origins registered with your key (exact scheme+host+port match, up to 10, wildcard https://*.example.com supported). Browser calls from unregistered origins get 403. You can edit allowed origins anytime from My Page (Japanese UI).

Honest note: we recommend calling through your server. In browser-direct setups your key is visible in the page source. Origin checks only mitigate browser-based abuse; they cannot stop a stolen key from being used via curl.

Live console (no sign-up)

Runs the same search engine through the site's public search (10 requests/min).

Service terms