Typeahead
The Typeahead API helps users complete forms and issue better search queries by completing partial search terms.
Request
GET POST https://api.getAddress.io/typeahead/{term}?api-key={api-key}
Example
Request
GET POST https://api.getAddress.io/typeahead/cam?api-key={api-key}
Response
{
[
"Cambridgeshire",
"Camargue",
"Campbell",
"Cambridge",
"Cambs",
"Cambmac"
]
}
Search
Restricts search to specific fields.
All possible search fields:
{
"search":["postcode", "locality", "town_or_city", "district", "county", "country"]
}
Example:
Restrict search to the postcode field
Request
GET POST https://api.getAddress.io/typeahead/PE?api-key={api-key}
Request Body
{
"search":["postcode"]
}
Response
{
[
"PE10 0AA",
"PE10 0AB",
"PE10 0AD",
"PE10 0AE",
"PE10 0AF",
"PE10 0AG"
]
}
Filter
A filter limits results to specific criteria.
All possible filters
{
"filter":
{
"county":"{county name}",
"locality":"{locality}",
"district":"{district name}",
"town_or_city":"{town or city name}",
"postcode":"{postcode}",
"country":"{country name}"
}
}
Example
Filter county to Cambridgeshire and only search the town_or_city field.
Request
GET POST https://api.getAddress.io/typeahead/c?api-key={api-key}
Request Body
{
"search":["town_or_city"],
"filter":
{
"county":"Cambridgeshire",
}
}
Response
{
[
"Cambridge"
]
}
Optional Parameters
| Property | Default | Description | Type |
| top | 6 | Sets the number of results to retrieve (max 20) | Text |