ValidateAddress
Overview
The Validate Address endpoint is designed to return and validate an address based on a complete address input. It will provide details of the address match, how the matched address differs from the given input and a suggested action based on how well the address has matched.
API Endpoint
The endpoint for the Validate Address API is as follows:
https://api.autoaddress.com/3.0/validateaddress
Request
To retrieve results from the ValidateAddress API, a simple GET request from your preferred programming language is required. Please note that the request must be authenticated. For detailed information on authentication, refer to the API Authentication documentation.
Input Fields
Name | Type | Description |
---|---|---|
| string | Access token obtained from the Create Token endpoint. |
| string | Comma separated address elements up to street level |
country | string | Country of the address |
region | string | Region of the address |
city | string | City/Town of the address |
language | string | Language to return result in. |
* Required Field
cURL Example
Below is an example of a cURL request to the Validate Address API:
curl --location 'https://api.autoaddress.com/3.0/validateaddress?addressLine=25 castle park&city=carrick-on suir&country=IE&language=en®ion=tipperary&token=your_token'
Response
The following is a sample JSON response returned for a Get Data API request:
{
"type": "validateaddress",
"action": "Accept",
"message": {
"text": "This is a valid address or something like that",
"severity": "information"
},
"information": {
"postcodeChanged": false,
"addressChanged": true,
"incomplete": false,
"matchLevel": "Building",
"matched": true
},
"input": {
"lines": [
{
"key": "AddressLine1",
"value": "25 castle park"
}
],
"city": {
"value": "carrick-on-suir"
},
"region": {
"value": "tipperary"
},
"postcode": {
"value": ""
},
"country": {
"language": "en",
"value": "Ireland",
"iso": "IE"
},
"label": [
"25 castle park",
"carrick-on-suir",
"Co. Tupperary"
]
},
"address": {
"id": "IE1701616389",
"language": "en",
"charset": "Latn",
"variation": "V",
"lines": [
{
"key": "AddressLine1",
"value": "25 Castle Park"
}
],
"city": {
"value": "Carrick-On-Suir"
},
"region": {
"value": "Tipperary"
},
"postcode": {
"value": "E32 E367"
},
"country": {
"language": "en",
"value": "Ireland",
"iso": "IE"
},
"label": [
"25 Castle Park",
"Carrick-On-Suir",
"Co. Tipperary",
"E32 E367"
],
"highlights": [
[],
[],
[
4,
5
],
[]
]
},
"links": [
{
"rel": "self",
"href": "https://api.autoaddress.com/3.0/validateaddress?addressLine=25 castle park&city=carrick-on-suir&country=IE&language=en®ion=tipperary&token=your_token",
"title": "self"
}
]
}
Output Fields
Name | Type | Description |
---|---|---|
| string | Name of the response type. |
action | string | Suggested action based on the match results. Possible actions are; Accept, Reject, Suggest, Confirm. |
| Message | A Message object (described below). |
information | Information | Details of the match results. |
input | Input | Details of the input information. |
| Address | Address object containing the matched address |
| Links[] | An array of Link objects (described below). |
Message Object
Name | Type | Description |
---|---|---|
| int | Message ID. |
| string | Language of the message. |
| string | Value of the message. |
Information Object
Name | Type | Description |
---|---|---|
| bool | Determines if the input postcode is different to the matched postcode |
| bool | Determines if the input address is different to the matched address |
| bool | Determines if the matched address is fully matched or only partially matched |
matchLevel | string | Determines what level the given address has been matched at |
matched | bool | Determines if the service has made a match from the given address |
Input Object
Name | Type | Description |
---|---|---|
| Value[] | Array of address elements up to street level received by input |
| Value | City given as input |
| Value | Region given as input |
country | Value | Country given as input |
label | string[] | Array of all given address elements |
Address Object
Name | Type | Description |
---|---|---|
id | string | Autoaddress ID of the address |
language | string | Primary language for the address |
charset | string | Character set the address is in |
lines | Value[] | Key/value pairs for each line of the address |
city | Value | Value object containing the city the address is located in |
region | Value | Value object containing the region the address is located in |
postcode | Value | Value object containing the post code associated with the address |
country | Country | A Country object (described below) |
label | string[] | An array of labels containing each part of the address |
highlights | string[] | Suggestion for which characters in the label object to highlight when displaying to the user |
Links Object
Name | Type | Description |
---|---|---|
| string | Type of link. |
| string | The hyperlink the client should follow is stored in the value of this property. |
| string | Display name of the link. |
Examples
jQuery Example
var settings = {
"url": "https://api.autoaddress.com/3.0/validateaddress?addressLine=25 castle park&city=carrick-on suir&country=IE&language=en®ion=tipperary&token=your_token",
"method": "GET",
"timeout": 0,
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Ruby Example
require "uri"
require "net/http"
url = URI("https://api.autoaddress.com/3.0/validateaddress?addressLine=25 castle park&city=carrick-on suir&country=IE&language=en®ion=tipperary&token=your_token")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Get.new(url)
request["User-Agent"] = "Ruby application"
response = https.request(request)
puts response.read_body
Python Example
import requests
url = "https://api.autoaddress.com/3.0/validateaddress?addressLine=25 castle park&city=carrick-on suir&country=IE&language=en®ion=tipperary&token=your_token"
payload = {}
headers = {
'User-Agent': 'Python application'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
C# Example
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.autoaddress.com/3.0/validateaddress?addressLine=25 castle park&city=carrick-on suir&country=IE&language=en®ion=tipperary&token=your_token");
request.Headers.Add("User-Agent", ".NET application");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());