A lean JSON interface — no registration, no API key, no rate limit. Send a postal code, an area code or a place name and receive the place, its country and all matching postal codes and area codes as structured JSON.

Endpoint

https://www.postleitzahl.net/api/{country}/{query}
https://www.postleitzahl.net/api?country={country}&q={query}
{
    "status": "success",
    "country": "Philippines",
    "countryCode": "PH",
    "place": "Dulag",
    "postcode": "6505",
    "areacode": "",
    "query": "6505",
    "type": "postcode"
}

Query types

The type is detected automatically. A numeric input with the country's postal code length is treated as a postal code, any other digit sequence as an area code, everything else as a place name. Use ?type= to force the type.

Example Type Meaning
https://www.postleitzahl.net/api/de/32423https://www.postleitzahl.net/api?country=de&q=32423postcodepostal code
https://www.postleitzahl.net/api/de/0571https://www.postleitzahl.net/api?country=de&q=0571prefixtelephone area code
https://www.postleitzahl.net/api/de/Mindenhttps://www.postleitzahl.net/api?country=de&q=Mindenplaceplace name

Parameters

Parameter Effect
country
fieldscomma separated list of the desired fields, e.g. ?fields=place,postcode
typesets the query type: postcode, prefix or place
langlanguage of the translatable fields, e.g. ?lang=en
callbackJSONP function name
qthe query as a parameter instead of in the path: /api/json?q=Minden

Localization

The country field is translated when the lang parameter is set. Place names always stay in the national language because they are proper nouns. Without lang the caller's Accept-Language header decides. An unknown value is ignored.

de ar be bg bs ca cs da el en es et fa fi fr ga he hi hr hu hy id is it ja ka km ko lo lt lv mk mn ms mt ne nl no pl pt ro ru sk sl sq sr sv th tr uk vi zh

curl "https://www.postleitzahl.net/api/de/32423?lang=en"
{ "status": "success", "country": "Germany", "countryCode": "DE", "place": "Minden", "postcode": "32423", "query": "32423", "type": "postcode" }

Response fields

Field Content Example
statussuccess or fail"success"
querythe submitted query"10000"
typedetected query type: postcode, prefix or place"postcode"
countrycountry, translatable via lang"Germany"
countryCodecountry code per ISO 3166-1"PH"
placeplace name, a list if there are several"Minden"
postcodepostal code of the place, a list if there are several["32423","32425","32427","32429"]
areacodetelephone area code of the place, a list if there are several"0571"
messageonly with status fail: reason"not found"

Usage limit

Each IP address may send 20 requests per 10 minutes. Every response reports the remaining requests in the X-Rl header and the seconds until the reset in X-Ttl. Once the limit is exceeded the interface answers with status 429 until the rate limit window is reset. Going over the limit in 5 consecutive windows results in a 3 minute ban.

{
  "status": "fail",
  "code": 1008,
  "message": "rate limit exceeded, 20 requests per minute",
  "query": "10000"
}

Error responses

HTTP message Cause
4011001missing api token
4011002invalid api token
4001003missing or unknown country
4001004missing queryno query supplied
4001005query too longmore than 80 characters
4041006not foundno match
4291007try-out limit exceeded, 10 requests per 5 minutes without api tokenusage limit reached, applies until the end of the window
4291008rate limit exceeded, 20 requests per minute
4291009try-out banned for 60 minutes, limit exceeded repeatedlylimit exceeded repeatedly

Examples

curl -H "X-Api-Token: plz_…" https://www.postleitzahl.net/api/ph/10000
curl -H "X-Api-Token: plz_…" "https://www.postleitzahl.net/api/gb/SW1A%201AA"
curl -H "X-Api-Token: plz_…" "https://www.postleitzahl.net/api/de/Minden?fields=place,postcode"
curl "https://www.postleitzahl.net/api?country=de&q=0571&type=prefix&token=plz_…"

Data sources

Municipality keys, NUTS codes and population figures come from the municipality register and the NUTS classification of Eurostat. The assignment of postal codes to regions follows the official TERCET table of the European Commission.