What is Address Validation? Does Postmen support it?
Postmen API does not support address validation for now as we are still focusing on integrating more carriers for label printing and rates calculation. In this post, I am going to tell you different options for address validation in the market that you can choose from.
What is address validation?
To be precise, address validation is also called address verification, address suggestion or address correction. In general, it refers to Street-level address validation which returns single or multiple address suggestions when you provide a street-level address. Some services will also return if it is a residential or commercial address.
Carriers / Service Provider | Street Level Validation | Countries |
---|---|---|
USPS | ✓ | USA |
UPS | ✓ | USA |
FedEx | ✓ | USA + 44 countries |
Google Places API | ✓ | All |
Why address validation API?
- Decrease chances of delivery delays or undelivered shipments due to an incorrect address entry.
- Reduce additional charge of address correction by the carrier.
USPS Address validation API
USPS offers Address Information API - which covers both street-level address validation and zip/city/state lookup. USPS' street-level Address validation API is called address standardisation
, which returns you back a corrected address when you provide a single street level address.
XML Request
<AddressValidateRequest USERID="XXXXX">
<Address ID="0">
<FirmName />
<Address1 />
<Address2>205 bagwell ave</Address2>
<City>nutter fort</City>
<State>wv</State>
<Zip5></Zip5>
<Zip4></Zip4>
</Address>
</AddressValidateRequest>
XML Response
<AddressValidateResponse>
<Address ID="0">
<Address2>205 BAGWELL AVE</Address2>
<City>NUTTER FORT</City>
<State>WV</State>
<Zip5>26301</Zip5>
<Zip4>4322</Zip4>
</Address>
</AddressValidateResponse>
UPS Address validation API
UPS offers both street-level address validation and zip/city/state lookup for USA addresses similar to USPS. Unlike USPS, street-level validation of UPS return multiple address suggestions instead of just one. The documentation naming for UPS could be confusing, but do refer to Address Validation Street Level API.
Operation Name | Level |
---|---|
Address Validation | zip/city/state Lookup |
Address Validation Street Level | Street Level Validation |
XML Request
<AddressValidationRequest xml:lang="en-US">
<Request>
<TransactionReference>
<CustomerContext>Your Test Case Summary Description</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<RequestAction>XAV</RequestAction>
<RequestOption>3</RequestOption>
</Request>
<AddressKeyFormat>
<AddressLine>AIRWAY ROAD SUITE 7</AddressLine>
<PoliticalDivision2>SAN DIEGO</PoliticalDivision2>
<PoliticalDivision1>CA</PoliticalDivision1>
<PostcodePrimaryLow>92154</PostcodePrimaryLow>
<CountryCode>US</CountryCode>
</AddressKeyFormat>
</AddressValidationRequest>
XML Response
<?xml version="1.0"?>
<AddressValidationResponse>
<Response>
<TransactionReference>
<CustomerContext>Your Test Case Summary Description</CustomerContext>
<XpciVersion>1.0</XpciVersion>
</TransactionReference>
<ResponseStatusCode>1</ResponseStatusCode>
</Response>
<AmbiguousAddressIndicator/>
<AddressClassification>
<Code>0</Code>
<Description>Unknown</Description>
</AddressClassification>
<AddressKeyFormat>
<AddressClassification>
<Code>0</Code>
<Description>Unknown</Description>
</AddressClassification>
<AddressLine>5301-5399 AIRWAY RD</AddressLine>
<Region>SAN DIEGO CA 92154-4806</Region>
<PoliticalDivision2>SAN DIEGO</PoliticalDivision2>
<PoliticalDivision1>CA</PoliticalDivision1>
<PostcodePrimaryLow>92154</PostcodePrimaryLow>
<PostcodeExtendedLow>4806</PostcodeExtendedLow>
<CountryCode>US</CountryCode>
</AddressKeyFormat>
<AddressKeyFormat>
<AddressClassification>
<Code>0</Code>
<Description>Unknown</Description>
</AddressClassification>
<AddressLine>7500-7599 AIRWAY RD</AddressLine>
<Region>SAN DIEGO CA 92154-8300</Region>
<PoliticalDivision2>SAN DIEGO</PoliticalDivision2>
<PoliticalDivision1>CA</PoliticalDivision1>
<PostcodePrimaryLow>92154</PostcodePrimaryLow>
<PostcodeExtendedLow>8300</PostcodeExtendedLow>
<CountryCode>US</CountryCode>
</AddressKeyFormat>
<AddressKeyFormat>
<AddressClassification>
<Code>0</Code>
<Description>Unknown</Description>
</AddressClassification>
<AddressLine>7900-7998 AIRWAY RD</AddressLine>
<Region>SAN DIEGO CA 92154-8309</Region>
<PoliticalDivision2>SAN DIEGO</PoliticalDivision2>
<PoliticalDivision1>CA</PoliticalDivision1>
<PostcodePrimaryLow>92154</PostcodePrimaryLow>
<PostcodeExtendedLow>8309</PostcodeExtendedLow>
<CountryCode>US</CountryCode>
</AddressKeyFormat>
</AddressValidationResponse>
FedEx Address validation API
FedEx address validation is a street-level validation, and does have provie zip/city/state lookup, and covers 45 countries including USA. Similar to UPS, it returns a list of matched addresses when you provide a street-level address. For US / Canada addresses, it will also return whether the address is residential, commercial, mixed or unknown type.
XML Request Street-level Validation
<v4:AddressesToValidate>
<v4:ClientReferenceId>ac vinclis et</v4:ClientReferenceId>
<v4:Contact>
<v4:ContactId>Input Your Information</v4:ContactId>
<v4:PersonName>Input Your Information</v4:PersonName>
<v4:CompanyName>Input Your Information</v4:CompanyName>
<v4:PhoneNumber>Input Your Information</v4:PhoneNumber>
<v4:EMailAddress>Input Your Information</v4:EMailAddress>
</v4:Contact>
<v4:Address>
<v4:StreetLines>Input Your Information</v4:StreetLines>
<v4:City>Input Your Information</v4:City>
<v4:StateOrProvinceCode>Input Your Information</v4:StateOrProvinceCode>
<v4:PostalCode>Input Your Information</v4:PostalCode>
<v4:UrbanizationCode>Input Your Information</v4:UrbanizationCode>
<v4:CountryCode>Input Your Information</v4:CountryCode>
<v4:Residential>0</v4:Residential>
</v4:Address>
</v4:AddressesToValidate>
XML Response Street-level Validation
<v4:AddressResults>
<v4:ClientReferenceId>ac vinclis et</v4:ClientReferenceId>
<v4:State>Input Your Information</v4:State>
<v4:Classification>Input Your Information</v4:Classification>
<v4:EffectiveAddress>
<v4:StreetLines>Input Your Information</v4:StreetLines>
<v4:StreetLines>Input Your Information</v4:StreetLines>
<v4:City>Input Your Information</v4:City>
<v4:StateOrProvinceCode>Input Your Information</v4:StateOrProvinceCode>
<v4:PostalCode>Input Your Information</v4:PostalCode>
<v4:CountryCode>Input Your Information</v4:CountryCode>
</v4:EffectiveAddress>
<v4:ParsedAddressPartsDetail>
<v4:ParsedStreetLine>
<v4:HouseNumber>Input Your Information</v4:HouseNumber>
<v4:StreetName>Input Your Information</v4:StreetName>
<v4:UnitLabel>Input Your Information</v4:UnitLabel>
<v4:UnitNumber>Input Your Information</v4:UnitNumber>
</v4:ParsedStreetLine>
<v4:ParsedPostalCode>
<v4:Base>Input Your Information</v4:Base>
</v4:ParsedPostalCode>
</v4:ParsedAddressPartsDetail>
</v4:AddressResults>
Alternative - Google Places API
Google Places API - Place Autocomplete is a paid API that suggests addresses of countries that Google Map supports. The request is less strict compared to UPS, FedEx or USPS which you can simply pass an input value to return a possible list of addresses.
In the request, you can specify the address type you want Google to return in the response:
geocode
instructs the Place Autocomplete service to return only geocoding results, rather than business results. Generally, you use this request to disambiguate results where the location specified may be indeterminate.address
instructs the Place Autocomplete service to return only geocoding results with a precise address. Generally, you use this request when you know the user will be looking for a fully specified address.establishment
instructs the Place Autocomplete service to return only business results
XML Request Street-level Validation
https://maps.googleapis.com/maps/api/place/autocomplete/xml?input=Paris&types=geocode&key=YOUR_API_KEY
XML Response Street-level Validation
<?xml version="1.0" encoding="UTF-8"?>
<AutocompletionResponse>
<status>OK</status>
<prediction>
<description>Paris, France</description>
<type>locality</type>
<type>political</type>
<type>geocode</type>
<place_id>ChIJD7fiBh9u5kcRYJSMaMOCCwQ</place_id>
<reference>CiQRAAAAJm0CiCHIC8C4GOjREdm3QtHYhMyFaUXKWAbGSaZImQ8SECnHAhpcuZaoSr0_TKfeHvwaFHMIq_BmUccTC4mt6EWVNMa67Xuq</reference>
<id>691b237b0322f28988f3ce03e321ff72a12167fd</id>
<term>
<value>Paris</value>
<offset>0</offset>
</term>
<term>
<value>France</value>
<offset>7</offset>
</term>
<matched_substring>
<offset>0</offset>
<length>5</length>
</matched_substring>
</prediction>
<prediction>
<description>Paris, TX, United States</description>
<type>colloquial_area</type>
<type>political</type>
<type>geocode</type>
<place_id>ChIJrU3KAHG6EmsR5Uwfrk7azrI</place_id>
<reference>CiQcAAAArNRoGmiHh0PNVH5LSnJEbT5L7DfUE-APvTfYac9Ta5USEIfAOzXTkqTpioZX9qeevY8aFPgN_H6qcRnGLqPUq4zkOE-_g-ul</reference>
<id>029556239a911839382f42ec36c5ce2b85be9be3</id>
<term>
<value>Paris</value>
<offset>0</offset>
</term>
<term>
<value>TX</value>
<offset>7</offset>
</term>
<term>
<value>United States</value>
<offset>11</offset>
</term>
<matched_substring>
<offset>0</offset>
<length>5</length>
</matched_substring>
</prediction>
<prediction>
<description>Paris, Ontario, Canada</description>
<type>locality</type>
<type>political</type>
<type>geocode</type>
<place_id>ChIJCfeffMi5EmsRp7ykjcnb3VY</place_id>
<reference>CiQaAAAApuD3Th6N5_EcJjKw0umu_IonagFPBo9idTf7WB8-cw8SEGS5wSvHzhuUvCqPH-uM5B8aFIedLGNSuh5M5eqWdBJCtc0Ibvd0</reference>
<id>e7ac9c89d4a590305242b0cb5bf43064027223c9</id>
<term>
<value>Paris</value>
<offset>0</offset>
</term>
<term>
<value>Ontario</value>
<offset>7</offset>
</term>
<term>
<value>Canada</value>
<offset>16</offset>
</term>
<matched_substring>
<offset>0</offset>
<length>5</length>
</matched_substring>
</prediction>
</AutocompletionResponse>
Why doesnt Postmen support Address Validation?
Just not the right timing. And if you need one, simply use USPS/UPS for USA ones, and FedEx/Google one for international addresses. Do note that Google places APIs is a paid service.