Zip Code Lookup API? [closed]
Asked Answered
G

4

18

I need an API to give me the zip code of a location when someone enters a location like Los Angeles, California. I have seen many APIs that give you the details by the zip code, but I need the reverse.

Godewyn answered 20/8, 2011 at 2:55 Comment(7)
You said "zipcode" -- did you mean zipcodes? Have you considered cities that have a lot of zipcodes? New York? Los Angeles?Geier
Yeah, but when I enter something like New York, NY on Weatherbug or another similar service it chooses a zip code. I was also wondering how they did that.Godewyn
Try this github.com/Loceo/loceo-jquery-pluginWiny
How in the world is this question opinion-based?Jackiejackinoffice
www.boundaries-io.com is a cheap paid service(simple rest API)...many of users.Diplomat
You can check form-api.com - disclaimer: i am member of the development teamNasty
You can also use thezipcodes.comImport
B
11

USPS has an address information api. You give it an address and it gives you the zip code. And as the commenters said, you need to provide an address, because many cities have multiple zip codes.

Barren answered 20/8, 2011 at 3:3 Comment(3)
Excellent point about the multiple zip codes. But the USPS' API can only be used if you're mailing things with the information you request...Gamache
There's also the undocumented JSON API that their online ZIP code lookup tool uses, which doesn't require any tokens or registration, just a user agent string: curl 'https://tools.usps.com/tools/app/ziplookup/zipByAddress' --data 'companyName=&address1=1234 example rd&address2=&city=Anytown&state=NY&urbanCode=&zip=12345' -H "User-Agent: Mozilla/5.0" They'll probably get mad if you start using it heavily though.Recalesce
You can use thezipcodes.com as well.Import
R
23

Check out the API from SmartyStreets.

As with the USPS address information API (mentioned above), you provide an address, the API provides the verified, standardized address along with the complete ZIP Code (5-digit code, Plus 4 Code, and Delivery Point).

Feel free to experiment with the free demo.

The advantages of this API over the USPS API are numerous. Also, the USPS API is meant specifically "to facilitate USPS shipping transactions only". SmartyStreets utilizes official, current USPS data.

**UPDATE: New users can sign up for a free trial.

***UPDATE: SmartyStreets now offers an address API and a ZIP Code API.

In the interest of full disclosure, I'm a software developer at SmartyStreets.

Respect answered 4/1, 2012 at 18:9 Comment(3)
Why is there a link "DO NOT READ THIS" on the site? I don't want to be weak but the curiosity is killing me ... why would you put a link like that on the site ... probably because you WANT me to "read this" right? But ... it says NOT TO!! (fetal position) :DFlip
Our plan is working perfectly...Respect
Smarty (formerly SmartyStreets) recently terminated the free monthly option without notice. Don't waste your time.Grapeshot
B
11

USPS has an address information api. You give it an address and it gives you the zip code. And as the commenters said, you need to provide an address, because many cities have multiple zip codes.

Barren answered 20/8, 2011 at 3:3 Comment(3)
Excellent point about the multiple zip codes. But the USPS' API can only be used if you're mailing things with the information you request...Gamache
There's also the undocumented JSON API that their online ZIP code lookup tool uses, which doesn't require any tokens or registration, just a user agent string: curl 'https://tools.usps.com/tools/app/ziplookup/zipByAddress' --data 'companyName=&address1=1234 example rd&address2=&city=Anytown&state=NY&urbanCode=&zip=12345' -H "User-Agent: Mozilla/5.0" They'll probably get mad if you start using it heavily though.Recalesce
You can use thezipcodes.com as well.Import
E
8

This Zip Code API provides the following functions:

  • Distance Between Zip Code API
  • Zip Codes in Radius API
  • Zip Code to City and State API and Zip Code to Latitude/Longitude API
  • Zipcode based on City and State
Etude answered 3/7, 2013 at 13:23 Comment(4)
I can't find the Zip Codes in Radius API information. That's exactly what I need. Hopefully you can point me in the right direction?Doak
For example it cant find zip for Sterling Heights, MISporades
It has the reverse way - zipcode to Sterling Heights - zipcodeapi.com/API#zipToLoc - 48310. Just a bad search capability for matching a two word city name...Etude
I sent an email to the developer and they fixed it. They said they had converted the "St" into "Saint" so the search they were running was "Sainterling Heights"...Etude
T
1

They have a cross reference database of zipcode, to lat/long-itude, and the weather station.

I am not aware of anything freely available, you will likely need to pay to compile this

Teresaterese answered 21/9, 2011 at 11:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.