An Address API is an application programmatic interface (API) that processes, changes, or manipulates addresses in order to make address data more useful, standard, complete, or valid.
Here are just a few of the many kinds of address APIs we will cover.
- An Address Correction API looks up addresses in official or authoritative address databases in order to correct typos, casing, and abbreviations.
- An Address Validation API verifies that an address is real, mailable, or valid for specific uses.
- A USPS ZIP Code API appends ZIP codes to other address data and may provide detailed data about particular ZIP Codes.
- An Address Enrichment API appends additional data points about the address. Data like congressional districts, FIPS Codes, vacancy status, and more can be provided.
Smarty (formerly SmartyStreets) has a collection of address APIs that are pretty handy. They fall into four main categories: US Address APIs, International Address APIs, Autocomplete APIs, and Geocoding APIs.
|US Validation APIs -
Verifies, standardizes and gets ZIP Codes for US Addresses.
|International APIs -
Verifies and standardizes addresses in 240+ countries.
|Autocomplete APIs -
Suggests addresses based on each keystroke of user entry.
|Geocoding APIs -
Turns addresses into lat-long or lat-long into addresses.
In this article we'll discuss the following:
- Address Correction APIs
- Address Standardization APIs
- USPS ZIP Code APIs
- Address Autocomplete APIs
- Geocoding APIs
Address Correction APIs
Address correction is the process of taking improperly formatted addresses or addresses with typographical errors and matching them with the standardized, validated version in an official or authoritative address database.
An official address database for a country is typically created by a government entity for the purpose of mail delivery. Depending on the country, the database and may or or may be authoritative. An authoritative address database is usually more comprehensive than an official databases since they can aggregate data from multiple public and private datasets with the primary objective of completeness rather than achieving a specific objective. For example, the USPS leaves millions of addresses out of their database for places where door delivery isn't offered. Authoritative sources can fill in gaps that were missed or omitted from these official datasets.
Address correction (or validation) API will programmatically fix any errors and see if an address is contained in the database for the country. If the address that is being checked is found to exist, then that address is "valid". The nice thing about using an API to verify addresses is that you can validate a lot of addresses very quickly. In fact, Smarty can validate over 100,000 addresses per second against our own authoritative address database. You can even get access to our US Master Address List which is a comprehensive dataset of 193+ million valid US addresses. State specific lists are are also available.
Many countries have official address databases. For example, Canada has Canada Post, the UK has Royal Mail, France has La Poste, Germany has Deutsche Post, etc. Each of these official databases contains all of the officially recognized postal addresses in the respective country. And, many of these countries provide access to their databases via an API.
USPS Address Validation API
For addresses in the United States, the USPS manages the official address database for the country. And, they make all of the information in that database accessible by using an API. But, their own API leaves a lot to be desired and so does their data.
Fortunately, they do allow third-party suppliers to create their own APIs using the official USPS data. And thankfully, they often provide that same data and more, all in a much more efficient and robust manner than the USPS.
It is also worthwhile to note that although the USPS processes mail going to international addresses, it does not offer an international address validation API.
Google Address Validation API
Until recently, Google didn't have an Address Validation API, but in November 2022, Google introduced its Address API.
Google Address Validation API is still in its infancy and has coverage in only a handful of countries, but that will likely change with time. If you're running an eCommerce business, Google may be a good fit for your needs, but their Terms of Service are restrictive, and the capabilities of the API are limited, which rules out many other use cases. For example:
- In most cases, Google doesn’t allow you to store addresses beyond 30 days.
- The Google Address Validation API parses addresses inconsistently - sometimes combining several components into a single value and sometimes parsing them separately depending on the address.
- Google’s API is rate limited to 100 queries per second, which makes batch validation slow.
- Google’s Address Validation API is separate from Google’s Address Autocomplete API. No validation means you’ll need to use one API to autocomplete addresses and another API later to suggest the cleaned-up, validated version, which adds unnecessary steps and confusion to the address entry process.
- Google requires you to display a “Powered by Google” and copyright notice near any address data provided by their APIs. If displayed on a map, it must be a Google Map.
- Google offers limited support options. A 24-hour first response to a problem is the standard, to say nothing of how long it’ll take to resolve an issue entirely. Google encourages you to get answers from StackExchange instead.
And those limitations are just the beginning. Read this article for more in-depth coverage of the abilities and drawbacks of Google Address Validation. We’re big believers in knowing what you’re getting upfront when choosing an API.
There are also many qualified providers besides Google. You may want to see our review on how to choose an address validation provider. It can help you select the best address validation API specific to your needs.
Address Standardization APIs
Address Standardization is "the process of changing addresses to adhere to USPS standards." Or, in countries outside of the United States, it is the process of modifying addresses to adhere to the official postal format of the country in which the address is located.
For address standardization, Google can help through their address validation API. But, the search giant doesn't standardize results in their geocoding, mapping, or autocomplete, and other mapping APIs.
USPS ZIP Code APIs
USPS ZIP Code APIs can perform a multitude of functions. They can verify that an address has the proper ZIP Code affixed to it. They can append a ZIP Code to an incomplete address. They can augment an address's ZIP Code by adding ZIP+4 Code data to the address, and much more.
Because ZIP Codes are only used in the United States, a true ZIP Code API will only provide ZIP Code data for addresses located in the US. However, many people mistakenly use the term "ZIP Code" to refer to "postal codes" in countries outside the United States. Consequently, many address validation services also provide postal code data for addresses outside of the United States, just like they provide ZIP Code data for US addresses.
ZIP Code lookup API by USPS
Among the various address APIs it offers, the USPS also offers a ZIP Code lookup API. This API will return the ZIP Code and ZIP Code +4 that corresponds to a given address. It will also provide this data for a given city and state combo.
The benefit of using this API is that it's free! The downside to using it is that it suffers from the same downfalls that almost all of the USPS APIs struggle with.
It is poorly documented, which can make implementation difficult. Also, it is not really supported. So, when you encounter a problem that is not covered in the inadequate documentation, you're going to have a hard time actually speaking with someone at the USPS who can actually help you fix the problem. And that's if the problem is on YOUR end. Because guess what? Just like all of the USPS APIs, the ZIP Code API struggles with frequent downtime.
And, on top of all this, it can only process up to 5 lookups per request. When it's working of course.
USPS ZIP Code API by Google
While Google's Geocoding API can be used to look up ZIP Code info, it still comes with the same problematic terms of service that we mentioned in the address validation section of this article.
Unless your needs for a ZIP Code API also allow you to display a map, and give full logo and copyright notices, you're better off using a different ZIP Code API provider.
Address Autocomplete APIs
Just as the name suggests, an address autocomplete API automatically suggests addresses as a user is typing. The most common use case for this application is when someone is completing an order form of some kind.
An address autocomplete API can be useful for a number of reasons. One of those reasons is quality control. If a user sees their address being suggested as they type it in, they are more likely to click on their own, correct address.
Because the address that is being suggested has already been properly formatted and validated, when the user clicks on it, that data enters the company's database correctly, the first time. This can save a lot of time and money by avoiding shipping and/or mailing things to the wrong address.
Another benefit of using an autocomplete API is that it saves time. And, if a user spends less time typing things into an order form, the risk of shopping cart abandonment is also lowered. Learn more about address autocomplete.
Google Places Address Autocomplete API
But remember, Google's autocomplete API does not validate addresses.
One of the problems with using their autocomplete API is that it doesn't do what most people think it does. Since it doesn't validate addresses, the suggestions offered by the address autocomplete API are not necessarily valid and cannot expected to be standardized.
Why is that a problem?
Well, if you're using the autocomplete feature to help reduce the number of invalid addresses people enter, Google isn't validating these addresses. So, you’re still receiving invalid addresses while using Google's autocomplete.
If you decide to use both Google's autocomplete API and their address validation API, anyone entering addresses gets a poorer user experience. Imagine selecting an address from autocomplete suggestions that contain invalid, unstandardized, and typoed suggestions. After choosing an address, the website responds that the address you selected isn't correct and presents another address. Using both APIs adds extra steps and friction, increasing the probability of form abandonment.
While Google doesn't include address validation in their autocomplete API, other providers do. Address Autocomplete APIs with address validation baked in allow people to select from address suggestions containing only typo-free, complete, and valid addresses without extra steps or additional API calls.
Another problem with Google's address autocomplete API is that it has the same restrictions as mentioned previously in this article, namely:
"Customer will display all attribution that (i) Google provides through the Services (including branding, logos, and copyright and trademark notices); or (ii) is specified in the Maps Service Specific Terms."
So, if you're looking for a subtle auto-suggest experience for your users, Google will not provide that for you.
Smarty US & International Address Autocomplete APIs
Smarty's US & international autocomplete APIs also suggest addresses for users as they are typing. So what are the main differences between the Google's address autocomplete API and Smarty's US & International autocomplete APIs?
First of all, Smarty's Address Autocomplete DOES validate addresses, Google's Address Autocomplete DOESN'T. Secondly, Smarty's DOES offer suggestions down to the apartment number, Google's DOESN'T. Thirdly, Smarty's DOES provide PO Boxes, APOs, and FPOs in the autocomplete suggestions, but Google's DOESN'T. Fourthly, Smarty's DOESN'T have oppressive attribution requirements, Google's DOES.
Smarty's US Autocomplete Pro API will also autocomplete non-postal addresses. That means that the millions and millions of real and valid addresses in the US where the postal service doesn't offer delivery (yes, millions) will still appear in the autocomplete suggestions. They will also appear in a standardized format.
That is something many autocomplete providers (including Google) can't do.
So, if you're wanting a better UX for your customers or data entry employees, you might want to give the Smarty US Autocomplete API or International Address Autocomplete API a try.
Geocoding (not to be confused with reverse geocoding) is the process of identifying the real-world geographic coordinates of a specific location. Therefore, a Geocoding API would allow its users to programmatically identify the geocodes of a specific location, depending upon the input it receives.
One of the more common uses of a rooftop geocoding API is to convert postal addresses into lat-long coordinates, also known as 'geocodes'.
For example, here is the postal address:
543 S State St Salt Lake City UT 84111-3521
By entering that address into the Smarty address validation demo, we see that the corresponding geocodes are:
Latitude: 40.75745 Longitude: -111.88767
By using a geocode API to convert addresses into geocodes, we can quickly identify the lat-long coordinates of thousands of addresses. This can be useful for a number of applications.
Using Google's Geocoding API
Google Maps API can be used to find the geocodes of addresses.
One thing that Google is known for, of course, is Google Maps. And Google Maps has pretty much become the default way of finding your way around places. How many of us have used Google Maps to give us driving or walking directions to someplace?
Google Map's ability to find a specific location is based on its use of geocodes. In fact, when you enter an address into Google Maps, it will automatically convert that address into the address's corresponding lat long coordinates, or geocodes. Those coordinates are then used to navigate you to your desired destination.
And, if you want to convert LOTS of addresses into geocodes, Google Maps API can help you do that quickly.
Just keep in mind that when you're using their API, you have the same usage limitations and citation requirements that we discussed previously in this article.
So, if you can accomplish your project while giving full citations and displaying a map with your results, then the Google Maps API may be a good geocoding solution for you to consider.
Smarty Geocoding API
The Smarty Address Validation API can also be used to find the lat-long coordinates of an address, as shown in the previous example.
In fact, the Smarty Address APIs can be a great option for you to consider as well.
So what are the benefits of using the Smarty APIs for geocoding vs the Google Maps API?
- The Smarty APIs can process over 100,000 addresses per second
- There are no citation or map display requirements like Google's
- Geocodes are available for over 240+ countries and territories around the world
- Smarty provides fanatical customer support should you have any questions
- All of the APIs are fully documented and supported
- Free testing accounts are available to try the APIs and see if they're right for you.