Recommend
curl --request POST \
--url https://api.privetag.com/api/b2a/recommend \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"user_profile": {
"travel_type": "<string>",
"nationality": "<string>",
"interests": [
"<string>"
],
"budget": "<string>",
"age_group": "<string>"
},
"location": {
"city": "<string>",
"lat": 123,
"lon": 123,
"hotel_id": "<string>"
},
"filters": {
"is_indoor": true,
"difficulty": "<string>",
"max_price": 123,
"categories": [
"<string>"
]
},
"limit": 123,
"include_flash_deals": true
}
'import requests
url = "https://api.privetag.com/api/b2a/recommend"
payload = {
"user_profile": {
"travel_type": "<string>",
"nationality": "<string>",
"interests": ["<string>"],
"budget": "<string>",
"age_group": "<string>"
},
"location": {
"city": "<string>",
"lat": 123,
"lon": 123,
"hotel_id": "<string>"
},
"filters": {
"is_indoor": True,
"difficulty": "<string>",
"max_price": 123,
"categories": ["<string>"]
},
"limit": 123,
"include_flash_deals": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_profile: {
travel_type: '<string>',
nationality: '<string>',
interests: ['<string>'],
budget: '<string>',
age_group: '<string>'
},
location: {city: '<string>', lat: 123, lon: 123, hotel_id: '<string>'},
filters: {
is_indoor: true,
difficulty: '<string>',
max_price: 123,
categories: ['<string>']
},
limit: 123,
include_flash_deals: true
})
};
fetch('https://api.privetag.com/api/b2a/recommend', 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.privetag.com/api/b2a/recommend",
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([
'user_profile' => [
'travel_type' => '<string>',
'nationality' => '<string>',
'interests' => [
'<string>'
],
'budget' => '<string>',
'age_group' => '<string>'
],
'location' => [
'city' => '<string>',
'lat' => 123,
'lon' => 123,
'hotel_id' => '<string>'
],
'filters' => [
'is_indoor' => true,
'difficulty' => '<string>',
'max_price' => 123,
'categories' => [
'<string>'
]
],
'limit' => 123,
'include_flash_deals' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.privetag.com/api/b2a/recommend"
payload := strings.NewReader("{\n \"user_profile\": {\n \"travel_type\": \"<string>\",\n \"nationality\": \"<string>\",\n \"interests\": [\n \"<string>\"\n ],\n \"budget\": \"<string>\",\n \"age_group\": \"<string>\"\n },\n \"location\": {\n \"city\": \"<string>\",\n \"lat\": 123,\n \"lon\": 123,\n \"hotel_id\": \"<string>\"\n },\n \"filters\": {\n \"is_indoor\": true,\n \"difficulty\": \"<string>\",\n \"max_price\": 123,\n \"categories\": [\n \"<string>\"\n ]\n },\n \"limit\": 123,\n \"include_flash_deals\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.privetag.com/api/b2a/recommend")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"user_profile\": {\n \"travel_type\": \"<string>\",\n \"nationality\": \"<string>\",\n \"interests\": [\n \"<string>\"\n ],\n \"budget\": \"<string>\",\n \"age_group\": \"<string>\"\n },\n \"location\": {\n \"city\": \"<string>\",\n \"lat\": 123,\n \"lon\": 123,\n \"hotel_id\": \"<string>\"\n },\n \"filters\": {\n \"is_indoor\": true,\n \"difficulty\": \"<string>\",\n \"max_price\": 123,\n \"categories\": [\n \"<string>\"\n ]\n },\n \"limit\": 123,\n \"include_flash_deals\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.privetag.com/api/b2a/recommend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_profile\": {\n \"travel_type\": \"<string>\",\n \"nationality\": \"<string>\",\n \"interests\": [\n \"<string>\"\n ],\n \"budget\": \"<string>\",\n \"age_group\": \"<string>\"\n },\n \"location\": {\n \"city\": \"<string>\",\n \"lat\": 123,\n \"lon\": 123,\n \"hotel_id\": \"<string>\"\n },\n \"filters\": {\n \"is_indoor\": true,\n \"difficulty\": \"<string>\",\n \"max_price\": 123,\n \"categories\": [\n \"<string>\"\n ]\n },\n \"limit\": 123,\n \"include_flash_deals\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"recommendations": [
{
"id": "<string>",
"title": "<string>",
"description": "<string>",
"category": "<string>",
"price": 123,
"currency": "<string>",
"relevance_score": 123,
"recommendation_reason": "<string>",
"is_flash_deal": true,
"original_price": 123,
"images": [
"<string>"
]
}
],
"context": {
"log_id": "<string>",
"user_profile_summary": "<string>",
"environment_summary": "<string>"
}
}
}B2A API
Recommend
Get context-aware activity recommendations
POST
/
api
/
b2a
/
recommend
Recommend
curl --request POST \
--url https://api.privetag.com/api/b2a/recommend \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"user_profile": {
"travel_type": "<string>",
"nationality": "<string>",
"interests": [
"<string>"
],
"budget": "<string>",
"age_group": "<string>"
},
"location": {
"city": "<string>",
"lat": 123,
"lon": 123,
"hotel_id": "<string>"
},
"filters": {
"is_indoor": true,
"difficulty": "<string>",
"max_price": 123,
"categories": [
"<string>"
]
},
"limit": 123,
"include_flash_deals": true
}
'import requests
url = "https://api.privetag.com/api/b2a/recommend"
payload = {
"user_profile": {
"travel_type": "<string>",
"nationality": "<string>",
"interests": ["<string>"],
"budget": "<string>",
"age_group": "<string>"
},
"location": {
"city": "<string>",
"lat": 123,
"lon": 123,
"hotel_id": "<string>"
},
"filters": {
"is_indoor": True,
"difficulty": "<string>",
"max_price": 123,
"categories": ["<string>"]
},
"limit": 123,
"include_flash_deals": True
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
user_profile: {
travel_type: '<string>',
nationality: '<string>',
interests: ['<string>'],
budget: '<string>',
age_group: '<string>'
},
location: {city: '<string>', lat: 123, lon: 123, hotel_id: '<string>'},
filters: {
is_indoor: true,
difficulty: '<string>',
max_price: 123,
categories: ['<string>']
},
limit: 123,
include_flash_deals: true
})
};
fetch('https://api.privetag.com/api/b2a/recommend', 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.privetag.com/api/b2a/recommend",
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([
'user_profile' => [
'travel_type' => '<string>',
'nationality' => '<string>',
'interests' => [
'<string>'
],
'budget' => '<string>',
'age_group' => '<string>'
],
'location' => [
'city' => '<string>',
'lat' => 123,
'lon' => 123,
'hotel_id' => '<string>'
],
'filters' => [
'is_indoor' => true,
'difficulty' => '<string>',
'max_price' => 123,
'categories' => [
'<string>'
]
],
'limit' => 123,
'include_flash_deals' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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.privetag.com/api/b2a/recommend"
payload := strings.NewReader("{\n \"user_profile\": {\n \"travel_type\": \"<string>\",\n \"nationality\": \"<string>\",\n \"interests\": [\n \"<string>\"\n ],\n \"budget\": \"<string>\",\n \"age_group\": \"<string>\"\n },\n \"location\": {\n \"city\": \"<string>\",\n \"lat\": 123,\n \"lon\": 123,\n \"hotel_id\": \"<string>\"\n },\n \"filters\": {\n \"is_indoor\": true,\n \"difficulty\": \"<string>\",\n \"max_price\": 123,\n \"categories\": [\n \"<string>\"\n ]\n },\n \"limit\": 123,\n \"include_flash_deals\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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.privetag.com/api/b2a/recommend")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"user_profile\": {\n \"travel_type\": \"<string>\",\n \"nationality\": \"<string>\",\n \"interests\": [\n \"<string>\"\n ],\n \"budget\": \"<string>\",\n \"age_group\": \"<string>\"\n },\n \"location\": {\n \"city\": \"<string>\",\n \"lat\": 123,\n \"lon\": 123,\n \"hotel_id\": \"<string>\"\n },\n \"filters\": {\n \"is_indoor\": true,\n \"difficulty\": \"<string>\",\n \"max_price\": 123,\n \"categories\": [\n \"<string>\"\n ]\n },\n \"limit\": 123,\n \"include_flash_deals\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.privetag.com/api/b2a/recommend")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user_profile\": {\n \"travel_type\": \"<string>\",\n \"nationality\": \"<string>\",\n \"interests\": [\n \"<string>\"\n ],\n \"budget\": \"<string>\",\n \"age_group\": \"<string>\"\n },\n \"location\": {\n \"city\": \"<string>\",\n \"lat\": 123,\n \"lon\": 123,\n \"hotel_id\": \"<string>\"\n },\n \"filters\": {\n \"is_indoor\": true,\n \"difficulty\": \"<string>\",\n \"max_price\": 123,\n \"categories\": [\n \"<string>\"\n ]\n },\n \"limit\": 123,\n \"include_flash_deals\": true\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"recommendations": [
{
"id": "<string>",
"title": "<string>",
"description": "<string>",
"category": "<string>",
"price": 123,
"currency": "<string>",
"relevance_score": 123,
"recommendation_reason": "<string>",
"is_flash_deal": true,
"original_price": 123,
"images": [
"<string>"
]
}
],
"context": {
"log_id": "<string>",
"user_profile_summary": "<string>",
"environment_summary": "<string>"
}
}
}Get Recommendations
This endpoint returns activities ranked by Ground Truth data - real user behavior, not assumptions.
Use This Endpoint When
User asks about activities
- “What should we do today?”
- “Any family activities nearby?”
- “Things to do in Bangkok”
Context-aware needs
- “It’s raining, what’s good?”
- “Romantic dinner for tonight”
- “Kid-friendly activities”
Request
object
required
User preferences and characteristics
Show Properties
Show Properties
object
required
object
number
default:"10"
Maximum number of recommendations (1-20)
boolean
default:"true"
Include same-day flash deals (30-50% off)
Response
boolean
Whether the request was successful
object
Show Properties
Show Properties
array
List of recommended activities
Show Activity Object
Show Activity Object
string
Unique activity identifier (use in
/execute_booking)string
Activity title in user’s language
string
Detailed description
string
Activity category
number
Price in local currency
string
Currency code (e.g.,
THB, USD)number
0-100 score based on context matching
string
Human-readable explanation of why this was recommended
boolean
Whether this is a limited-time deal
number
Original price (if flash deal)
string[]
Array of image URLs
Examples
Family Trip in Bangkok
curl -X POST https://api.privetag.com/api/b2a/recommend \
-H "x-api-key: pk_a1b2c3..." \
-H "Content-Type: application/json" \
-d '{
"user_profile": {
"travel_type": "family",
"interests": ["theme-park", "zoo", "aquarium"]
},
"location": {
"city": "Bangkok",
"lat": 13.7563,
"lon": 100.5018
},
"filters": {
"difficulty": "easy"
},
"limit": 5
}'
import requests
response = requests.post(
"https://api.privetag.com/api/b2a/recommend",
headers={
"x-api-key": "pk_a1b2c3...",
"Content-Type": "application/json"
},
json={
"user_profile": {
"travel_type": "family",
"interests": ["theme-park", "zoo", "aquarium"]
},
"location": {
"city": "Bangkok",
"lat": 13.7563,
"lon": 100.5018
},
"filters": {
"difficulty": "easy"
},
"limit": 5
}
)
recommendations = response.json()
const response = await fetch('https://api.privetag.com/api/b2a/recommend', {
method: 'POST',
headers: {
'x-api-key': 'pk_a1b2c3...',
'Content-Type': 'application/json'
},
body: JSON.stringify({
user_profile: {
travel_type: 'family',
interests: ['theme-park', 'zoo', 'aquarium']
},
location: {
city: 'Bangkok',
lat: 13.7563,
lon: 100.5018
},
filters: {
difficulty: 'easy'
},
limit: 5
})
});
const recommendations = await response.json();
Rainy Day Recommendations
When lat/lon is provided, the API automatically fetches weather data:{
"user_profile": {
"travel_type": "couple"
},
"location": {
"lat": 7.8804,
"lon": 98.3923
},
"filters": {
"is_indoor": true
}
}
Response Example
{
"success": true,
"data": {
"recommendations": [
{
"id": "act_abc123",
"title": "Safari World Bangkok",
"description": "World-class zoo with safari and marine park",
"category": "zoo",
"price": 1500,
"currency": "THB",
"relevance_score": 95,
"recommendation_reason": "Perfect for families - interactive animal experiences",
"is_flash_deal": false,
"images": ["https://cdn.privetag.com/activities/safari-world-1.jpg"]
},
{
"id": "act_def456",
"title": "Dream World Theme Park",
"description": "Exciting rides and attractions for all ages",
"category": "theme-park",
"price": 1200,
"currency": "THB",
"relevance_score": 92,
"recommendation_reason": "Family-friendly theme park with easy rides",
"is_flash_deal": true,
"original_price": 1800
}
],
"context": {
"log_id": "ctx_xyz789",
"user_profile_summary": "family, interested in theme-park, zoo, aquarium",
"environment_summary": "Bangkok, sunny, 32°C, afternoon"
}
}
}
Relevance Score Factors
Therelevance_score (0-100) is calculated from:
| Factor | Weight | Description |
|---|---|---|
| User Profile Match | 30% | How well activity matches travel_type and interests |
| Ground Truth Data | 25% | Real visit data from similar user profiles |
| Weather Appropriateness | 20% | Indoor/outdoor suitability for current weather |
| Time Appropriateness | 15% | Activity timing (morning activity, dinner spot, etc.) |
| Price Match | 10% | Budget alignment |
Ground Truth Advantage: Our recommendations improve over time as we collect more NFC-verified visit data. The more your users book and visit, the better the recommendations become.
Error Responses
| Code | Description |
|---|---|
INVALID_LOCATION | City not found or coordinates out of service area |
INVALID_PROFILE | Missing required user_profile fields |
NO_ACTIVITIES | No activities found matching criteria |
Next Steps
Execute Booking
Once user selects an activity, execute the booking
⌘I