The Address Autocomplete API is used to search the AddressFinder database to return closely matching addresses which can then be selected from by the user. This API works in tandem with the Address Metadata API which is used to load the metadata associated with the selected address.
Build the request URL
Use the form below to build your request URL from the parameters. A URL string will be generated from these parameters and sent to the API in order to provide insight into how the API works and the responses it returns.
* Parameters marked with an asterisk are mandatory for this API call.
Request URL
/* Click the button above to see a real API response here */
{
"success": true
}
Response Specification
The API response will contain a hash with an element named completions, which is an array of hashes containing the following fields.
| Field Name | Type | Description | Example |
|---|---|---|---|
a * | String | Canonical address as supplied by Land Information New Zealand or NZ Post. | 184 Williams Street, Kaiapoi 7630 |
pxid * | String | The unique address identifier. | 2-.3.1q.2.4G.4c |
v * | Integer | This is a deprecated field and is only retained for backwards compatibility reasons. You should ignore this field. | 0 |
highlighted_a | String | When highlighting is enabled, contains the full address string with highlighted matching terms. | <span class='af_hl'>184</span> <span class='af_hl'>Will</span>iams Street, Kaiapoi 7630 |
* Attributes marked with an asterisk will always be present in a successful API response.
Errors
Below are the possible errors that can be returned by the API.
| Code | Error | Cause | Resolution |
|---|---|---|---|
1000 | Validation error | Returned when one of the supplied parameters is missing or incorrect. The response will contain a message attribute which explains the cause of the validation error. An example JSON response is shown below for a request which failed to include the q parameter. { | Check that the supplied parameters contain valid values, and that the mandatory parameters have been included. |
1001 | Account key not found | Returned when the key included in your API call cannot be found in our database. This will normally happen when you make a copy ’n paste error. | Compare the key included in your API call with the key listed in the AddressFinder Portal overview page. Also confirm there are no additional spaces or characters in your API call. |
1002 | Account key is missing | Returned when you fail to send through your key with each request. The key is a mandatory parameter. | Check that you are using the correct parameter name key. |
1003 | Invalid domain | Returned when you embed AddressFinder on a website that differs from the domain that you specified in the AddressFinder Portal. | The AddressFinder Portal records the whitelist of allowed domains for your account. Login to the AddressFinder Portal and add the domain of this website to your account. |
1004 | Account secret missing | Returned when you fail to send through your secret with an API call. Can also occur when using the widget and the HTTP Referer header is not included. | Include the secret listed in the AddressFinder Portal overview page in your API call. When using the widget, you must load the page from a web server (e.g. localhost) and not a file:// scheme. |
1005 | API calls require a Paid plan. | Returned if you try to call the API and you are on a Free plan. Free accounts are expected to use the JavaScript Widget only. | Consider upgrading to a Pro plan. Visit the AddressFinder Portal to change plan. A Developer plan is available for customers in development. Contact us to request the necessary plan change |
1006 | Invalid secret value | Returned when the supplied secret value does not match the value stored in our database. This will normally happen when you make a copy ’n paste error. | Compare the secret included in your API call with the secret listed in the AddressFinder Portal overview page. Also confirm there are no additional spaces or characters in your API call. |
1008 | Secret should not be supplied | This is a safety check to ensure that the secret parameter has not been included when making requests from your web browser. You should never include the secret on any web page. | The secret should be used for server-to-server API calls only. |
1009 | Account has been suspended | Returned when your account (Free plans only) has hit its 100% usage limit for the billing period. | Visit the AddressFinder Portal and upgrade your account to a Paid plan. Alternatively wait until the end of the month when suspended accounts are automatically reactivated. |
1011 | Record not found | Returned when the supplied address identifier cannot be found. This can happen when a stale identifier is included in the API call. | Do not save address identifiers in your database, as they are transisent and may change after each database update. |
1014 | Account Disabled | Your account has been disabled by AddressFinder support. | Contact AddressFinder support to reactivate your account. |
1015 | Cannot include domain parameter in a web request | You have included a domain parameter in your browser based API call. | Remove the domain parameter from your API call. |
1017 | This activity is not permitted on your current plan | You have attempted to use an AddressFinder service that is not valid for current plan. | Consider upgrading to a Pro plan. Visit the AddressFinder Portal to change plan. Alternatively Contact us to discuss plan options. |