SDK
import { createVoyantConnectClient } from "@voyant-travel/connect-sdk";
const connect = createVoyantConnectClient({ apiKey: process.env.VOYANT_API_KEY });
const result = await connect.oauth.issueToken({
"clientId": "<string>",
"clientSecret": "<string>",
"grantType": "client_credentials",
"scope": "connect:flights:read connect:bookings:write"
});curl --request POST \
--url https://api.voyant.travel/connect/v1/oauth/token \
--header 'Content-Type: application/json' \
--data '{
"clientId": "<string>",
"clientSecret": "<string>",
"grantType": "client_credentials",
"scope": "connect:flights:read connect:bookings:write"
}'const response = await fetch("https://api.voyant.travel/connect/v1/oauth/token", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"clientId": "<string>",
"clientSecret": "<string>",
"grantType": "client_credentials",
"scope": "connect:flights:read connect:bookings:write"
}),
});
const data = await response.json();import requests
response = requests.post(
"https://api.voyant.travel/connect/v1/oauth/token",
json={
"clientId": "<string>",
"clientSecret": "<string>",
"grantType": "client_credentials",
"scope": "connect:flights:read connect:bookings:write"
}
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.voyant.travel/connect/v1/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'clientId' => '<string>',
'clientSecret' => '<string>',
'grantType' => 'client_credentials',
'scope' => 'connect:flights:read connect:bookings:write'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.voyant.travel/connect/v1/oauth/token"
payload := strings.NewReader("{\n \"clientId\": \"<string>\",\n \"clientSecret\": \"<string>\",\n \"grantType\": \"client_credentials\",\n \"scope\": \"connect:flights:read connect:bookings:write\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.voyant.travel/connect/v1/oauth/token")
.header("Content-Type", "application/json")
.body("{\n \"clientId\": \"<string>\",\n \"clientSecret\": \"<string>\",\n \"grantType\": \"client_credentials\",\n \"scope\": \"connect:flights:read connect:bookings:write\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.voyant.travel/connect/v1/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"clientId\": \"<string>\",\n \"clientSecret\": \"<string>\",\n \"grantType\": \"client_credentials\",\n \"scope\": \"connect:flights:read connect:bookings:write\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "connect:flights:read connect:bookings:write"
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}OAuth
Issue an access token
OAuth2 client-credentials flow. Exchanges a clientId/clientSecret for a short-lived bearer token. The returned scope reflects the granted connect:* scopes. This endpoint does not require a bearer; it authenticates the client credentials in the body.
POST
/
connect
/
v1
/
oauth
/
token
SDK
import { createVoyantConnectClient } from "@voyant-travel/connect-sdk";
const connect = createVoyantConnectClient({ apiKey: process.env.VOYANT_API_KEY });
const result = await connect.oauth.issueToken({
"clientId": "<string>",
"clientSecret": "<string>",
"grantType": "client_credentials",
"scope": "connect:flights:read connect:bookings:write"
});curl --request POST \
--url https://api.voyant.travel/connect/v1/oauth/token \
--header 'Content-Type: application/json' \
--data '{
"clientId": "<string>",
"clientSecret": "<string>",
"grantType": "client_credentials",
"scope": "connect:flights:read connect:bookings:write"
}'const response = await fetch("https://api.voyant.travel/connect/v1/oauth/token", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"clientId": "<string>",
"clientSecret": "<string>",
"grantType": "client_credentials",
"scope": "connect:flights:read connect:bookings:write"
}),
});
const data = await response.json();import requests
response = requests.post(
"https://api.voyant.travel/connect/v1/oauth/token",
json={
"clientId": "<string>",
"clientSecret": "<string>",
"grantType": "client_credentials",
"scope": "connect:flights:read connect:bookings:write"
}
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.voyant.travel/connect/v1/oauth/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'clientId' => '<string>',
'clientSecret' => '<string>',
'grantType' => 'client_credentials',
'scope' => 'connect:flights:read connect:bookings:write'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.voyant.travel/connect/v1/oauth/token"
payload := strings.NewReader("{\n \"clientId\": \"<string>\",\n \"clientSecret\": \"<string>\",\n \"grantType\": \"client_credentials\",\n \"scope\": \"connect:flights:read connect:bookings:write\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.voyant.travel/connect/v1/oauth/token")
.header("Content-Type", "application/json")
.body("{\n \"clientId\": \"<string>\",\n \"clientSecret\": \"<string>\",\n \"grantType\": \"client_credentials\",\n \"scope\": \"connect:flights:read connect:bookings:write\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.voyant.travel/connect/v1/oauth/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"clientId\": \"<string>\",\n \"clientSecret\": \"<string>\",\n \"grantType\": \"client_credentials\",\n \"scope\": \"connect:flights:read connect:bookings:write\"\n}"
response = http.request(request)
puts response.read_body{
"access_token": "<string>",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "connect:flights:read connect:bookings:write"
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}{
"error": "<string>",
"code": "<string>",
"requestId": "<string>",
"details": {}
}Body
application/json
⌘I