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.
Import
from addresszen import AddressZenCall retrieve_address on the AddressZen client. Path parameters are positional; query and body parameters are keyword-only.
Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
address | str | yes | ID of address suggestion ID of address suggestion provided by the API to fully retrieve. |
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
licensee | str | no | Licensee Key Uniquely identifies a licensee. |
filter | str | no | Restrict Result Fields Comma separated whitelist of address elements to return. E.g. filter=line_1,line_2,line_3 returns only the line_1, line_2 and line_3 address elements in your response. |
tags | str | no | Tags A comma separated list of tags to query over. Useful if you want to specify the circumstances in which the request was made. If you specify multiple tags, the response comprises only requests that satisfy all of them. Searching "foo,bar" queries only requests tagged both "foo" and "bar". |
remove_firm | Literal['true'] | str | no | Remove Firm Removes firm names from the address lines (line_1, line_2, ...). Outside the USA this covers organization and department names. Remaining lines move up. Useful when delivering to people rather than businesses. Set remove_firm=true to enable. Firm fields and the native record are unchanged. If removing the firm would leave no address lines, it is kept and the lines are returned unchanged. Building names are not removed. |
Response Type
from addresszen.types import RetrieveAddressResultWith filter, returns dictionaries of the requested fields instead of models.
Errors
Unsuccessful HTTP responses raise APIError or a subclass, with the HTTP status and the API error code and message. Connection failures and timeouts raise TransportError. Unexpected responses raise ProtocolError. All derive from ClientError. A result that does not match the spec is returned unvalidated with a ResponseValidationWarning. See error handling.
Example
from addresszen import AddressZen
with AddressZen("ak_test") as client:
address = client.retrieve_address("usps_Z108703633|123||1119")