The "Fast Lane" Answer
First things first: if all you need is a handful of domestic ZIP Codes, the easy answer is to go to the source. The USPS created the ZIP Code system, and they're the ones who maintain it. In fact, the whole system is designed to make their jobs a little easier by breaking the whole country down into bite-sized chunks.
If that's all you're after, then the USPS can give you everything you're looking for. So you can go ahead and stop reading.
Seriously. Go do something else now. Unless of course you find this topic enthralling, in which case: carry on. We won't judge.
The "Scenic Route" Answer
If you're looking for an API that produces ZIP Codes from addresses, there's a lot to choose from. So we could just grab a bunch of names and throw them at you like confetti, but that wouldn't be very helpful (unless you're having a party). So instead we've set up some parameters so that we can better point you in the direction of a provider that meets your needs. Here's some of the details you may want to consider:
- Accuracy Needs
- API Quality
- Bells & Whistles
Some providers, as mentioned above, can give you ZIP Codes for free. After all, the USPS is happy to give you the ZIP Codes you need to make their delivery job easier. But if you're looking to dump 50k, 100k, or more on a monthly, weekly, or—heaven forbid—daily basis, you'll have to go a different route. Most free services will restrict you to a one-at-a-time usage that keeps you from overloading their system. With larger quantities you're looking for a provider that is willing to process your data and return them in a timely manner.
We hate to break it to you, but that's the kind of thing a business would charge for.
Just like with geocoding and address validation, there's a pretty wide range on price for ZIP Codes. A lot of that is due to the fact that any bulk ZIP Code lookups you might be doing are going to be done with a provider that also performs validation and geocoding, and you're paying for a package deal. That's not to say it's bad, just that you're going to have to play with your price/speed/functions venn diagram for a little bit if you find you only want the ZIP Codes.
More on both speed and bonus functionalities down below.
When you say you're looking for a ZIP Code, that can mean a number of different things. Our first assumption might be that you're looking to finish off a specific mailing address with its associated ZIP Code. You'd add it yourself, but you can't be expected to know everything. Especially if "everything" includes knowing over 40,000 ZIP Codes.
Our second assumption is that you need to match a city/state combination (rather than a specific address) to a ZIP Code. Here's an easy example: Los Angeles, California, has, well, like, a lot of ZIP Codes. If you just want any Los Angeles ZIP Code, then they're pretty easy to come by. That kind of "horseshoes" accuracy can usually be grabbed with something as simple as a Google search.
However, if you're looking to complete a specific address as mentioned above, your best bet is to go with an address data provider. The USPS is the obvious example, but there's also commercial providers that can standardize the address and add the requisite ZIP Codes. Some even supplement this service with address validation and geocoding.
An important detail on accuracy: you're going to have a hard time with any address in an area where mail is only delivered to PO Boxes. The good news is that the USPS—and any commercial provider that references their data—has a list of all the ZIP Codes that are PO Box–only ZIP Codes. The bad news is the USPS doesn't keep a registry of physical addresses that they don't deliver to. So if you suspect that a physical address might only receive mail at a PO Box, you may want to search for just city/state level accuracy. Try to keep this in mind if a good number of your addresses come from these places.
Now let's talk about a few qualities critical for the die-hard, don't-mess-around ZIP Code hunters: API quality, speed & capacity, and extra functionality.
We are talking about APIs, right? Not just ZIP Codes and confetti? That's good, because we have some pretty extensive dissertations on the pros and cons of some APIs that would likely suit your needs. These lists are about geocoders and address validators respectively, but just about everyone on either list offers ZIP Codes as part of their package.
Again, what features you choose depends on what you need and how much you'll use the API. There are some really solid APIs out there, with restriction-free usage, stellar uptime, and quality data. The value of API real-time functionality cannot be overstated. But if you don't need any of that then there's no reason to pay for it.
Mind you, most of the providers we looked at offered a significant amount of free service, so they're worth checking out either way.
If you're really serious about getting your ZIP Codes, speed is likely the kicker. You need a lot of ZIP Codes, you need them fast, and likely you need them on a regular basis.
- How much can they take: Does the ZIP Code provider you're looking at put limits on the number of request you can make per second? Per day? Per month? Do they support batch requests? Do they queue or otherwise slow down the rate at which your requests hit their system and process?
- Capacity and speed: How fast can they process 1,000 requests? 10,000? 100,000? 10,000,000+? Some providers can receive and then return data almost as fast as your hardware can accept it. How desperate are you for speed like that?
- Long-term arrangements: Okay, so you're going to be giving them lots, and you need them returned fast. But you're not just dumping a list of 1,000,000 requests on them and calling it good. No, you're going to be making some serious laps in this swimming pool, so you're looking for a provider who will let you sign up for a membership and swim as much as you want, whenever you want. It's cool; there are plenty of providers that can help you out with that, some with very reasonable prices.
A good number of providers offer what you're looking for in all three categories, and finding a price that's right is easier than you might expect. And again, many of these providers also offer free options below a certain usage threshold.
There's a number of bells and whistles that can come as part of a package when you go looking for someone to provide you with ZIP Codes. And some of them may be things you need. A few examples:
- Reverse lookup—Maybe some of the time you need to be able to do the reverse of what we've been talking about so far; maybe you need to give the provider a ZIP Code and have them extrapolate a city and state. Not all providers do it, so if you need it, keep an eye out for it.
- Geocoding—Maybe you don't just need the ZIP Code, maybe you also need the GPS coordinates that go with the address. It is nice to know where things are, after all.
- Address validation—Maybe you need to know that the address is a real address. After all, it's not very easy to assign a ZIP Code to a place that doesn't exist.
- International—This is a whole other mess that many providers don't even deal with. Seeing as "ZIP Codes" are actually a creation of the USPS (literally; it's something the USPS implemented into their own mailing system), similar creations made in other nations are significantly different than the system we use. So if you're looking to get info on things overseas, be sure to double check that the provider offers international service.
We strongly recommend perusing our articles on geocode APIs and validation APIs, where we give breakdowns on some providers, discussing many of the same points mentioned here, as well as our article on how to find a good API. You can also take our ZIP Code API for a test run, if you feel so inclined.
In the end, finding the right provider is going to take two things: knowing what you want, and knowing what's out there. This article and the others linked here should take care of most of the "what's out there" part. The rest—well, that's up to you.