Places UI Kit: A ready-to-use library that provides room for customization and low-code development. Try it out, and share yourinput on your UI Kit experience.

Validate an address

To validate an address using Address Validation in Maps JavaScript API, call thefetchAddressValidation method passing a request body with the address to validate, as shown in the following example.

asyncfunctionvalidateAddress(){// Import the Address Validation library.const{AddressValidation}=awaitgoogle.maps.importLibrary('addressValidation');// Call the fetchAddressValidation method.constresult=awaitAddressValidation.fetchAddressValidation({address:{postalCode:'94043',regionCode:'US',languageCode:'en',addressLines:['1600 Amphitheatre','Parkway'],}});// Log the results to the console.document.querySelector('pre').textContent=JSON.stringify(result,null,'  ');}

You can define an address by using individual components, or by usingaddressLines to pass the entire formatted address as an array literal (the API will parse the address into individual components):

address:{addressLines:['1600 Amphitheatre Parkway, Mountain View, CA 94043'],}

Handle the results

ThefetchAddressValidation method returns a promise that resolves to anAddressValidationResponse object. This object contains the validated address, including any corrections made by the API. You can access the various fields of the response object to determine the validation status of the address. The following example shows how to access the fields of the response object.

asyncfunctionvalidateAddress(){// Import the Address Validation library.const{AddressValidation}=awaitgoogle.maps.importLibrary('addressValidation');// Call the fetchAddressValidation method.constresult=awaitAddressValidation.fetchAddressValidation({address:{postalCode:'94043',regionCode:'US',languageCode:'en',addressLines:['1600 Amphitheatre','Parkway'],}});// Log the results to the console:console.log(`Formatted address:${result.address.formattedAddress}`);console.log(`Entered:${result.verdict.inputGranularity}`);console.log(`Validated:${result.verdict.validationGranularity}`);console.log(`Address complete:${result.verdict.addressComplete}`);console.log(`Has unconfirmed components:${result.verdict.hasUnconfirmedComponents}`);console.log(`Has inferred components:${result.verdict.hasInferredComponents}`);console.log(`Has replaced components:${result.verdict.hasReplacedComponents}`);}

Next steps

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.