Skip to content
Get started

Get Autocomplete Previews

address_verification.get_autocomplete_previews(AddressVerificationGetAutocompletePreviewsParams**kwargs) -> AddressVerificationGetAutocompletePreviewsResponse
GET/v1/addver/completions

Returns address completion previews for a partial street address, suitable for populating an autocomplete dropdown without consuming a lookup per keystroke.

Each result contains a partial address preview (street, city, and — for non-US addresses — only the first 3 digits of the postal code, to avoid revealing the full code before a lookup is charged).

  • Does not consume a lookup.
  • Use POST /completions to resolve a full address once the user selects a result.
ParametersExpand Collapse
partial_street: str
city_filter: Optional[str]
country_filter: Optional[str]
filter_exact: Optional[bool]
limit: Optional[int]
pc_filter: Optional[str]
proper_case: Optional[bool]
prov_instead_of_pc: Optional[bool]
state_filter: Optional[str]
verified_only: Optional[bool]
ReturnsExpand Collapse
class AddressVerificationGetAutocompletePreviewsResponse:
data: List[Data]
preview: DataPreview

A partial view of the address, suitable for display in an autocomplete dropdown.

address: str

The street address line.

city: Optional[str]

The city.

pc: Optional[str]

For US addresses, the full postal code. For non-US addresses, only the first 3 digits are returned to avoid consuming a lookup.

prov: Optional[str]

The province or state abbreviation. Returned instead of pc when provInsteadOfPC=true.

message: str
status: Literal["success", "error"]
One of the following:
"success"
"error"

Get Autocomplete Previews

import os
from postgrid import PostGrid

client = PostGrid(
    address_verification_api_key=os.environ.get("POSTGRID_ADDRESS_VERIFICATION_API_KEY"),  # This is the default and can be omitted
)
response = client.address_verification.get_autocomplete_previews(
    partial_street="partialStreet",
)
print(response.data)
{
  "data": [
    {
      "preview": {
        "address": "address",
        "city": "city",
        "pc": "pc",
        "prov": "prov"
      }
    }
  ],
  "message": "message",
  "status": "success"
}
Returns Examples
{
  "data": [
    {
      "preview": {
        "address": "address",
        "city": "city",
        "pc": "pc",
        "prov": "prov"
      }
    }
  ],
  "message": "message",
  "status": "success"
}