A/B tests
Create an A/B test
POST
/
v1
/
ab_tests
Create an A/B test
curl --request POST \
--url https://api.vturb.com/v1/ab_tests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Home page test",
"folder_id": "66a0c1d2e3f4a5b6c7d8e9f0",
"variants": [
{
"video_id": "68c1f0a00000000000000e01",
"traffic_percentage": 60.5,
"locked": false
},
{
"video_id": "68c1f0a00000000000000e02",
"traffic_percentage": 39.5,
"locked": true
}
]
}
'import requests
url = "https://api.vturb.com/v1/ab_tests"
payload = {
"name": "Home page test",
"folder_id": "66a0c1d2e3f4a5b6c7d8e9f0",
"variants": [
{
"video_id": "68c1f0a00000000000000e01",
"traffic_percentage": 60.5,
"locked": False
},
{
"video_id": "68c1f0a00000000000000e02",
"traffic_percentage": 39.5,
"locked": True
}
]
}
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({
name: 'Home page test',
folder_id: '66a0c1d2e3f4a5b6c7d8e9f0',
variants: [
{video_id: '68c1f0a00000000000000e01', traffic_percentage: 60.5, locked: false},
{video_id: '68c1f0a00000000000000e02', traffic_percentage: 39.5, locked: true}
]
})
};
fetch('https://api.vturb.com/v1/ab_tests', 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.vturb.com/v1/ab_tests",
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' => 'Home page test',
'folder_id' => '66a0c1d2e3f4a5b6c7d8e9f0',
'variants' => [
[
'video_id' => '68c1f0a00000000000000e01',
'traffic_percentage' => 60.5,
'locked' => false
],
[
'video_id' => '68c1f0a00000000000000e02',
'traffic_percentage' => 39.5,
'locked' => true
]
]
]),
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.vturb.com/v1/ab_tests"
payload := strings.NewReader("{\n \"name\": \"Home page test\",\n \"folder_id\": \"66a0c1d2e3f4a5b6c7d8e9f0\",\n \"variants\": [\n {\n \"video_id\": \"68c1f0a00000000000000e01\",\n \"traffic_percentage\": 60.5,\n \"locked\": false\n },\n {\n \"video_id\": \"68c1f0a00000000000000e02\",\n \"traffic_percentage\": 39.5,\n \"locked\": true\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.vturb.com/v1/ab_tests")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Home page test\",\n \"folder_id\": \"66a0c1d2e3f4a5b6c7d8e9f0\",\n \"variants\": [\n {\n \"video_id\": \"68c1f0a00000000000000e01\",\n \"traffic_percentage\": 60.5,\n \"locked\": false\n },\n {\n \"video_id\": \"68c1f0a00000000000000e02\",\n \"traffic_percentage\": 39.5,\n \"locked\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vturb.com/v1/ab_tests")
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\": \"Home page test\",\n \"folder_id\": \"66a0c1d2e3f4a5b6c7d8e9f0\",\n \"variants\": [\n {\n \"video_id\": \"68c1f0a00000000000000e01\",\n \"traffic_percentage\": 60.5,\n \"locked\": false\n },\n {\n \"video_id\": \"68c1f0a00000000000000e02\",\n \"traffic_percentage\": 39.5,\n \"locked\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "68c1f0a0000000000000ab01",
"status": "draft",
"name": "Home page test",
"folder_id": null,
"started_at": null,
"created_at": "2026-09-01T12:00:00.000Z",
"updated_at": "2026-09-02T12:00:00.000Z",
"variants": [
{
"video_id": "68c1f0a00000000000000e01",
"traffic_percentage": 60,
"locked": false,
"started_at": null
},
{
"video_id": "68c1f0a00000000000000e02",
"traffic_percentage": 40,
"locked": false,
"started_at": null
}
]
}{
"type": "https://docs.vturb.com/errors/bad_request",
"code": "bad_request",
"message": "The request includes fields this endpoint does not accept.",
"field": "started_at",
"request_id": "00000000-0000-0000-0000-000000000000"
}{
"type": "https://docs.vturb.com/errors/unauthorized",
"code": "unauthorized",
"message": "Missing or invalid API credential. Send a vt_ token in the Authorization header.",
"request_id": "00000000-0000-0000-0000-000000000000"
}{
"type": "https://docs.vturb.com/errors/forbidden",
"code": "forbidden",
"message": "The credential is missing the scope this action requires.",
"request_id": "00000000-0000-0000-0000-000000000000"
}{
"type": "https://docs.vturb.com/errors/unprocessable_content",
"code": "unprocessable_content",
"message": "The request is invalid. See errors for the fields that failed.",
"request_id": "00000000-0000-0000-0000-000000000000",
"errors": [
{
"field": "variants",
"message": "must be an array"
}
]
}{
"type": "https://docs.vturb.com/errors/service_unavailable",
"code": "service_unavailable",
"message": "The service is temporarily unavailable. Retry shortly.",
"request_id": "00000000-0000-0000-0000-000000000000"
}Authorizations
Paste your VTurb API token (vt_...). Sent as Authorization: Bearer <token>.
Body
application/json
Response
The created A/B test, as a draft: it splits no traffic until it is started. A test carries 2 to 10 variants, whose traffic_percentage must sum to 100. folder_id and each variant's locked are optional; an omitted folder leaves the test at the root.
Was this page helpful?
⌘I
Create an A/B test
curl --request POST \
--url https://api.vturb.com/v1/ab_tests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Home page test",
"folder_id": "66a0c1d2e3f4a5b6c7d8e9f0",
"variants": [
{
"video_id": "68c1f0a00000000000000e01",
"traffic_percentage": 60.5,
"locked": false
},
{
"video_id": "68c1f0a00000000000000e02",
"traffic_percentage": 39.5,
"locked": true
}
]
}
'import requests
url = "https://api.vturb.com/v1/ab_tests"
payload = {
"name": "Home page test",
"folder_id": "66a0c1d2e3f4a5b6c7d8e9f0",
"variants": [
{
"video_id": "68c1f0a00000000000000e01",
"traffic_percentage": 60.5,
"locked": False
},
{
"video_id": "68c1f0a00000000000000e02",
"traffic_percentage": 39.5,
"locked": True
}
]
}
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({
name: 'Home page test',
folder_id: '66a0c1d2e3f4a5b6c7d8e9f0',
variants: [
{video_id: '68c1f0a00000000000000e01', traffic_percentage: 60.5, locked: false},
{video_id: '68c1f0a00000000000000e02', traffic_percentage: 39.5, locked: true}
]
})
};
fetch('https://api.vturb.com/v1/ab_tests', 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.vturb.com/v1/ab_tests",
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' => 'Home page test',
'folder_id' => '66a0c1d2e3f4a5b6c7d8e9f0',
'variants' => [
[
'video_id' => '68c1f0a00000000000000e01',
'traffic_percentage' => 60.5,
'locked' => false
],
[
'video_id' => '68c1f0a00000000000000e02',
'traffic_percentage' => 39.5,
'locked' => true
]
]
]),
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.vturb.com/v1/ab_tests"
payload := strings.NewReader("{\n \"name\": \"Home page test\",\n \"folder_id\": \"66a0c1d2e3f4a5b6c7d8e9f0\",\n \"variants\": [\n {\n \"video_id\": \"68c1f0a00000000000000e01\",\n \"traffic_percentage\": 60.5,\n \"locked\": false\n },\n {\n \"video_id\": \"68c1f0a00000000000000e02\",\n \"traffic_percentage\": 39.5,\n \"locked\": true\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.vturb.com/v1/ab_tests")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Home page test\",\n \"folder_id\": \"66a0c1d2e3f4a5b6c7d8e9f0\",\n \"variants\": [\n {\n \"video_id\": \"68c1f0a00000000000000e01\",\n \"traffic_percentage\": 60.5,\n \"locked\": false\n },\n {\n \"video_id\": \"68c1f0a00000000000000e02\",\n \"traffic_percentage\": 39.5,\n \"locked\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.vturb.com/v1/ab_tests")
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\": \"Home page test\",\n \"folder_id\": \"66a0c1d2e3f4a5b6c7d8e9f0\",\n \"variants\": [\n {\n \"video_id\": \"68c1f0a00000000000000e01\",\n \"traffic_percentage\": 60.5,\n \"locked\": false\n },\n {\n \"video_id\": \"68c1f0a00000000000000e02\",\n \"traffic_percentage\": 39.5,\n \"locked\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "68c1f0a0000000000000ab01",
"status": "draft",
"name": "Home page test",
"folder_id": null,
"started_at": null,
"created_at": "2026-09-01T12:00:00.000Z",
"updated_at": "2026-09-02T12:00:00.000Z",
"variants": [
{
"video_id": "68c1f0a00000000000000e01",
"traffic_percentage": 60,
"locked": false,
"started_at": null
},
{
"video_id": "68c1f0a00000000000000e02",
"traffic_percentage": 40,
"locked": false,
"started_at": null
}
]
}{
"type": "https://docs.vturb.com/errors/bad_request",
"code": "bad_request",
"message": "The request includes fields this endpoint does not accept.",
"field": "started_at",
"request_id": "00000000-0000-0000-0000-000000000000"
}{
"type": "https://docs.vturb.com/errors/unauthorized",
"code": "unauthorized",
"message": "Missing or invalid API credential. Send a vt_ token in the Authorization header.",
"request_id": "00000000-0000-0000-0000-000000000000"
}{
"type": "https://docs.vturb.com/errors/forbidden",
"code": "forbidden",
"message": "The credential is missing the scope this action requires.",
"request_id": "00000000-0000-0000-0000-000000000000"
}{
"type": "https://docs.vturb.com/errors/unprocessable_content",
"code": "unprocessable_content",
"message": "The request is invalid. See errors for the fields that failed.",
"request_id": "00000000-0000-0000-0000-000000000000",
"errors": [
{
"field": "variants",
"message": "must be an array"
}
]
}{
"type": "https://docs.vturb.com/errors/service_unavailable",
"code": "service_unavailable",
"message": "The service is temporarily unavailable. Retry shortly.",
"request_id": "00000000-0000-0000-0000-000000000000"
}