API v1
Chile's postal code, as an API.
Public, free, no API key. Predictable JSON responses and OpenAPI.
Base URL
https://micodigopostal.fun/v1Endpoints
GET
/postal-codes/searchCode by commune (and optionally street + number).GET
/reverseCommune, street and number from lat/lon (via OpenStreetMap).GET
/regionsRegions of Chile with their communes.GET
/stats/summaryData coverage.GET
/healthService status.Example
The same request, in three languages.
curl
curl -G "https://micodigopostal.fun/v1/postal-codes/search" \
--data-urlencode "commune=Ñuñoa" \
--data-urlencode "street=Irarrázaval" \
--data-urlencode "number=3400"JavaScript
const params = new URLSearchParams({
commune: "Ñuñoa",
street: "Irarrázaval",
number: "3400",
});
const res = await fetch(
"https://micodigopostal.fun/v1/postal-codes/search?" + params
);
const { code, precision, addressStatus } = await res.json();Python
import requests
r = requests.get(
"https://micodigopostal.fun/v1/postal-codes/search",
params={
"commune": "Ñuñoa",
"street": "Irarrázaval",
"number": "3400",
},
)
print(r.json()["code"])Response
{
"code": "7790825",
"precision": "exacta",
"addressStatus": "exact",
"source": "official",
"commune": "Ñuñoa",
"province": "Provincia de Santiago",
"region": "Región Metropolitana",
"lat": -33.4593,
"lon": -70.6003
}addressStatus distinguishes "not_requested", "exact", "commune_only" and "temporarily_unavailable"; precision is "comuna" or "exacta"; source is "base", "osm" or "official". Rate limit: 30 searches/min per IP. CORS is open for GET.