Autocomplete Endpoint
The Autocomplete API provides instant place and address suggestions based on partial user input. It is typically used in search boxes where results update in real time.
How it Works
- Send a partial query (
text
) such as"YMCA"
. - The API returns a list of matching places (venues, streets, cities, etc.) with coordinates and metadata.
- You can restrict search by location using boundary parameters.
- Important: You must include a valid
token
parameter in the request.
If missing or invalid, the API will return401 Token required
.
Endpoint
GET https://gateway.mapmetrics-atlas.net/autocomplete
Parameters
Search API Parameters
Parameter | Type | Req | Example | Description |
---|---|---|---|---|
text | string | ✅ | Union Square | The search query text. |
token | string (auth token) | ✅ | abcd1234 | Required authentication token, otherwise request returns 401 Token required . |
focus.point.lat | float | ❌ | 48.581755 | Latitude for search focus. |
focus.point.lon | float | ❌ | 7.745843 | Longitude for search focus. |
boundary.rect.min_lon | float | ❌ | 139.2794 | Minimum longitude of bounding box. |
boundary.rect.max_lon | float | ❌ | 140.1471 | Maximum longitude of bounding box. |
boundary.rect.min_lat | float | ❌ | 35.53308 | Minimum latitude of bounding box. |
boundary.rect.max_lat | float | ❌ | 35.81346 | Maximum latitude of bounding box. |
boundary.circle.lat | float | ❌ | 43.818156 | Circle boundary center latitude. |
boundary.circle.lon | float | ❌ | -79.186484 | Circle boundary center longitude. |
boundary.circle.radius | float | ❌ | 35 | Circle radius (in kilometers). |
sources | string (comma-separated) | ❌ | openstreetmap,wof | Data sources to include. |
layers | string (comma-separated) | ❌ | address,venue | Feature layers to include. |
boundary.country | string (comma-separated) | ❌ | GBR,FRA | ISO country codes to limit search. |
boundary.gid | Pelias gid | ❌ | whosonfirst:locality:101748355 | Restrict results to a specific boundary by gid. |
size | integer | ❌ | 20 | Number of results to return. |
Example
bash
GET https://gateway.mapmetrics-atlas.net/autocomplete/?text=YMCA&boundary.circle.lon=-79.186484&boundary.circle.lat=43.818156&boundary.circle.radius=35&token=YOUR_API_KEY
Example Response
json
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-78.861037, 43.900526]
},
"properties": {
"name": "Durham Family YMCA",
"country": "Canada",
"region": "Ontario",
"locality": "Oshawa",
"label": "Durham Family YMCA, Oshawa, ON, Canada"
}
}
]
}