Place Autocomplete
Get place autocomplete suggestions based on search query. Alternative to Google Places Autocomplete API. This API return place with geolocation coordinates.
Endpoint
Get place autocomplete suggestions based on search query
POSThttps://api.xtartapp.com/place/autocomplete
*Authentication
You must use a Bearer token provided by the dashboard to use for authentication. Add the token to the Authorization header.
Request body
Name | Type | Required | Max | Description |
---|---|---|---|---|
query | string | Yes | - | The search query string to find places. Must be less than 100 characters. |
countries | string[] | No | - | Optional array of country codes to limit the search to specific countries, example: ['US', 'CA', 'CI'] |
language | string | No | - | Optional preferred language for the results, example: 'en', 'fr', 'es' |
limit | number | No | - | Optional maximum number of results to return, example: 10 |
Response
Name | Type | Description |
---|---|---|
data | array | Array of place suggestions |
data[].placeId | string | Unique identifier for the place |
data[].type | string | The type of location (e.g. node, way, etc) |
data[].name | string | Full formatted name/address of the place |
data[].lat | number | Latitude coordinate of the place |
data[].lng | number | Longitude coordinate of the place |
data[].country | string | Country where the place is located |
data[].tags | string[] | Array of tags/categories describing the place |
metadata | object | Metadata about the request |
metadata.cost | number | Cost of the request |
metadata.count | number | Number of results returned |
Errors
{
"error": "string",
"code": "string"
}
HTTP Status | Error Code | Message |
---|---|---|
400 | INVALID_PAYLOAD | The query parameter is required |
400 | INVALID_PAYLOAD | The query parameter must be a string |
400 | INVALID_PAYLOAD | The query parameter must be less than 100 characters |
400 | INVALID_PAYLOAD | The country parameter must be an array |
400 | INVALID_PAYLOAD | The language parameter must be a string |
400 | REQUEST_ERROR | The request failed |
400 | INSUFFICIENT_BALANCE | The user has insufficient balance |
401 | UNAUTHORIZED | The token is invalid. |
429 | TOO_MANY_REQUESTS | The request limit has been reached. |