Authentication
Create an isolated Test Mode session
Creates a short-lived anonymous Test Mode bearer session for evaluation. The session is isolated from every other session and cannot access Live Mode, billing, studios, or events. Calls must use the public API host so the edge can apply abuse controls.
POST
/
v1
/
anonymous-sessions
Create an isolated Test Mode session
curl --request POST \
--url https://api.batchrelay.com/v1/anonymous-sessionsimport requests
url = "https://api.batchrelay.com/v1/anonymous-sessions"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.batchrelay.com/v1/anonymous-sessions', 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.batchrelay.com/v1/anonymous-sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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://api.batchrelay.com/v1/anonymous-sessions"
req, _ := http.NewRequest("POST", url, nil)
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.batchrelay.com/v1/anonymous-sessions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.batchrelay.com/v1/anonymous-sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"environment": "sandbox",
"expires_at": "2023-11-07T05:31:56Z",
"scopes": [
"print_orders:read"
]
}{
"code": "<string>",
"docs_url": "<string>",
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}{
"code": "<string>",
"docs_url": "<string>",
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}Headers
Untrusted optional analytics hint naming the calling client surface. It never affects authorization, routing, pricing, or behavior.
Required string length:
1 - 100Untrusted optional analytics hint naming the calling client version. It never affects authorization, routing, pricing, or behavior.
Required string length:
1 - 100Untrusted optional analytics hint naming the invocation mode. It never affects authorization, routing, pricing, or behavior.
Required string length:
1 - 100Response
New anonymous Test Mode session. Save session_token as a bearer credential; it is returned only once.
⌘I
Create an isolated Test Mode session
curl --request POST \
--url https://api.batchrelay.com/v1/anonymous-sessionsimport requests
url = "https://api.batchrelay.com/v1/anonymous-sessions"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.batchrelay.com/v1/anonymous-sessions', 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.batchrelay.com/v1/anonymous-sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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://api.batchrelay.com/v1/anonymous-sessions"
req, _ := http.NewRequest("POST", url, nil)
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.batchrelay.com/v1/anonymous-sessions")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.batchrelay.com/v1/anonymous-sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_body{
"environment": "sandbox",
"expires_at": "2023-11-07T05:31:56Z",
"scopes": [
"print_orders:read"
]
}{
"code": "<string>",
"docs_url": "<string>",
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}{
"code": "<string>",
"docs_url": "<string>",
"error": "<string>",
"message": "<string>",
"request_id": "<string>"
}