Skip to main content

client.retrieve_address

Retrieve Address

Returns the full address for an autocomplete suggestion id.

This is the charged step of address autocomplete. A successful retrieval decrements your lookup balance. An id which resolves to no address returns 404.

Every address comes back in one US-shaped format, whatever country or dataset it came from: up to two address lines and US field names such as zip_code, state and city.

Endpoint​

GET /autocomplete/addresses/{address}/usa

See the API reference for this endpoint.

Signature​

def retrieve_address(address, licensee: nil, filter: nil, tags: nil, remove_firm: nil)

Arguments​

NameTypeRequiredDescription
addressStringyesID of address suggestion
keywordskeyword argumentsnoOne per query parameter, named as the API names them. A keyword left out or nil is not sent.

Query Parameters​

Pass these as keyword arguments.

NameTypeRequiredDescription
licenseeStringnoLicensee Key
filterString, Array<String>noRestrict Result Fields
tagsString, Array<String>noTags
remove_firmStringnoRemove Firm

Response​

AddressZen::Responses::UsaResolveAddressResponse. Read fields with readers named as the API names them, such as response.result, or with response["result"]. to_h returns the decoded body.

Errors​

An HTTP error raises AddressZen::ApiError with the HTTP status, the API error code and the decoded body. A transport failure raises AddressZen::TransportError. See error handling.

Example​

retrieve-address.rbruby
require "addresszen"

client = AddressZen::Client.new(api_key: "ak_test")

response = client.retrieve_address("usps_Z108703633|123||1119")

address = response.result

puts address.line_1
puts address.last_line