We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this questionI need to lookup the Zip Code for a list of addresses (which include the city/state). Is there a master zip code list for download (that is free) or are there any web services that will return the full postage info for an address.
Ie, lookup query: 386 Bread & Cheese Hollow Rd, Northport, NY ====> 386 Bread And Cheese Hollow Rd, Northport, NY 11768
Thanks!
There's an API for that.
http://developer.yahoo.com/maps/rest/V1/geocode.html
This is a free library that you can download and use locally, without having to rely on a third-party API:
http://zips.sourceforge.net/
You can use the US Postal Service HTTP/XML API
According to this page on the US Postal Service website which documents their XML based web API, specifically Section 3.0 (page 13) of this PDF document, they have a URL where you can send an XML request containing an address minus the Zip Code and they will respond with an XML document containing the complete address.
According to their documentation, here's what you would send:
http://SERVERNAME/ShippingAPITest.dll?API=ZipCodeLookup&XML=<ZipCodeLookupRequest%20USERID="xxxxxxx"><Address ID="0"><Address1></Address1> <Address2>6406 Ivy Lane</Address2><City>Greenbelt</City><State>MD</State></Address></ZipCodeLookupRequest>
And here's what you would receive back:
<?xml version="1.0"?>
<ZipCodeLookupResponse>
<Address ID="0">
<Address2>6406 IVY LN</Address2>
<City>GREENBELT</City>
<State>MD</State>
<Zip5>20770</Zip5>
<Zip4>1441</Zip4>
</Address>
</ZipCodeLookupResponse>
USPS does require that you register with them before you can use the API, but, as far as I could tell, there is no charge for access. By the way, their API has some other features: you can do Address Standardization and Zip Code Lookup, as well as the whole suite of tracking, shipping, labels, etc.
I've seen zip code databases that can be purchased. Address correction services are available through major shippers like UPS, FedEx and the USPS, but I don't know if those services are free.
I know I'm late but hopefully this will still help people.
Remember a zip code is a US Postal Service delivery area. It doesn't respect any boundaries (except that it doesn't ever cross countries). Zipcodes frequently cross city, county, and even state lines. They exist for the convenience of the US Postal Service. Looking for one single zipcode based on a city+state is going to give you the zipcode that is the default for that city+state. In a rural area, that's great, but if I ask "what is the zipcode for New York, NY?" the response of a single zipcode won't be any help at all for me. As mentioned in other answers, you need an address AND city+state to accurately determine the delivery route, or the zipcode.
For some reason it seems to be really hard to find an up to date list of US zipcodes. I guess that baffles me because I always have one readily available. Here's the current one. It includes all 42,000+ zipcodes and also all of the city/state variations that are acceptable by the US Postal Service for those zipcodes.
https://www.dropbox.com/s/xa39nv6pcmy8z3d/zipcodes-Aug2017.zip?dl=0
I work with addresses everyday at a company called SmartyStreets.
For a more up-to-date answer on this, look into AggData.com’s "Complete List of United States Zip Codes" (License), which derives its data from GeoNames, a work published under the Creative Commons Attribution 4.0 License.
精彩评论