Addresses
Address Autocomplete
The Address Autocomplete API provides address completions, processing standard addresses through Google Maps Places API.
Region
is an optional parameter that can be used to filter the results to a specific country. The region parameter is a two-letter country code that can be used to filter the results to a specific country. If the region parameter is not provided, the API will return results from all countries.
Request
Parameters
- address
string
(Required)
- The partial address text to be completed.
- Input is automatically sanitized to remove line breaks.
- region
string
(Optional)
- Two-letter country code to filter results (e.g., "US", "CA")
- For US region, it includes territories (PR, VI, GU, MP)
- When omitted, returns worldwide results.
Response
The API returns up to five most relevant autocompletions in a structured format:
Response Fields
- address
string
: Complete formatted address - matched_text
string
: The portion of the address that matched the input - autocomplete_text
string
: The suggested completion text - description
string|null
: Additional context about the address
Usage
When implementing address autocomplete functionality on the frontend, it is essential to incorporate a debouncing mechanism to manage request frequency. This approach ensures that API requests are dispatched at appropriate intervals, thereby mitigating the risk of exceeding account rate limitations.
Many addresses contain supplementary information such as unit numbers, suite designations, or floor identifiers that are not returned through the autocomplete API. When creating shipments
or contacts
, etc., our address API endpoints provide a dedicated field called address_line2
to accommodate this secondary address information. Consequently, it is advisable to incorporate an additional input field in your form specifically designed to capture this supplementary address data.
After receiving data from the address autocompletion endpoint, users typically forward this data along with the address_line2
property to the address parsing API, which then returns the complete PackageX address model for further processing.