import { createVoyantDataClient } from "@voyant-travel/data-sdk";
const data = createVoyantDataClient({ apiKey: process.env.VOYANT_API_KEY });
const result = await data.geo.places.search({ q: "..." });curl --request GET \
--url https://api.voyant.travel/data/geo/v1/places/search \
--header 'Authorization: Bearer <token>'const response = await fetch("https://api.voyant.travel/data/geo/v1/places/search", {
method: "GET",
headers: {
"Authorization": "Bearer <token>"
},
});
const data = await response.json();import requests
response = requests.get(
"https://api.voyant.travel/data/geo/v1/places/search",
headers={
"Authorization": "Bearer <token>"
}
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.voyant.travel/data/geo/v1/places/search",
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.voyant.travel/data/geo/v1/places/search"
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.voyant.travel/data/geo/v1/places/search")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.voyant.travel/data/geo/v1/places/search")
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{
"data": [
{
"id": "<string>",
"type": "region",
"unlocode": "<string>",
"countryIso2": "<string>",
"parentId": "<string>",
"coordinates": {
"lat": 123,
"lng": 123
},
"name": "<string>",
"nameLang": "<string>",
"names": {},
"aliases": [
"<string>"
],
"attributes": {}
}
],
"totalCount": 123,
"nextCursor": "<string>"
}{
"code": "NOT_FOUND",
"message": "<string>"
}{
"code": "NOT_FOUND",
"message": "<string>"
}{
"code": "NOT_FOUND",
"message": "<string>"
}Search places by name
Search / autocomplete canonical places by name. Matches a prefix (at least 2 characters) of the primary name and of every alias (translations, exonyms, alternate names), optionally restricted to a country and to a set of types. Results are ranked exact match before prefix match, then countries and regions, then population (largest first), then type priority (country, region, subdivision, island, area, city, port, waterways). Requires scope data:geo:read.
import { createVoyantDataClient } from "@voyant-travel/data-sdk";
const data = createVoyantDataClient({ apiKey: process.env.VOYANT_API_KEY });
const result = await data.geo.places.search({ q: "..." });curl --request GET \
--url https://api.voyant.travel/data/geo/v1/places/search \
--header 'Authorization: Bearer <token>'const response = await fetch("https://api.voyant.travel/data/geo/v1/places/search", {
method: "GET",
headers: {
"Authorization": "Bearer <token>"
},
});
const data = await response.json();import requests
response = requests.get(
"https://api.voyant.travel/data/geo/v1/places/search",
headers={
"Authorization": "Bearer <token>"
}
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.voyant.travel/data/geo/v1/places/search",
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.voyant.travel/data/geo/v1/places/search"
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.voyant.travel/data/geo/v1/places/search")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.voyant.travel/data/geo/v1/places/search")
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{
"data": [
{
"id": "<string>",
"type": "region",
"unlocode": "<string>",
"countryIso2": "<string>",
"parentId": "<string>",
"coordinates": {
"lat": 123,
"lng": 123
},
"name": "<string>",
"nameLang": "<string>",
"names": {},
"aliases": [
"<string>"
],
"attributes": {}
}
],
"totalCount": 123,
"nextCursor": "<string>"
}{
"code": "NOT_FOUND",
"message": "<string>"
}{
"code": "NOT_FOUND",
"message": "<string>"
}{
"code": "NOT_FOUND",
"message": "<string>"
}Authorizations
Voyant Data API token, scoped per sub-product (data:{product}:read). Sent as Authorization: Bearer <token>.
Query Parameters
Search text, at least 2 characters. Matched as a case-insensitive prefix of the primary name and every alias.
2Restrict to a single place type. Combined with types when both are given.
Place type. island is a curated island that is not itself a subdivision (Santorini, Capri); area is a curated travel area (Cinque Terre, Cappadocia, Serengeti).
region, country, subdivision, island, area, city, port, river, sea, ocean, canal, lake Comma-separated list of place types to restrict to. Unknown values are ignored.
ISO 3166-1 alpha-2 country code to restrict to (case-insensitive).
^[A-Za-z]{2}$Maximum number of results.
1 <= x <= 50