curl --request POST \
--url https://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token \
--cookie segmnt_session=import requests
url = "https://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token"
headers = {"cookie": "segmnt_session="}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {cookie: 'segmnt_session='}};
fetch('https://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token', 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://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_COOKIE => "segmnt_session=",
]);
$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://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("cookie", "segmnt_session=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token")
.header("cookie", "segmnt_session=")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'segmnt_session='
response = http.request(request)
puts response.read_body{
"token": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"embedUrl": "https://test-cdn.segmnt.cloud/e/vid_9xR4tL"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}Create a dashboard preview token
Used by the dashboard’s first-run wizard to test a video in our player
before it is embedded on a customer site. Unlike createPlaybackToken,
this route is session-authenticated: a new user has no API key, and a
key secret must never reach the browser. The account must own the project.
The token is short-lived and its allowed domain is fixed to one of our dashboard hosts (never a caller-supplied value). The CDN and the embed page both use that domain, so a preview token plays only while the dashboard frames it and is useless on a customer site.
curl --request POST \
--url https://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token \
--cookie segmnt_session=import requests
url = "https://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token"
headers = {"cookie": "segmnt_session="}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {cookie: 'segmnt_session='}};
fetch('https://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token', 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://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_COOKIE => "segmnt_session=",
]);
$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://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("cookie", "segmnt_session=")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token")
.header("cookie", "segmnt_session=")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api.segmnt.cloud/v1/projects/{projectId}/videos/{videoId}/preview-token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'segmnt_session='
response = http.request(request)
puts response.read_body{
"token": "<string>",
"expiresAt": "2023-11-07T05:31:56Z",
"embedUrl": "https://test-cdn.segmnt.cloud/e/vid_9xR4tL"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}Authorizations
Dashboard session cookie, set after SSO sign-in.
Path Parameters
^prj_[A-Za-z0-9]+$^vid_[A-Za-z0-9]+$Response
Preview token created.
Opaque signed token. Do not parse it. It works for one video, one dashboard host and a short time only.
Our player (hls.js) for an iframe. The URL has no token in it: the
dashboard appends the real token for the live preview and the
visible YOUR_PLAYBACK_TOKEN placeholder in the copyable embed
snippet, so a preview token never leaks into what a customer copies.
"https://test-cdn.segmnt.cloud/e/vid_9xR4tL"