Parse an Address
ShipEngine uses machine learning and natural language processing (NLP) to parse addresses data from unstructured text.
Data often enters your system as unstructured text (for example: emails, SMS messages, support tickets, or other documents). ShipEngine's address recognition API saves you from parsing this text and trying to extract the useful data within it. Instead, you can simply send us the unstructured text, and we'll return whatever address data it contains.
Our machine learning models learn and improve over time, so they become more accurate and better at understanding different writing patterns.
IMPORTANT
Endpoint is in Beta
This endpoint is only available on the Advanced plan or higher. It is experimental, and at this moment, not fully supported. Please understand the current capabilities for this endpoint are limited, and you should not expect full functionality.
Example
Let's say you receive an order via email. You can send the text of the email to ShipEngine and it will automatically extract the customer's address. Here's an example:
I need to send a package to my friend Amanda Miller’s house at 525 Winchester Blvd in San Jose (that's california, obviously). The zip code there is 95128.
You could send this text to ShipEngine via the PUT /v1/addresses/recognize
endpoint, and it will recognize the following pieces of information:
Entity Type | Value |
---|---|
person | Amanda Miller |
address | Amanda Miller 525 Winchester Blvd San Jose, CA 95128 |
address_residential_indicator | residential |
address_line1 | 525 Winchester Blvd |
city_locality | San Jose |
state_province | CA |
postal_code | 95128 |
Supported Countries
ShipEngine NLP currently supports English text, and can recognize addresses for the following countries:
- Australia
- Canada
- Ireland
- New Zealand
- United Kingdom
- United States
API Sample
In the API sample below, the response has an overall score of 0.971069... which indicates a 97% confidence that it parsed the text correctly. The score value can help your application programmatically decide if any additional input or verification from your user is needed.
The entities array breaks down the recognized data further into their own individual objects and provides additional scoring on the confidence for each field.
Example Request
Example Response
Already-known fields
You can specify any already-known fields for your address object in the request. This can help you automatically define any known variables you might collect, such as:
- name
- city_locality
- state_province
- postal_code
- country_code
Entity Types
The address recognition API is currently designed to recognize the following types of entities:
Entity Type | Recognized Attributes |
---|---|
address | direction: enumerated string ("from" or "to") name: string company_name: string phone: string address_line1: string address_line2: string address_line3: string city_locality: string state_province: string postal_code: string country_code: string address_residential_indicator: enumerated string ("yes", "no", or "unknown") |
address_line | line: number(usually 1, 2 or 3) value: string (ex: "525 Winchester Blvd") |
city_locality | value: string |
country | name: string value: string |
number | type: enumerated string ("cardial", "ordinal", "or "percentage") value: number |
person | value: string |
phone_number | value: string |
postal_code | value: string |
residential_indicator | value: enumerated string ("yes", "no", or "unknown") |
state_province | name: string (ex: "Texas", "Quebec", "New South Wales") value: string (ex: "TX", "QC", "NSW") country: string (ex: "US", "CA", "AU") |