Postal Code Lookup API

Turn a postal code into the place it belongs to: town or city, region, country and a coordinate. Covers ZIP codes, UK postcodes, Canadian postal codes, Indian PIN codes, Japanese 郵便番号 and their equivalents in 160 countries. Useful on its own for address forms and as a quick, cheap way to place a record when a postcode is all you have.

GEThttps://api.mygeocode.com/v1/postcode?code=...&country=...

Try it in the demo Full reference

Example

Request
$ curl "https://api.mygeocode.com/v1/postcode?code=10001&country=us"

# UK postcodes resolve to a street or a handful of buildings
$ curl "https://api.mygeocode.com/v1/postcode?code=SW1A+1AA&country=gb"

Always send country when you know it. Postal codes are not unique across countries: 10001 is in New York and in several other countries. Without a country you get results from every country where the code exists, most populous first.

Formatting is forgiving. Spaces, hyphens and case are normalised, so sw1a1aa and SW1A 1AA are the same.

Response
{
  "status": "ok",
  "postcode": "10001",
  "country_code": "US",
  "results": [
    {
      "postcode": "10001",
      "place": "New York",
      "region": "New York",
      "region_code": "NY",
      "country": "United States",
      "country_code": "US",
      "lat": 40.7484,
      "lon": -73.9967
    }
  ]
}

What you get back

FieldMeaning
resultsOne entry per place the code covers. Most codes map to one place; some rural codes cover several villages and return several entries.
placeThe town, city or locality name as the postal authority uses it.
region, region_codeState, province or county and its ISO 3166-2 code where one exists.
lat, lonThe postal authority's point for the code where published, otherwise the centroid of the addresses we hold for it.

Where it is used

Address forms

Ask for the postcode first and fill in the city and region. Users type less and make fewer mistakes.

Delivery areas and pricing

Decide which depot serves a customer or which shipping band applies from the postcode's coordinates.

Mapping survey data

Datasets that only record a postcode can be mapped at postcode precision, which is often all that privacy allows anyway.

Price and limits

One call, one request, regardless of how many places the code covers. 2,500 a day free, then credits at $0.001 per request or €50 a month unlimited. Pricing. For a full address with house number, use forward geocoding instead.