Google Maps Address Validation API Client

raw JSON →
0.6.0 verified Mon Apr 27 auth: no python

The Google Maps Address Validation API client library provides programmatic access to validate and geocode addresses. Version 0.6.0 requires Python 3.9+ and is part of the google-cloud-python monorepo. Release cadence is irregular, tied to API updates.

pip install google-maps-addressvalidation
error ModuleNotFoundError: No module named 'google.maps.addressvalidation_v1'
cause Missing correct import path. Users often try importing without the version subpackage.
fix
Use: from google.maps.addressvalidation_v1 import AddressValidationServiceClient
error google.api_core.exceptions.PermissionDenied: 403 Request had insufficient authentication scopes.
cause API key is missing or invalid, or ADC is not configured.
fix
Set GOOGLE_API_KEY environment variable or configure ADC via gcloud auth application-default login.
error TypeError: validate_address() missing 1 required positional argument: 'address'
cause Passing address as a positional argument instead of using the request parameter.
fix
Use request=ValidateAddressRequest(address=...) or pass address via the address keyword argument: client.validate_address(address=...)
deprecated The library uses the v1 API, but some fields may be deprecated in future versions. Keep the library updated.
fix Upgrade to latest version when available.
gotcha Authentication requires either an API key set in the GOOGLE_API_KEY environment variable or Application Default Credentials (ADC). Not setting one results in a permission denied error.
fix Set the GOOGLE_API_KEY environment variable or run gcloud auth application-default login.
gotcha The address field in ValidateAddressRequest expects a dictionary with specific keys (e.g., region_code, address_lines). Using wrong keys or nesting returns a validation error.
fix Verify the address dictionary structure matches the PostalAddress protobuf (see documentation).

Quickstart to validate an address using the API. Requires setting GOOGLE_API_KEY environment variable or having ADC configured.

import os
from google.maps.addressvalidation_v1 import AddressValidationServiceClient, ValidateAddressRequest

client = AddressValidationServiceClient()
request = ValidateAddressRequest(
    address={
        'region_code': 'US',
        'locality': 'Mountain View',
        'address_lines': ['1600 Amphitheatre Pkwy']
    },
    previous_response_id='',
    enable_usps_cass=True
)
response = client.validate_address(request=request)
print(response.result.verdict)