Autocomplete Locations
curl --request GET \
--url https://api.example.com/api/v1/operations/autocomplete/locations \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/api/v1/operations/autocomplete/locations"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/api/v1/operations/autocomplete/locations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/operations/autocomplete/locations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/operations/autocomplete/locations"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/operations/autocomplete/locations")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/operations/autocomplete/locations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"content": [
{
"id": "loc_sf_001",
"name": "San Francisco",
"countryName": "United States",
"countryCode": "US",
"stateName": "California",
"stateCode": "CA",
"rawAddress": "San Francisco, California, United States",
"position": {
"lng": -122.4194,
"lat": 37.7749
}
},
{
"id": "loc_sj_001",
"name": "San Jose",
"countryName": "United States",
"countryCode": "US",
"stateName": "California",
"stateCode": "CA",
"rawAddress": "San Jose, California, United States",
"position": {
"lng": -121.8863,
"lat": 37.3382
}
}
],
"totalElements": 156,
"totalPages": 7,
"size": 25,
"number": 0,
"first": true,
"last": false,
"empty": false,
"numberOfElements": 25
}
{
"content": [
{
"id": "loc_berlin_001",
"name": "Berlin",
"countryName": "Germany",
"countryCode": "DE",
"stateName": "Berlin",
"stateCode": "BE",
"rawAddress": "Berlin, Germany",
"position": {
"lng": 13.405,
"lat": 52.52
}
},
{
"id": "loc_munich_001",
"name": "Munich",
"countryName": "Germany",
"countryCode": "DE",
"stateName": "Bavaria",
"stateCode": "BY",
"rawAddress": "Munich, Bavaria, Germany",
"position": {
"lng": 11.582,
"lat": 48.1351
}
}
],
"totalElements": 89,
"totalPages": 4,
"size": 25,
"number": 0,
"first": true,
"last": false,
"empty": false,
"numberOfElements": 25
}
{
"content": [],
"totalElements": 0,
"totalPages": 0,
"size": 25,
"number": 0,
"first": true,
"last": true,
"empty": true,
"numberOfElements": 0
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Unauthorized"
}
}
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}
}
Autocomplete
Autocomplete Locations
Search and retrieve location suggestions for geographic filtering of leads and companies
GET
/
api
/
v1
/
operations
/
autocomplete
/
locations
Autocomplete Locations
curl --request GET \
--url https://api.example.com/api/v1/operations/autocomplete/locations \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/api/v1/operations/autocomplete/locations"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/api/v1/operations/autocomplete/locations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/operations/autocomplete/locations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/operations/autocomplete/locations"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/operations/autocomplete/locations")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/operations/autocomplete/locations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"content": [
{
"id": "loc_sf_001",
"name": "San Francisco",
"countryName": "United States",
"countryCode": "US",
"stateName": "California",
"stateCode": "CA",
"rawAddress": "San Francisco, California, United States",
"position": {
"lng": -122.4194,
"lat": 37.7749
}
},
{
"id": "loc_sj_001",
"name": "San Jose",
"countryName": "United States",
"countryCode": "US",
"stateName": "California",
"stateCode": "CA",
"rawAddress": "San Jose, California, United States",
"position": {
"lng": -121.8863,
"lat": 37.3382
}
}
],
"totalElements": 156,
"totalPages": 7,
"size": 25,
"number": 0,
"first": true,
"last": false,
"empty": false,
"numberOfElements": 25
}
{
"content": [
{
"id": "loc_berlin_001",
"name": "Berlin",
"countryName": "Germany",
"countryCode": "DE",
"stateName": "Berlin",
"stateCode": "BE",
"rawAddress": "Berlin, Germany",
"position": {
"lng": 13.405,
"lat": 52.52
}
},
{
"id": "loc_munich_001",
"name": "Munich",
"countryName": "Germany",
"countryCode": "DE",
"stateName": "Bavaria",
"stateCode": "BY",
"rawAddress": "Munich, Bavaria, Germany",
"position": {
"lng": 11.582,
"lat": 48.1351
}
}
],
"totalElements": 89,
"totalPages": 4,
"size": 25,
"number": 0,
"first": true,
"last": false,
"empty": false,
"numberOfElements": 25
}
{
"content": [],
"totalElements": 0,
"totalPages": 0,
"size": 25,
"number": 0,
"first": true,
"last": true,
"empty": true,
"numberOfElements": 0
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Unauthorized"
}
}
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}
}
Provides autocomplete suggestions for location-based filters used in lead and company search. This endpoint powers the autocomplete functionality in location filter dropdowns, helping users discover valid geographic locations including cities, states, and countries.
Authentication
This endpoint requires authentication. The user must be signed in to access autocomplete data.This endpoint proxies requests to the locations search API. Results are cached
for 7 days to improve performance.
Request
string
Search query to filter locations. Returns locations that match this text (city
name, country name, or raw address).
integer
default:"25"
Number of results to return per page.
integer
default:"0"
Zero-based page number for pagination.
Response
Returns a paginated list of location items matching the search criteria.LocationItem[]
Array of location items matching the query.
Show LocationItem properties
Show LocationItem properties
string
required
Unique identifier for the location.
string
required
Display name of the location (typically the city name).
string
required
Full name of the country (e.g., “United States”, “Germany”).
string
required
ISO 3166-1 alpha-2 country code (e.g., “US”, “DE”).
string
Name of the state or region. Can be null for locations without state-level data.
string
Abbreviated state or region code (e.g., “CA”, “NY”). Can be null.
string
required
Full formatted address string for the location.
integer
Total number of matching locations across all pages.
integer
Total number of pages available.
integer
Number of items per page.
integer
Current page number (zero-based).
boolean
Whether this is the first page.
boolean
Whether this is the last page.
boolean
Whether the result set is empty.
integer
Number of elements in the current page.
Response Examples
{
"content": [
{
"id": "loc_sf_001",
"name": "San Francisco",
"countryName": "United States",
"countryCode": "US",
"stateName": "California",
"stateCode": "CA",
"rawAddress": "San Francisco, California, United States",
"position": {
"lng": -122.4194,
"lat": 37.7749
}
},
{
"id": "loc_sj_001",
"name": "San Jose",
"countryName": "United States",
"countryCode": "US",
"stateName": "California",
"stateCode": "CA",
"rawAddress": "San Jose, California, United States",
"position": {
"lng": -121.8863,
"lat": 37.3382
}
}
],
"totalElements": 156,
"totalPages": 7,
"size": 25,
"number": 0,
"first": true,
"last": false,
"empty": false,
"numberOfElements": 25
}
{
"content": [
{
"id": "loc_berlin_001",
"name": "Berlin",
"countryName": "Germany",
"countryCode": "DE",
"stateName": "Berlin",
"stateCode": "BE",
"rawAddress": "Berlin, Germany",
"position": {
"lng": 13.405,
"lat": 52.52
}
},
{
"id": "loc_munich_001",
"name": "Munich",
"countryName": "Germany",
"countryCode": "DE",
"stateName": "Bavaria",
"stateCode": "BY",
"rawAddress": "Munich, Bavaria, Germany",
"position": {
"lng": 11.582,
"lat": 48.1351
}
}
],
"totalElements": 89,
"totalPages": 4,
"size": 25,
"number": 0,
"first": true,
"last": false,
"empty": false,
"numberOfElements": 25
}
{
"content": [],
"totalElements": 0,
"totalPages": 0,
"size": 25,
"number": 0,
"first": true,
"last": true,
"empty": true,
"numberOfElements": 0
}
{
"error": {
"code": "UNAUTHORIZED",
"message": "Unauthorized"
}
}
{
"error": {
"code": "INTERNAL_ERROR",
"message": "An unexpected error occurred"
}
}
Usage Examples
Search for cities starting with “San”
curl -X GET "https://api.lance.work/api/v1/operations/autocomplete/locations?search=San&size=10" \
-H "Authorization: Bearer YOUR_TOKEN"
Search for locations in Germany
curl -X GET "https://api.lance.work/api/v1/operations/autocomplete/locations?search=Germany" \
-H "Authorization: Bearer YOUR_TOKEN"
Paginate through results
curl -X GET "https://api.lance.work/api/v1/operations/autocomplete/locations?search=New&page=1&size=50" \
-H "Authorization: Bearer YOUR_TOKEN"
Get default locations (no search filter)
curl -X GET "https://api.lance.work/api/v1/operations/autocomplete/locations" \
-H "Authorization: Bearer YOUR_TOKEN"
Notes
- Results are cached for 7 days to improve performance. The cache is shared across all users.
- Use the
searchparameter for type-ahead/autocomplete functionality - it filters results that match the search text against city names, country names, and raw addresses. - The
positionfield contains geographic coordinates that can be used for map displays or distance calculations. - All parameters are optional. If no
searchis provided, the endpoint returns a default set of popular locations.