cURL
curl --request POST \
--url https://app.example.com/v1/admin/promotions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"discountType": "percentage",
"discountPercent": 123,
"discountAmountCents": 123,
"currency": "<string>",
"scope": {
"kind": "global",
"productIds": [
"<string>"
],
"categoryIds": [
"<string>"
],
"destinationIds": [
"<string>"
],
"marketIds": [
"<string>"
],
"audiences": [
"staff"
],
"fareCodes": [
"<string>"
],
"cabinGradeCodes": [
"<string>"
]
},
"conditions": {
"minPax": 123,
"pastGuestOnly": true,
"soloTravelerOnly": true,
"childTravelerOnly": true,
"familyOnly": true
},
"validFrom": "<string>",
"validUntil": "<string>",
"code": "<string>",
"stackable": true,
"active": true,
"metadata": {}
}'const response = await fetch("https://app.example.com/v1/admin/promotions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <token>"
},
body: JSON.stringify({
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"discountType": "percentage",
"discountPercent": 123,
"discountAmountCents": 123,
"currency": "<string>",
"scope": {
"kind": "global",
"productIds": [
"<string>"
],
"categoryIds": [
"<string>"
],
"destinationIds": [
"<string>"
],
"marketIds": [
"<string>"
],
"audiences": [
"staff"
],
"fareCodes": [
"<string>"
],
"cabinGradeCodes": [
"<string>"
]
},
"conditions": {
"minPax": 123,
"pastGuestOnly": true,
"soloTravelerOnly": true,
"childTravelerOnly": true,
"familyOnly": true
},
"validFrom": "<string>",
"validUntil": "<string>",
"code": "<string>",
"stackable": true,
"active": true,
"metadata": {}
}),
});
const data = await response.json();import requests
response = requests.post(
"https://app.example.com/v1/admin/promotions",
headers={
"Authorization": "Bearer <token>"
},
json={
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"discountType": "percentage",
"discountPercent": 123,
"discountAmountCents": 123,
"currency": "<string>",
"scope": {
"kind": "global",
"productIds": [
"<string>"
],
"categoryIds": [
"<string>"
],
"destinationIds": [
"<string>"
],
"marketIds": [
"<string>"
],
"audiences": [
"staff"
],
"fareCodes": [
"<string>"
],
"cabinGradeCodes": [
"<string>"
]
},
"conditions": {
"minPax": 123,
"pastGuestOnly": True,
"soloTravelerOnly": True,
"childTravelerOnly": True,
"familyOnly": True
},
"validFrom": "<string>",
"validUntil": "<string>",
"code": "<string>",
"stackable": True,
"active": True,
"metadata": {}
}
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{operatorDomain}/v1/admin/promotions",
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([
'name' => '<string>',
'slug' => '<string>',
'scope' => [
'productIds' => [
'<string>'
],
'categoryIds' => [
'<string>'
],
'destinationIds' => [
'<string>'
],
'marketIds' => [
'<string>'
],
'audiences' => [
],
'fareCodes' => [
'<string>'
],
'cabinGradeCodes' => [
'<string>'
]
],
'description' => '<string>',
'discountPercent' => 123,
'discountAmountCents' => 123,
'currency' => '<string>',
'conditions' => [
'minPax' => 123,
'pastGuestOnly' => true,
'soloTravelerOnly' => true,
'childTravelerOnly' => true,
'familyOnly' => true
],
'validFrom' => '2023-12-25',
'validUntil' => '2023-12-25',
'code' => '<string>',
'stackable' => true,
'active' => true,
'metadata' => [
]
]),
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://{operatorDomain}/v1/admin/promotions"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"scope\": {\n \"productIds\": [\n \"<string>\"\n ],\n \"categoryIds\": [\n \"<string>\"\n ],\n \"destinationIds\": [\n \"<string>\"\n ],\n \"marketIds\": [\n \"<string>\"\n ],\n \"audiences\": [],\n \"fareCodes\": [\n \"<string>\"\n ],\n \"cabinGradeCodes\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"discountPercent\": 123,\n \"discountAmountCents\": 123,\n \"currency\": \"<string>\",\n \"conditions\": {\n \"minPax\": 123,\n \"pastGuestOnly\": true,\n \"soloTravelerOnly\": true,\n \"childTravelerOnly\": true,\n \"familyOnly\": true\n },\n \"validFrom\": \"2023-12-25\",\n \"validUntil\": \"2023-12-25\",\n \"code\": \"<string>\",\n \"stackable\": true,\n \"active\": true,\n \"metadata\": {}\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://{operatorDomain}/v1/admin/promotions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"scope\": {\n \"productIds\": [\n \"<string>\"\n ],\n \"categoryIds\": [\n \"<string>\"\n ],\n \"destinationIds\": [\n \"<string>\"\n ],\n \"marketIds\": [\n \"<string>\"\n ],\n \"audiences\": [],\n \"fareCodes\": [\n \"<string>\"\n ],\n \"cabinGradeCodes\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"discountPercent\": 123,\n \"discountAmountCents\": 123,\n \"currency\": \"<string>\",\n \"conditions\": {\n \"minPax\": 123,\n \"pastGuestOnly\": true,\n \"soloTravelerOnly\": true,\n \"childTravelerOnly\": true,\n \"familyOnly\": true\n },\n \"validFrom\": \"2023-12-25\",\n \"validUntil\": \"2023-12-25\",\n \"code\": \"<string>\",\n \"stackable\": true,\n \"active\": true,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{operatorDomain}/v1/admin/promotions")
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 \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"scope\": {\n \"productIds\": [\n \"<string>\"\n ],\n \"categoryIds\": [\n \"<string>\"\n ],\n \"destinationIds\": [\n \"<string>\"\n ],\n \"marketIds\": [\n \"<string>\"\n ],\n \"audiences\": [],\n \"fareCodes\": [\n \"<string>\"\n ],\n \"cabinGradeCodes\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"discountPercent\": 123,\n \"discountAmountCents\": 123,\n \"currency\": \"<string>\",\n \"conditions\": {\n \"minPax\": 123,\n \"pastGuestOnly\": true,\n \"soloTravelerOnly\": true,\n \"childTravelerOnly\": true,\n \"familyOnly\": true\n },\n \"validFrom\": \"2023-12-25\",\n \"validUntil\": \"2023-12-25\",\n \"code\": \"<string>\",\n \"stackable\": true,\n \"active\": true,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"discountType": "percentage",
"discountPercent": 123,
"discountAmountCents": 123,
"currency": "<string>",
"scope": {
"kind": "global",
"productIds": [
"<string>"
],
"categoryIds": [
"<string>"
],
"destinationIds": [
"<string>"
],
"marketIds": [
"<string>"
],
"audiences": [
"staff"
],
"fareCodes": [
"<string>"
],
"cabinGradeCodes": [
"<string>"
]
},
"conditions": {
"minPax": 123,
"pastGuestOnly": true,
"soloTravelerOnly": true,
"childTravelerOnly": true,
"familyOnly": true
},
"validFrom": "2023-12-25",
"validUntil": "2023-12-25",
"code": "<string>",
"stackable": true,
"active": true,
"metadata": {}
}
}{
"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": {}
}Promotions
Create a promotional offer
Create a promotional offer with a discount, scope, and optional conditions/validity window.
POST
/
v1
/
admin
/
promotions
cURL
curl --request POST \
--url https://app.example.com/v1/admin/promotions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"discountType": "percentage",
"discountPercent": 123,
"discountAmountCents": 123,
"currency": "<string>",
"scope": {
"kind": "global",
"productIds": [
"<string>"
],
"categoryIds": [
"<string>"
],
"destinationIds": [
"<string>"
],
"marketIds": [
"<string>"
],
"audiences": [
"staff"
],
"fareCodes": [
"<string>"
],
"cabinGradeCodes": [
"<string>"
]
},
"conditions": {
"minPax": 123,
"pastGuestOnly": true,
"soloTravelerOnly": true,
"childTravelerOnly": true,
"familyOnly": true
},
"validFrom": "<string>",
"validUntil": "<string>",
"code": "<string>",
"stackable": true,
"active": true,
"metadata": {}
}'const response = await fetch("https://app.example.com/v1/admin/promotions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer <token>"
},
body: JSON.stringify({
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"discountType": "percentage",
"discountPercent": 123,
"discountAmountCents": 123,
"currency": "<string>",
"scope": {
"kind": "global",
"productIds": [
"<string>"
],
"categoryIds": [
"<string>"
],
"destinationIds": [
"<string>"
],
"marketIds": [
"<string>"
],
"audiences": [
"staff"
],
"fareCodes": [
"<string>"
],
"cabinGradeCodes": [
"<string>"
]
},
"conditions": {
"minPax": 123,
"pastGuestOnly": true,
"soloTravelerOnly": true,
"childTravelerOnly": true,
"familyOnly": true
},
"validFrom": "<string>",
"validUntil": "<string>",
"code": "<string>",
"stackable": true,
"active": true,
"metadata": {}
}),
});
const data = await response.json();import requests
response = requests.post(
"https://app.example.com/v1/admin/promotions",
headers={
"Authorization": "Bearer <token>"
},
json={
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"discountType": "percentage",
"discountPercent": 123,
"discountAmountCents": 123,
"currency": "<string>",
"scope": {
"kind": "global",
"productIds": [
"<string>"
],
"categoryIds": [
"<string>"
],
"destinationIds": [
"<string>"
],
"marketIds": [
"<string>"
],
"audiences": [
"staff"
],
"fareCodes": [
"<string>"
],
"cabinGradeCodes": [
"<string>"
]
},
"conditions": {
"minPax": 123,
"pastGuestOnly": True,
"soloTravelerOnly": True,
"childTravelerOnly": True,
"familyOnly": True
},
"validFrom": "<string>",
"validUntil": "<string>",
"code": "<string>",
"stackable": True,
"active": True,
"metadata": {}
}
)
data = response.json()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{operatorDomain}/v1/admin/promotions",
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([
'name' => '<string>',
'slug' => '<string>',
'scope' => [
'productIds' => [
'<string>'
],
'categoryIds' => [
'<string>'
],
'destinationIds' => [
'<string>'
],
'marketIds' => [
'<string>'
],
'audiences' => [
],
'fareCodes' => [
'<string>'
],
'cabinGradeCodes' => [
'<string>'
]
],
'description' => '<string>',
'discountPercent' => 123,
'discountAmountCents' => 123,
'currency' => '<string>',
'conditions' => [
'minPax' => 123,
'pastGuestOnly' => true,
'soloTravelerOnly' => true,
'childTravelerOnly' => true,
'familyOnly' => true
],
'validFrom' => '2023-12-25',
'validUntil' => '2023-12-25',
'code' => '<string>',
'stackable' => true,
'active' => true,
'metadata' => [
]
]),
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://{operatorDomain}/v1/admin/promotions"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"scope\": {\n \"productIds\": [\n \"<string>\"\n ],\n \"categoryIds\": [\n \"<string>\"\n ],\n \"destinationIds\": [\n \"<string>\"\n ],\n \"marketIds\": [\n \"<string>\"\n ],\n \"audiences\": [],\n \"fareCodes\": [\n \"<string>\"\n ],\n \"cabinGradeCodes\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"discountPercent\": 123,\n \"discountAmountCents\": 123,\n \"currency\": \"<string>\",\n \"conditions\": {\n \"minPax\": 123,\n \"pastGuestOnly\": true,\n \"soloTravelerOnly\": true,\n \"childTravelerOnly\": true,\n \"familyOnly\": true\n },\n \"validFrom\": \"2023-12-25\",\n \"validUntil\": \"2023-12-25\",\n \"code\": \"<string>\",\n \"stackable\": true,\n \"active\": true,\n \"metadata\": {}\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://{operatorDomain}/v1/admin/promotions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"scope\": {\n \"productIds\": [\n \"<string>\"\n ],\n \"categoryIds\": [\n \"<string>\"\n ],\n \"destinationIds\": [\n \"<string>\"\n ],\n \"marketIds\": [\n \"<string>\"\n ],\n \"audiences\": [],\n \"fareCodes\": [\n \"<string>\"\n ],\n \"cabinGradeCodes\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"discountPercent\": 123,\n \"discountAmountCents\": 123,\n \"currency\": \"<string>\",\n \"conditions\": {\n \"minPax\": 123,\n \"pastGuestOnly\": true,\n \"soloTravelerOnly\": true,\n \"childTravelerOnly\": true,\n \"familyOnly\": true\n },\n \"validFrom\": \"2023-12-25\",\n \"validUntil\": \"2023-12-25\",\n \"code\": \"<string>\",\n \"stackable\": true,\n \"active\": true,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{operatorDomain}/v1/admin/promotions")
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 \"name\": \"<string>\",\n \"slug\": \"<string>\",\n \"scope\": {\n \"productIds\": [\n \"<string>\"\n ],\n \"categoryIds\": [\n \"<string>\"\n ],\n \"destinationIds\": [\n \"<string>\"\n ],\n \"marketIds\": [\n \"<string>\"\n ],\n \"audiences\": [],\n \"fareCodes\": [\n \"<string>\"\n ],\n \"cabinGradeCodes\": [\n \"<string>\"\n ]\n },\n \"description\": \"<string>\",\n \"discountPercent\": 123,\n \"discountAmountCents\": 123,\n \"currency\": \"<string>\",\n \"conditions\": {\n \"minPax\": 123,\n \"pastGuestOnly\": true,\n \"soloTravelerOnly\": true,\n \"childTravelerOnly\": true,\n \"familyOnly\": true\n },\n \"validFrom\": \"2023-12-25\",\n \"validUntil\": \"2023-12-25\",\n \"code\": \"<string>\",\n \"stackable\": true,\n \"active\": true,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"slug": "<string>",
"description": "<string>",
"discountType": "percentage",
"discountPercent": 123,
"discountAmountCents": 123,
"currency": "<string>",
"scope": {
"kind": "global",
"productIds": [
"<string>"
],
"categoryIds": [
"<string>"
],
"destinationIds": [
"<string>"
],
"marketIds": [
"<string>"
],
"audiences": [
"staff"
],
"fareCodes": [
"<string>"
],
"cabinGradeCodes": [
"<string>"
]
},
"conditions": {
"minPax": 123,
"pastGuestOnly": true,
"soloTravelerOnly": true,
"childTravelerOnly": true,
"familyOnly": true
},
"validFrom": "2023-12-25",
"validUntil": "2023-12-25",
"code": "<string>",
"stackable": true,
"active": true,
"metadata": {}
}
}{
"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": {}
}Authorizations
Staff session or API token issued by your Voyant app.
Body
application/json
Required string length:
1 - 200Required string length:
1 - 200Pattern:
^[a-z0-9-]+$Available options:
percentage, fixed_amount Discriminated union on kind: global | products | categories | destinations | markets | audiences | fare_codes | cabin_grades.
Show child attributes
Show child attributes
Required when discountType=percentage (>0, <=100)
Required (with currency) when discountType=fixed_amount
3-letter ISO 4217; required with fixed_amount
Show child attributes
Show child attributes
Required string length:
1 - 80Pattern:
^[A-Za-z0-9_-]+$Response
Created offer
Show child attributes
Show child attributes
⌘I