Skip to content
Get started

Lookup Zip Code From City Or State

address_verification.lookup_zip_code_from_city_or_state(AddressVerificationLookupZipCodeFromCityOrStateParams**kwargs) -> AddressVerificationLookupZipCodeFromCityOrStateResponse
POST/v1/addver/zip_codes

Looks up all ZIP codes that correspond to a given US city and state.

  • Currently only supported for US addresses (countryCode: "US").
  • Uses 1 lookup.
ParametersExpand Collapse
city: str

The city name.

country_code: str

The country code. Currently only US is supported.

state: str

The state abbreviation (e.g. NY).

ReturnsExpand Collapse
class AddressVerificationLookupZipCodeFromCityOrStateResponse:
data: Data
zip_codes: List[str]
message: str
status: Literal["success", "error"]
One of the following:
"success"
"error"

Lookup Zip Code From City Or State

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.lookup_zip_code_from_city_or_state(
    city="city",
    country_code="countryCode",
    state="state",
)
print(response.data)
{
  "data": {
    "zipCodes": [
      "string"
    ]
  },
  "message": "message",
  "status": "success"
}
Returns Examples
{
  "data": {
    "zipCodes": [
      "string"
    ]
  },
  "message": "message",
  "status": "success"
}