Get locations typeahead suggestions scoped by country code (v1)
POST
https://api.casafari.com/api/v1/references/locations/typeaheadBearer token4 parameters
Send Authorization: Bearer $CASAFARI_TOKEN; see how to get a token.
Over MCP: ma_get_location_typeahead (related). MCP and REST compared.
Description
Returns location typeahead suggestions within the given country (ES or PT).
Request body
Content type application/json. Optional. Type: object.
country_codesstring[]requiredCountry codes to scope the search. Supported: ES, PT.
ES PTnamestringrequiredThe location name to search for.
2–100 characters
sizeintegerThe maximum number of suggestions to return. Default 30, maximum 100.
1–100default 30
langstringLanguage to use for the location name in the response. One of: en, pt, es, de.
en pt es dedefault "en"
Example request
Placeholders only: replace the token and the values with your own.
curl -X POST "https://api.casafari.com/api/v1/references/locations/typeahead" \
-H "Authorization: Bearer $CASAFARI_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"country_codes": [
"PT"
],
"name": "lisboa",
"lang": "en",
"size": 30
}'Responses
200 OK
Type: object.
Show the response shape (8 fields)
typeaheadobject[]requiredThe typeahead suggestions.
5 properties
location_idintegerrequiredThe location id.
namestringrequiredThe location name.
matched_namestringrequiredThe matched name of the location name.
at most 256 characters
administrative_levelstringrequiredThe administrative level.
breadcrumbsobject[]requiredLocation breadcrumbs sorted from top to bottom.
2 properties
location_idintegerrequiredLocation ID.
namestringrequiredThe name of location.
Example from the API description
{
"typeahead": [
{
"location_id": 1296,
"name": "Lisboa",
"matched_name": "Lisboa",
"administrative_level": "Distrito",
"breadcrumbs": [
{
"location_id": 499,
"name": "Portugal"
},
{
"location_id": 1296,
"name": "Lisboa"
}
]
}
]
}401 Unauthorized
Type: object.
Show the response shape (1 fields)
detailstringDescription of the error encountered.
403 Forbidden
Type: object.
Show the response shape (1 fields)
detailstringDescription of the error encountered.