Address Validation (beta)

AddressValidation class

google.maps.addressValidation.AddressValidation class

Static class for accessing the AddressValidation APIs.

Access by calling const {AddressValidation} = await google.maps.importLibrary("addressValidation").
See Libraries in the Maps JavaScript API.

BetafetchAddressValidation
fetchAddressValidation(request)
Parameters: 
Return Value:  Promise<AddressValidation>
Betaaddress
Type:  Address optional
Information about the address itself as opposed to the geocode.
Betageocode
Type:  Geocode optional
Information about the location and place that the address geocoded to.
Betametadata
Type:  AddressMetadata optional
Other information relevant to deliverability. metadata is not guaranteed to be fully populated for every address sent to the Address Validation API.
BetaresponseId
Type:  string optional
The UUID that identifies this response. If the address needs to be re-validated, this UUID must accompany the new request.
BetauspsData
Type:  USPSData optional
Extra deliverability flags provided by USPS. Only provided in region US and PR.
Betaverdict
Type:  Verdict optional
Overall verdict flags
BetatoJSON
toJSON()
Parameters:  None
Return Value:  Object
Converts the AddressValidation class to a JSON object with the same properties.

AddressValidationRequest interface

google.maps.addressValidation.AddressValidationRequest interface

Request interface for BetaAddressValidation.fetchAddressValidation.

Betaaddress
The address being validated. Unformatted addresses should be submitted via PostalAddress.addressLines.
BetapreviousResponseId optional
Type:  string optional
This field must not be set for the first address validation request. If more requests are necessary to fully validate a single address (for example if the changes the user makes after the initial validation need to be re-validated), then each followup request must populate this field with the BetaAddressValidation.responseId from the very first response in the validation sequence.
BetauspsCASSEnabled optional
Type:  boolean optional
Enables USPS CASS compatible mode. This affects only the BetaAddressValidation.uspsData field of AddressValidation. Note: for USPS CASS enabled requests for addresses in Puerto Rico, a PostalAddress.regionCode of the address must be provided as "PR", or an PostalAddress.administrativeArea of the address must be provided as "Puerto Rico" (case-insensitive) or "PR".

Address class

google.maps.addressValidation.Address class

Details of the post-processed address. Post-processing includes correcting misspelled parts of the address, replacing incorrect parts, and inferring missing parts.

Access by calling const {Address} = await google.maps.importLibrary("addressValidation").
See Libraries in the Maps JavaScript API.

Betacomponents
The individual address components of the formatted and corrected address, along with validation information. This provides information on the validation status of the individual components.
BetaformattedAddress
Type:  string optional
The post-processed address, formatted as a single-line address following the address-formatting rules of the region where the address is located.
BetamissingComponentTypes
Type:  Array<string>
The types of components that were expected to be present in a correctly formatted mailing address but were not found in the input AND could not be inferred. Components of this type are not present in formatted_address, postal_address, or address_components. An example might be ['street_number', 'route'] for an input like "Boulder, Colorado, 80301, USA". The list of possible types can be found here.
BetapostalAddress
Type:  PostalAddress optional
The post-processed address represented as a postal address.
BetaunconfirmedComponentTypes
Type:  Array<string>
The types of the components that are present in the address_components but could not be confirmed to be correct. This field is provided for the sake of convenience: its contents are equivalent to iterating through the address_components to find the types of all the components where the BetaAddressComponent.confirmationLevel is not BetaConfirmationLevel.CONFIRMED or the BetaAddressComponent.inferred flag is not set to true. The list of possible types can be found here.
BetaunresolvedTokens
Type:  Array<string>
Any tokens in the input that could not be resolved. This might be an input that was not recognized as a valid part of an address (for example in an input like "123235253253 Main St, San Francisco, CA, 94105", the unresolved tokens may look like ["123235253253"] since that does not look like a valid street number.

AddressComponent class

google.maps.addressValidation.AddressComponent class

Represents a single component of an address (ex. street name, city).

Access by calling const {AddressComponent} = await google.maps.importLibrary("addressValidation").
See Libraries in the Maps JavaScript API.

Beta