curl --request POST \
--url https://api.topsort.com/v2/auctions/travel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"auctions": [
{
"type": "hotels",
"slots": 2,
"products": [
{
"id": "hotel-1",
"qualityScore": 0.7
},
{
"id": "hotel-2"
}
],
"category": {
"singleCategory": {
"id": "hotel-boutique"
}
},
"travelContext": {
"travelStartDate": "2025-01-01",
"travelEndDate": "2025-01-15",
"site": "argentina",
"passengers": 2,
"travelerType": "couple"
}
},
{
"type": "flights",
"slots": 2,
"products": [
{
"id": "L0_SAO-ORL",
"variationID": "001",
"price": 1500,
"qualityScore": 0.7
},
{
"id": "L0_SAO-ORL",
"variationID": "002",
"price": 2000
}
],
"travelContext": {
"site": "argentina",
"passengers": 2,
"route": "SAO-ORL",
"flightType": "one-way"
}
}
]
}
'import requests
url = "https://api.topsort.com/v2/auctions/travel"
payload = { "auctions": [
{
"type": "hotels",
"slots": 2,
"products": [{
"id": "hotel-1",
"qualityScore": 0.7
}, { "id": "hotel-2" }],
"category": { "singleCategory": { "id": "hotel-boutique" } },
"travelContext": {
"travelStartDate": "2025-01-01",
"travelEndDate": "2025-01-15",
"site": "argentina",
"passengers": 2,
"travelerType": "couple"
}
},
{
"type": "flights",
"slots": 2,
"products": [
{
"id": "L0_SAO-ORL",
"variationID": "001",
"price": 1500,
"qualityScore": 0.7
},
{
"id": "L0_SAO-ORL",
"variationID": "002",
"price": 2000
}
],
"travelContext": {
"site": "argentina",
"passengers": 2,
"route": "SAO-ORL",
"flightType": "one-way"
}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
auctions: [
{
type: 'hotels',
slots: 2,
products: [{id: 'hotel-1', qualityScore: 0.7}, {id: 'hotel-2'}],
category: {singleCategory: {id: 'hotel-boutique'}},
travelContext: {
travelStartDate: '2025-01-01',
travelEndDate: '2025-01-15',
site: 'argentina',
passengers: 2,
travelerType: 'couple'
}
},
{
type: 'flights',
slots: 2,
products: [
{id: 'L0_SAO-ORL', variationID: '001', price: 1500, qualityScore: 0.7},
{id: 'L0_SAO-ORL', variationID: '002', price: 2000}
],
travelContext: {site: 'argentina', passengers: 2, route: 'SAO-ORL', flightType: 'one-way'}
}
]
})
};
fetch('https://api.topsort.com/v2/auctions/travel', 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.topsort.com/v2/auctions/travel",
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([
'auctions' => [
[
'type' => 'hotels',
'slots' => 2,
'products' => [
[
'id' => 'hotel-1',
'qualityScore' => 0.7
],
[
'id' => 'hotel-2'
]
],
'category' => [
'singleCategory' => [
'id' => 'hotel-boutique'
]
],
'travelContext' => [
'travelStartDate' => '2025-01-01',
'travelEndDate' => '2025-01-15',
'site' => 'argentina',
'passengers' => 2,
'travelerType' => 'couple'
]
],
[
'type' => 'flights',
'slots' => 2,
'products' => [
[
'id' => 'L0_SAO-ORL',
'variationID' => '001',
'price' => 1500,
'qualityScore' => 0.7
],
[
'id' => 'L0_SAO-ORL',
'variationID' => '002',
'price' => 2000
]
],
'travelContext' => [
'site' => 'argentina',
'passengers' => 2,
'route' => 'SAO-ORL',
'flightType' => 'one-way'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.topsort.com/v2/auctions/travel"
payload := strings.NewReader("{\n \"auctions\": [\n {\n \"type\": \"hotels\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"hotel-1\",\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"hotel-2\"\n }\n ],\n \"category\": {\n \"singleCategory\": {\n \"id\": \"hotel-boutique\"\n }\n },\n \"travelContext\": {\n \"travelStartDate\": \"2025-01-01\",\n \"travelEndDate\": \"2025-01-15\",\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"travelerType\": \"couple\"\n }\n },\n {\n \"type\": \"flights\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"001\",\n \"price\": 1500,\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"002\",\n \"price\": 2000\n }\n ],\n \"travelContext\": {\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"route\": \"SAO-ORL\",\n \"flightType\": \"one-way\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.topsort.com/v2/auctions/travel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"auctions\": [\n {\n \"type\": \"hotels\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"hotel-1\",\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"hotel-2\"\n }\n ],\n \"category\": {\n \"singleCategory\": {\n \"id\": \"hotel-boutique\"\n }\n },\n \"travelContext\": {\n \"travelStartDate\": \"2025-01-01\",\n \"travelEndDate\": \"2025-01-15\",\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"travelerType\": \"couple\"\n }\n },\n {\n \"type\": \"flights\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"001\",\n \"price\": 1500,\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"002\",\n \"price\": 2000\n }\n ],\n \"travelContext\": {\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"route\": \"SAO-ORL\",\n \"flightType\": \"one-way\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/v2/auctions/travel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"auctions\": [\n {\n \"type\": \"hotels\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"hotel-1\",\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"hotel-2\"\n }\n ],\n \"category\": {\n \"singleCategory\": {\n \"id\": \"hotel-boutique\"\n }\n },\n \"travelContext\": {\n \"travelStartDate\": \"2025-01-01\",\n \"travelEndDate\": \"2025-01-15\",\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"travelerType\": \"couple\"\n }\n },\n {\n \"type\": \"flights\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"001\",\n \"price\": 1500,\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"002\",\n \"price\": 2000\n }\n ],\n \"travelContext\": {\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"route\": \"SAO-ORL\",\n \"flightType\": \"one-way\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"resultType": "hotels",
"winners": [
{
"rank": 1,
"type": "product",
"id": "hotel-1",
"resolvedBidId": "ChAHd-K97Xs8MNRELdY9VCeJFiBCk1_aEYz8eb-WZqyhzL4EFhBCk5Mt_X2_b8Yu_vXJgzPWJhVLBTFRBTGssk9",
"campaignId": "8b816367-da17-4c65-9a26-391edf01a10d"
},
{
"rank": 2,
"type": "product",
"id": "hotel-2",
"resolvedBidId": "ChAJe-M23Yr5QPTEFdX7VBgJGhCDm2_wDXy6cb-XZpxjxK6GHhCDm3Ku_W1_c9Zw_wYHfzQYKjTLBVGQBTLttu6",
"campaignId": "7be0d8c8-243c-41af-bb43-b43ef4935672"
}
],
"error": false
},
{
"resultType": "flights",
"winners": [
{
"rank": 1,
"type": "product",
"id": "L0_SAO-ORL",
"resolvedBidId": "ChAKf-N45Vq3LOTEGcW9VDhKHjADk3_zCXx8db-XZsyiwM2HIjADk4Lr_X0_b9Xw_uKHgyRZKhUKCTHQCTHrrh7",
"campaignId": "8ab7b29e-1934-4ec9-ad87-60c285bc7f38",
"variationID": "002"
},
{
"rank": 2,
"type": "product",
"id": "L0_SAO-ORL",
"resolvedBidId": "ChAGg-P56Wu4MRUEHdX8VEfLHkBEk4_aEXz9fb-YZtxjwN3IJkBEk5Ms_W2_c8Yx_vZJhzSXKlVLDUJQDUJssl8",
"campaignId": "cb8ed0a7-0ecf-4ffb-a863-022f862649ec",
"variationID": "001"
}
],
"error": false
}
]
}{
"docUrl": "<string>",
"message": "<string>"
}Create travel auctions
Use the /auctions/travel endpoint to create batch auctions for sponsored travel listings. We support two types of sponsored travel listings, hotels and flights. Each batch of auction requests can be a combination of sponsored hotel and flight listing auctions. Each auction type has a unique body schemas.
curl --request POST \
--url https://api.topsort.com/v2/auctions/travel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"auctions": [
{
"type": "hotels",
"slots": 2,
"products": [
{
"id": "hotel-1",
"qualityScore": 0.7
},
{
"id": "hotel-2"
}
],
"category": {
"singleCategory": {
"id": "hotel-boutique"
}
},
"travelContext": {
"travelStartDate": "2025-01-01",
"travelEndDate": "2025-01-15",
"site": "argentina",
"passengers": 2,
"travelerType": "couple"
}
},
{
"type": "flights",
"slots": 2,
"products": [
{
"id": "L0_SAO-ORL",
"variationID": "001",
"price": 1500,
"qualityScore": 0.7
},
{
"id": "L0_SAO-ORL",
"variationID": "002",
"price": 2000
}
],
"travelContext": {
"site": "argentina",
"passengers": 2,
"route": "SAO-ORL",
"flightType": "one-way"
}
}
]
}
'import requests
url = "https://api.topsort.com/v2/auctions/travel"
payload = { "auctions": [
{
"type": "hotels",
"slots": 2,
"products": [{
"id": "hotel-1",
"qualityScore": 0.7
}, { "id": "hotel-2" }],
"category": { "singleCategory": { "id": "hotel-boutique" } },
"travelContext": {
"travelStartDate": "2025-01-01",
"travelEndDate": "2025-01-15",
"site": "argentina",
"passengers": 2,
"travelerType": "couple"
}
},
{
"type": "flights",
"slots": 2,
"products": [
{
"id": "L0_SAO-ORL",
"variationID": "001",
"price": 1500,
"qualityScore": 0.7
},
{
"id": "L0_SAO-ORL",
"variationID": "002",
"price": 2000
}
],
"travelContext": {
"site": "argentina",
"passengers": 2,
"route": "SAO-ORL",
"flightType": "one-way"
}
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
auctions: [
{
type: 'hotels',
slots: 2,
products: [{id: 'hotel-1', qualityScore: 0.7}, {id: 'hotel-2'}],
category: {singleCategory: {id: 'hotel-boutique'}},
travelContext: {
travelStartDate: '2025-01-01',
travelEndDate: '2025-01-15',
site: 'argentina',
passengers: 2,
travelerType: 'couple'
}
},
{
type: 'flights',
slots: 2,
products: [
{id: 'L0_SAO-ORL', variationID: '001', price: 1500, qualityScore: 0.7},
{id: 'L0_SAO-ORL', variationID: '002', price: 2000}
],
travelContext: {site: 'argentina', passengers: 2, route: 'SAO-ORL', flightType: 'one-way'}
}
]
})
};
fetch('https://api.topsort.com/v2/auctions/travel', 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.topsort.com/v2/auctions/travel",
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([
'auctions' => [
[
'type' => 'hotels',
'slots' => 2,
'products' => [
[
'id' => 'hotel-1',
'qualityScore' => 0.7
],
[
'id' => 'hotel-2'
]
],
'category' => [
'singleCategory' => [
'id' => 'hotel-boutique'
]
],
'travelContext' => [
'travelStartDate' => '2025-01-01',
'travelEndDate' => '2025-01-15',
'site' => 'argentina',
'passengers' => 2,
'travelerType' => 'couple'
]
],
[
'type' => 'flights',
'slots' => 2,
'products' => [
[
'id' => 'L0_SAO-ORL',
'variationID' => '001',
'price' => 1500,
'qualityScore' => 0.7
],
[
'id' => 'L0_SAO-ORL',
'variationID' => '002',
'price' => 2000
]
],
'travelContext' => [
'site' => 'argentina',
'passengers' => 2,
'route' => 'SAO-ORL',
'flightType' => 'one-way'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.topsort.com/v2/auctions/travel"
payload := strings.NewReader("{\n \"auctions\": [\n {\n \"type\": \"hotels\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"hotel-1\",\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"hotel-2\"\n }\n ],\n \"category\": {\n \"singleCategory\": {\n \"id\": \"hotel-boutique\"\n }\n },\n \"travelContext\": {\n \"travelStartDate\": \"2025-01-01\",\n \"travelEndDate\": \"2025-01-15\",\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"travelerType\": \"couple\"\n }\n },\n {\n \"type\": \"flights\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"001\",\n \"price\": 1500,\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"002\",\n \"price\": 2000\n }\n ],\n \"travelContext\": {\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"route\": \"SAO-ORL\",\n \"flightType\": \"one-way\"\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.topsort.com/v2/auctions/travel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"auctions\": [\n {\n \"type\": \"hotels\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"hotel-1\",\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"hotel-2\"\n }\n ],\n \"category\": {\n \"singleCategory\": {\n \"id\": \"hotel-boutique\"\n }\n },\n \"travelContext\": {\n \"travelStartDate\": \"2025-01-01\",\n \"travelEndDate\": \"2025-01-15\",\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"travelerType\": \"couple\"\n }\n },\n {\n \"type\": \"flights\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"001\",\n \"price\": 1500,\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"002\",\n \"price\": 2000\n }\n ],\n \"travelContext\": {\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"route\": \"SAO-ORL\",\n \"flightType\": \"one-way\"\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.topsort.com/v2/auctions/travel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"auctions\": [\n {\n \"type\": \"hotels\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"hotel-1\",\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"hotel-2\"\n }\n ],\n \"category\": {\n \"singleCategory\": {\n \"id\": \"hotel-boutique\"\n }\n },\n \"travelContext\": {\n \"travelStartDate\": \"2025-01-01\",\n \"travelEndDate\": \"2025-01-15\",\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"travelerType\": \"couple\"\n }\n },\n {\n \"type\": \"flights\",\n \"slots\": 2,\n \"products\": [\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"001\",\n \"price\": 1500,\n \"qualityScore\": 0.7\n },\n {\n \"id\": \"L0_SAO-ORL\",\n \"variationID\": \"002\",\n \"price\": 2000\n }\n ],\n \"travelContext\": {\n \"site\": \"argentina\",\n \"passengers\": 2,\n \"route\": \"SAO-ORL\",\n \"flightType\": \"one-way\"\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"resultType": "hotels",
"winners": [
{
"rank": 1,
"type": "product",
"id": "hotel-1",
"resolvedBidId": "ChAHd-K97Xs8MNRELdY9VCeJFiBCk1_aEYz8eb-WZqyhzL4EFhBCk5Mt_X2_b8Yu_vXJgzPWJhVLBTFRBTGssk9",
"campaignId": "8b816367-da17-4c65-9a26-391edf01a10d"
},
{
"rank": 2,
"type": "product",
"id": "hotel-2",
"resolvedBidId": "ChAJe-M23Yr5QPTEFdX7VBgJGhCDm2_wDXy6cb-XZpxjxK6GHhCDm3Ku_W1_c9Zw_wYHfzQYKjTLBVGQBTLttu6",
"campaignId": "7be0d8c8-243c-41af-bb43-b43ef4935672"
}
],
"error": false
},
{
"resultType": "flights",
"winners": [
{
"rank": 1,
"type": "product",
"id": "L0_SAO-ORL",
"resolvedBidId": "ChAKf-N45Vq3LOTEGcW9VDhKHjADk3_zCXx8db-XZsyiwM2HIjADk4Lr_X0_b9Xw_uKHgyRZKhUKCTHQCTHrrh7",
"campaignId": "8ab7b29e-1934-4ec9-ad87-60c285bc7f38",
"variationID": "002"
},
{
"rank": 2,
"type": "product",
"id": "L0_SAO-ORL",
"resolvedBidId": "ChAGg-P56Wu4MRUEHdX8VEfLHkBEk4_aEXz9fb-YZtxjwN3IJkBEk5Ms_W2_c8Yx_vZJhzSXKlVLDUJQDUJssl8",
"campaignId": "cb8ed0a7-0ecf-4ffb-a863-022f862649ec",
"variationID": "001"
}
],
"error": false
}
]
}{
"docUrl": "<string>",
"message": "<string>"
}Authorizations
A valid API key generated in Topsort's UI. Use a TSE API key for calls to Auctions or Events API.
Body
The information describing what will be auctioned. Topsort will run an auction for each batched auction request, for which travel products' bids will compete against each other.
1 - 5 elementsDescribes the intent of running a single auction.
- Hotels
- Flights
Show child attributes
Show child attributes
[
{
"type": "hotels",
"slots": 2,
"travelContext": { "site": "argentina" }
}
]Response
The travel auction results. The list of winners will contain at most winners entries per auction. It may contain fewer or no entries at all if there aren't enough products with usable bids, that is, a bid amount greater than the reserve price and belonging to a campaign with enough remaining budget. Bids become unusable if campaign budget is exhausted, the bid is disqualified to preserve spend pacing, etc.
1 - 5 elementsThe result of a travel-related auction request (hotels or flights).
- Sponsored Listings
- Flights
- Empty Auction
Show child attributes
Show child attributes
Was this page helpful?