SmartyStreets

Address Autocomplete | What it is and how to use it

Address Autocomplete API with Building Numbers

Address Autocomplete is a web form feature that suggests street addresses to users as they type an address into a form. Because an Autocomplete function reduces the number of keystrokes & mistakes that a user types, it can make data submission faster and more accurate.

See ‘Address Autocomplete’ in action. Try a free demo of the SmartyStreets US Autocomplete Pro API.

In this article, we’ll discuss:

What is Address Autocomplete?

As mentioned previously, ‘Address Autocomplete’ is an application feature that suggests street addresses as a user is typing. When implemented correctly, autocomplete can:

  • Simplify the checkout process by eliminating keystrokes for shipping and billing information.
  • Reduce cart abandonment rates by minimizing shopper fatigue.
  • Eliminate typographical errors.
  • Standardize addresses to the local postal authority format.
  • Validate that an address is real and mailable.

5 Considerations for Developers using an Autocomplete API

So, you have decided you want to use an address autocomplete API in your website or project. Great choice.

No developer wants to get waist deep in a project before realizing their API choice doesn’t work for what they need. In this section we are going to cover some key considerations for you to keep in mind as you look for a solution. Using these suggestions, you can make sure that you end up with your dream API.

While every user’s needs are different, there are some common features that most people need when using an autocomplete tool. Here are 5 common considerations that are important when selecting an autocomplete API:

Consideration #1: Geolocation

Autocompletion’s universal goal is to make entering an address quick and accurate. One way to do this is by using an autocomplete tool that has a geolocation feature. A geolocation feature will approximate the location of the user based on their IP address.

The autocomplete tool will then suggest addresses that are close to the geographic location of that IP address. Suggesting addresses that are close to a user’s physical location can help a user choose the correct address more quickly. Using an autocomplete api that does not have a geolocation feature may require a user to type in more characters in order to find the correct address.

The more characters a user has to type, the longer the entry process will take. Additionally, there is a greater chance that the user will enter a typographical error. Using an autocomplete tool without a geolocation feature may therefore not be very useful.

Here is an example of why using an autocomplete tool with a geolocation feature is so important.

In the United States, there are tens of thousands of addresses that contain the number sequence “151.

Within a particular state, there are hundreds of addresses that contain “151”.

But, within a specific city, there may only be a dozen addresses that contain “151”.

So, imagine that a user was typing an address into an autocomplete form that was using a geolocation feature. The autocomplete software would take note of the public IP address of that user and identify where the user was geographically located. It would then display addresses containing ‘151’ that are physically closest to the user’s actual geographic location. Following this process, it is highly likely that the autocomplete tool will suggest the user’s correct address within 10 to 15 keystrokes.

Consideration #2: Secondary Unit Designators (Apartments Numbers)

Many autocomplete tools will provide you with the primary address of a location. But, they may not provide you with the ‘Secondary Unit’ of the address. That means it might suggest the address of an apartment building, but it won’t suggest a specific apartment number within that building. Whether or not an API completes the Secondary Address Unit Designators (Apartment numbers) can be an important point of consideration.

A question worth asking is, “Do you need “front door” accuracy or “ballpark” accuracy for your API?” If your application just needs to estimate a user’s address in order to find out how far they are from the closest National Park then ballpark accuracy is probably fine.

However, if you need to verify the unit number of a user’s address in order to ship mail, deliver food or do maintenance work; you probably need “front door” accuracy.

Here’s an example. Suppose that a user typed in their address as:

233 S Wacker Dr

and the autocomplete tool returned the following address as a suggestion:

Google Autocomplete Apartment Incomplete Address

The suggested address looks like a good address. Right? In this case, you would be wrong. Incidentally, the address in question is the Willis Tower (formerly known as ‘The Sears Tower’) which was the tallest building in the United States until 2013. This street address has the following valid mailing address types:

  • 6 addresses for floors
  • 284 addresses for Suites
  • 598 addresses for Units
  • 9 addresses just for the lobby

That means that there are over 800 valid secondary unit numbers for this one street address. So, if your website uses an autocomplete tool that does NOT suggest secondary addresses what is the likelihood that your customer in unit 6083 is actually going to receive his inflatable cat unicorn horn that he ordered?

Inflatable Cat Unicorn Horn

Unfortunately, many autocomplete API providers don’t suggest apartment numbers. They only provide street level or house-number level addresses.

Don’t let inadequate considerations for unit numbers be the “gotcha” moment that sends you back to square one. Test out some apartment numbers on the API you plan to use before you commit.

Consideration #3: PO Boxes, APOs, FPO, DPOs.

An extension of the issue with Secondary Unit Designators is how an autocomplete API handles PO Boxes (POBs), Army Post Offices, (APOs), Fleet Post Offices (FPOs), and Diplomat Post Offices (DPOs). Because there are 21 million PO Boxes in the US, how an autocomplete api tool handles this issue can be a big deal.

Unfortunately, many providers stop offering suggestions after a user types in a PO Box number. It is the digital equivalent of saying, “Don’t touch me with that hot garbage”. Since many entry-level autocomplete providers are mapping companies, they are less concerned with all the mailing points to which a customer might want to ship.

If correctly handling all types of secondary unit designators is important to you, we recommend that you test any prospective autocomplete API with some sample addresses that include PO Boxes, APOs, FPOs and DPOs.

Consideration #4: Standardization & Validation

Another important issue to consider when evaluating an autocomplete tool is whether or not it standardizes and validates addresses according to the official postal format.

Take this example:

Google Places Autocomplete PO Box Example

In this example, you’ll notice that we have 5 PO Boxes coming back from a commonly-used address autocomplete provider. Out of the 5 suggestions, none of the addresses are returned using the same format.

Shipping or mailing to the suggested addresses could result in delivery delays. It could also result in returned or lost packages.

Take a counter example from another provider:

Address Autocomplete Standardized Post Office Boxes

The addresses shown are all in a standard format and are valid PO Boxes.

Using a service that standardizes and validates addresses will simplify your life and give your users a better overall experience.

Consideration #5: Providing Only Real Addresses

You would think that if you are using an address autocomplete API, that the provider would ensure all the addresses in their database are real shipping addresses. Right? Unfortunately, that is often not the case. Many providers will autocomplete an address based on where an address would hypothetically be located - if it did exist.

Here is an easy way to understand and test this with a provider. Simply take a street address you know is real, and alter the building number by one digit and see if the provider’s tool shows that ‘fake’ address as a suggested ‘real’ address.

For example, here is a valid address:

30 Knole Lane
Dennis MA 02638-2009

But let’s say, the user’s finger slips and accidentally hits the “4” key, instead of the “3” and now the address is entered as 40 Knole Lane. The problem is this new address doesn’t really exist. In reality, there are only 2 valid street addresses on Knole Lane in Dennis, MA.

The two house numbers that actually exist on this street are house number 30 and house number 33. Many address autocomplete tools ignore the house number. As a result, they won’t correct that part of the address and will still display that as a valid option like this:

Algolia Places API Invalid House Number

Now, the tool fails to suggest a real address and falsely suggests an address that doesn’t really exist.

API & SDK Service Providers

Now that we have discussed 5 things to consider when deciding on an autocomplete service provider, we will cover some of the more popular providers in the market. We will discuss 3 APIs and then give you a comparison summary table:

Each of these has its strengths. So, comparing their offerings to your needs is the next step in the evaluation process. Let's discuss how each provider stacks up to the 5 Autocomplete API Considerations we outlined above.

Google Places Autocomplete API

Want to see a head-to-head comparison between Google and SmartyStreets? Check out our Google Address Autocomplete versus SmartyStreets comparison.

Google Maps and Google Places are both a pretty big deal. Because they do places, it isn’t surprising that they provide a Google Places autocomplete API.

The Google Places library has the most complete set of worldwide public business listings. The Google API provides data from over 200 countries and territories. They also have volunteers that submit data for location data via their Local Guides program. But, how does their API measure up to the 5 considerations we discussed earlier? Here is how they stack up.

Geolocation

✅ Google’s Autocomplete API returns address suggestions faster by starting with the geolocation of the user. Good job Google.

Secondary Unit Designators

❌ Google does not suggest apartments, units, suites, floors, or any other secondary unit indicators with their address autocomplete. Also, Google’s API does not check to make sure that a unit number that is typed into their tool is valid.

To Google, Platform 9¾ may as well not exist.

Consider this. Based on our most recent count, there are 160 million mailing addresses in the US. Of those, 44,937,008 contain secondary address indicators. This means almost a third of users in the US would need to input the apartment number manually into Google’s tool. And half of the users might just forget to do it at all.

Standardizing & Validation

❌ Google doesn’t standardize or validate addresses. If your application incorporates shipping, delivery or needs real shipping addresses for any reason, Google may not be able to give you what you need.

Much of the data that Google aggregates comes from volunteers. They can report problems with streets and residential addresses and add new locations. Google doesn’t require address standardization training, so data accuracy varies widely.

Take something as simple as a post office box.

Here is an autocomplete Google Places example without map:

Google Address Autocomplete Location Demo

We have 4 suggestions and 3 formats for “PO Box” and only one is in the correct standardized format. To be fair, Google doesn’t do PO Box data either, but it does show the random formats.

PO Boxes, APOs, FPO, DPOs.

❌ Google does not support autocomplete suggestions for any form of Post Office boxes.

Provides Only Real Addresses

❌ Sadly, Google suggests fake addresses. They take the house or building number at face value and assume the user hasn’t made a mistake typing. Google makes no attempt to correct what the user is typing. Considering that a single street can have thousands of valid shipping addresses, this can make actually finding an address suggested by Google, impossible.

Consider this example: James Smith in unit 6083 of Willis Tower is trying to order his inflatable cat unicorn horn again after his first order got lost in the mail.

He wants to put in his valid address:

233 S Wacker Dr Chicago, IL

But his hairless sphynx Princess Celestia walks across his keyboard.

As a result, he enters an entirely invalid address like this:

Google Places Autocomplete Example

And Google displays it as a valid suggestion. James doesn’t realize what is going on and clicks the result.

Now, you might say “Well, since Google validates the apartment number, the invalid address will get kicked out as soon as the user adds the apartment number. Right?”

And to that I would respond, “Remember, Google doesn’t validate apartment numbers. Seriously. We just barely covered this!” Then, I would tell you to “Read the Secondary Unit Designators section of this article again”.

That unicorn horn is as good as lost all over again. Princess Celestia is going to be inconsolable.

Special Considerations

There are some additional items you should be aware of when considering using Google’s autocomplete tool. Google’s Terms of Service requires you to put the autocomplete form on a public page. So, if you need to use an address autocomplete behind a login page or on an internal form, you might run into problems.

As a final note, even though it is not called the “Google Maps autocomplete”; Google still requires you to use their autocomplete API with a Google map. The other option is to display their “Powered by Google” branding.

Google address validation requirements

So, if that is a deal breaker, it is time to look at the next provider.

Algolia Address Autocomplete API

The Algolia community has created an open source project for address autocomplete. To do this, they have leveraged the open source database of OpenStreetMaps. With Algolia, you get an open-source based tool, at a price. This makes for an enormous data library that rivals Google and can be useful for international addresses and landmarks. So, how does Algolia measure up to our 5 considerations?

Geolocation

❌ The Algolia address autocomplete tool does not use geolocation. It starts making suggestions from the first keystroke but it does not use geolocation to determine which suggestions to display. As a result, users will see addresses from all over the world.

This requires users to enter more keystrokes on average to get the correct address. Let’s say a user wants to enter an address into an application using the Algolia autocomplete API.

The user starts typing this address:

863 South 770 East
Spanish Fork, UT

Algolia ignores the house number. As a result, we have to enter 5 keystrokes before we even start getting results in the right state. And after 13 keystrokes, the user’s address still isn’t displayed as an option.

Algolia autocomplete examples

This is fine if a user is using autocomplete to just display a city name. But, if you need to get a specific address, other providers will display it in fewer keystrokes than does Algolia.

Secondary Unit Designators

❌ Algolia’s autocomplete does not display apartment numbers. If a user starts to type an apartment number, the tool gets confused and starts serving less accurate information. You are forced into a suboptimal solution such as adding an extra unit number box that may be forgotten.

PO Boxes, APOs, FPO, DPOs.

❌ In reality, Algolia is primarily a mapping API. This open source project won’t populate results with post office box information of any kind.

Standardizing & Validation

❌ Algolia is not an address validation company and all of their data comes from volunteers. They are happy to take whatever information they can get, and from wherever they can. So, you run into the same issues as with Google’s autocomplete API. Both of them will provide you with inconsistent and invalid information.

Provides Only Real Addresses

❌ Algolia will suggest fake addresses as a user is typing. Similar to Google’s API, Algolia assumes the user is not entering a typo when they enter a house number. Algolia considers any house number a user enters as valid. They will predict results based on the rest of the street address. Here is a screenshot where Algolia predicts 5 addresses and not one of them are real addresses.

Algolia API Autocomplete Invalid Building Number Example

In reality, No address in the city of Spanish Fork contains the sequence “8632”.

Algolia Places uses a huge database of information. Depending on your use case, what they offer can work extremely well. If you only need landmarks or ballpark accuracy for your application they can offer an inexpensive service that will get the job done. As long as you are looking for general information, Algolia does autocomplete really well. If you need front door accuracy, we suggest looking elsewhere.

SmartyStreets US Autocomplete Pro API

SmartyStreets has been in the address validation game for a decade, and recently released a new, beefy version of our Address US Autocomplete Pro API. This API is front door accurate, fast and reliable. So, how does the SmartyStreets Autocomplete API do with our 5 considerations? Let’s find out.

Geolocation

✅ The SmartyStreets US Autocomplete Pro API uses geolocation to return relevant results from the first keystroke. So, when a user types in “863” they are served with results that are near the city in which the user is located. Oftentimes, this results in the relevant address being suggested within the first 5-6 keystrokes of a user’s search.

Check it out:

Fast Address Autocomplete API

Secondary Unit Designators

✅ The SmartyStreets US Autocomplete Pro API handles secondary unity designators. It uses the official USPS database for address suggestions. This means that if an address can get mail, it can be predicted with our API. Suggested addresses will display floor numbers, apartment numbers, unit numbers & suites in an easy-to-understand format. So, if a user types in the address of an apartment building, the SmartyStreets autocomplete tool will also provide a list of unit numbers in that apartment building.

This is how Apartments work with our API:

Address Autocomplete API with Building Numbers

Standardizing & Validation

✅ The SmartyStreets US Autocomplete Pro API standardizes and validates addresses. SmartyStreets is an address validation company. It would be pretty silly for us to not offer standardization and validation with our autocomplete API. And, all of our addresses are collected and updated by trained professionals.

Better yet, the database information is updated every month. Our results are always provided in the USPS standardized format. When coupled with our US Street Address API, we can also provide ZIP+4 Codes, and 45 points of metadata. None of the other providers mentioned in this article do that.

PO Boxes, APOs, FPO, DPOs.

✅ The SmartyStreets US Autocomplete Pro API handles PO Boxes, APOs, FPOs and DPOs. Our address autocomplete API offers auto suggestions for PO Boxes closest to the user and will also autocomplete any address that the USPS delivers to, including APOs, FPOs and DPOs.

Provides Only Real Addresses

✅ One advantage of the SmartyStreets US Autocomplete Pro API is that it suggests ONLY valid addresses. Full Stop. No caveats or exceptions. A user must put in a valid house number in order to get their address to show up in the prediction list. The best place to make sure an address is correct is with the user themselves. There is no way a user can select an invalid address if they are using the SmartyStreets US Autocomplete Pro API. This saves our users a lot of hassle in the long run.

We at SmartyStreets have worked hard to make accuracy the number one priority of our US Autocomplete Pro API. This is achieved by geolocating and parsing the house number where other providers may ignore this. A lot of brain power has gone into how to handle apartment numbers and PO Boxes.

As a result, we frequently suggest the correct address in 4-6 keystrokes. Other providers require 10-13 or even more keystrokes before they suggest the correct address.

Finally, we have well tested, open-source, and actively developed SDK packages available at no charge to make development easy. Your boss is gonna be so impressed.

We provide the following SDKs for integrating our address autocomplete API:

  • iOS SDK Compatible with
    • Objective-C
    • Swift
  • JavaScript SDK
  • JAVA SDK Compatible with:
    • Android Development
    • Clojure
    • Groovy
    • Scala
    • Kotlin
    • … or any other JVM language.

Service Provider Comparison Table

What a ride! Here is a comparison table for each point we covered above and what each address autocomplete service offers:

Consideration Google Places Autocomplete Algolia Autocomplete SmartyStreets Autocomplete
Geolocation
Secondary Unit Designators
Standardization & Validation
PO Boxes, APOs, FPO, DPOs
Provides Only Real Addresses
Special Considerations Yes No No
Autocomplete Cost $$$$ $ $$

Address Autocomplete API Example

Here’s a tutorial on how the SmartyStreets US Autocomplete Pro API works in its intended context.

  1. A user starts typing their street address into the address form field.
  2. The tool starts by knowing roughly where the user is located. With each keystroke of input, the free demo submits the provided text to the US Autocomplete API.
  3. The US Autocomplete API returns suggestions taken from an index of house-number-street-city-state combinations and populates a dropdown right under the user's cursor.
  4. Once the user recognizes their address among the suggestions in the dropdown menu, they may select it.

You can experience the above behavior for yourself using the free address autocomplete API demo. You will be able to test the user experience. Below that, you will be able to create sample cURL requests to see the API response. And, you can check out our autocomplete documentation for help with customizing your configuration.

Autocomplete Cost

SmartyStreets’ Autocomplete Pro is calculated by keystroke. Each keystroke counts as one lookup. On average, an address is found within 8-10 keystrokes.

Monthly plans start at 20 USD a month for 5000 lookups (0.004 USD per lookup) and range to 500 USD a month for 200,000 lookups (0.0025 per lookup).

Annual plans start at 200 USD a year for 60,000 lookups (0.0033 USD per lookup) and range to 5,000 a year for 2,400,000 lookups (0.0021 per lookup).

Unlimited plans start at 10,000 USD a year for unlimited lookup at a rate of up to 36,000 lookups/hour (0.00003 USD per lookup) and range to $50,000 a year for unlimited lookups with no rate limits.

Assuming an average of 10 keystrokes to find an address, the above monthly pricing ranges would yield a cost of 0.04 USD to 0.025 USD per address autocompleted.

Other autocomplete APIs offer confusing prices. This makes it difficult to determine the actual cost until after you have signed up. Not knowing your price until after you have enrolled can be costly. A company who selected our 25,000 USD annual unlimited plan reported that they were paying over $300,000 a year previously for Google’s autocomplete.

We strive to make our pricing easy to understand. See the pricing page for additional details.

Conclusion

You are now armed with a checklist to aid you in your quest of finding the right autocomplete API for your project. In summary, you want an autocomplete API that:

▢ Geolocates the user to improve address predictions
▢ Provides data on secondary unit numbers
▢ Handles PO Boxes, APOs, FPOs
▢ Standardizes the address
▢ Validates the address
▢ Prevents users from entering fake house numbers

As you’ve seen, there is one API that checks all the above boxes. Try it out here and then, when you are ready, check out our API pricing page and get signed up for an account. You can also chat with our super helpful enterprise team if you are ready to go straight to the big leagues.

The leader in location data intelligence

Ready to get started?