Create a website test
curl --request POST \
--url https://api.revdesk.com/v1/optimize/tests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"page_url": "<string>",
"variants": [
{
"name": "<string>",
"ops": [
{
"selector": "<string>",
"op": "setText",
"value": "<string>",
"nth": 4503599627370495
}
],
"hypothesis": "<string>",
"weight": 5
}
],
"property_id": "<string>",
"goal_id": "<string>",
"hypothesis": "<string>",
"traffic_split": 0.525,
"start": true
}
'import requests
url = "https://api.revdesk.com/v1/optimize/tests"
payload = {
"name": "<string>",
"page_url": "<string>",
"variants": [
{
"name": "<string>",
"ops": [
{
"selector": "<string>",
"op": "setText",
"value": "<string>",
"nth": 4503599627370495
}
],
"hypothesis": "<string>",
"weight": 5
}
],
"property_id": "<string>",
"goal_id": "<string>",
"hypothesis": "<string>",
"traffic_split": 0.525,
"start": 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: '<string>',
page_url: '<string>',
variants: [
{
name: '<string>',
ops: [
{selector: '<string>', op: 'setText', value: '<string>', nth: 4503599627370495}
],
hypothesis: '<string>',
weight: 5
}
],
property_id: '<string>',
goal_id: '<string>',
hypothesis: '<string>',
traffic_split: 0.525,
start: true
})
};
fetch('https://api.revdesk.com/v1/optimize/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.revdesk.com/v1/optimize/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' => '<string>',
'page_url' => '<string>',
'variants' => [
[
'name' => '<string>',
'ops' => [
[
'selector' => '<string>',
'op' => 'setText',
'value' => '<string>',
'nth' => 4503599627370495
]
],
'hypothesis' => '<string>',
'weight' => 5
]
],
'property_id' => '<string>',
'goal_id' => '<string>',
'hypothesis' => '<string>',
'traffic_split' => 0.525,
'start' => 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.revdesk.com/v1/optimize/tests"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"page_url\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"<string>\",\n \"ops\": [\n {\n \"selector\": \"<string>\",\n \"op\": \"setText\",\n \"value\": \"<string>\",\n \"nth\": 4503599627370495\n }\n ],\n \"hypothesis\": \"<string>\",\n \"weight\": 5\n }\n ],\n \"property_id\": \"<string>\",\n \"goal_id\": \"<string>\",\n \"hypothesis\": \"<string>\",\n \"traffic_split\": 0.525,\n \"start\": true\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.revdesk.com/v1/optimize/tests")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"page_url\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"<string>\",\n \"ops\": [\n {\n \"selector\": \"<string>\",\n \"op\": \"setText\",\n \"value\": \"<string>\",\n \"nth\": 4503599627370495\n }\n ],\n \"hypothesis\": \"<string>\",\n \"weight\": 5\n }\n ],\n \"property_id\": \"<string>\",\n \"goal_id\": \"<string>\",\n \"hypothesis\": \"<string>\",\n \"traffic_split\": 0.525,\n \"start\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.revdesk.com/v1/optimize/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\": \"<string>\",\n \"page_url\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"<string>\",\n \"ops\": [\n {\n \"selector\": \"<string>\",\n \"op\": \"setText\",\n \"value\": \"<string>\",\n \"nth\": 4503599627370495\n }\n ],\n \"hypothesis\": \"<string>\",\n \"weight\": 5\n }\n ],\n \"property_id\": \"<string>\",\n \"goal_id\": \"<string>\",\n \"hypothesis\": \"<string>\",\n \"traffic_split\": 0.525,\n \"start\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"hypothesis": "<string>",
"status": "draft",
"kind": "variation",
"page_url": "<string>",
"url_match_type": "exact",
"goal": {
"id": "<string>",
"type": "form_submit",
"selector": "<string>",
"url_pattern": "<string>"
},
"traffic_split": 123,
"variants": [
{
"id": "<string>",
"name": "<string>",
"is_control": true,
"weight": 123,
"ops": [
{
"selector": "<string>",
"op": "setText",
"value": "<string>",
"nth": 4503599627370495
}
],
"redirect_url": "<string>"
}
],
"started_at": "<string>",
"completed_at": "<string>",
"shipped_at": "<string>",
"winner_variant_id": "<string>",
"created_at": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}Optimize
Create a website test
Creates a test on one page with a control plus the variants you send. Each variant is a list of DOM operations (text, attributes, classes, inline style, hide, link targets) applied by the tag. Pass a goal to create one or goal_id to reuse one. With start: true the test begins immediately; otherwise it is saved as a draft.
POST
/
v1
/
optimize
/
tests
Create a website test
curl --request POST \
--url https://api.revdesk.com/v1/optimize/tests \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"page_url": "<string>",
"variants": [
{
"name": "<string>",
"ops": [
{
"selector": "<string>",
"op": "setText",
"value": "<string>",
"nth": 4503599627370495
}
],
"hypothesis": "<string>",
"weight": 5
}
],
"property_id": "<string>",
"goal_id": "<string>",
"hypothesis": "<string>",
"traffic_split": 0.525,
"start": true
}
'import requests
url = "https://api.revdesk.com/v1/optimize/tests"
payload = {
"name": "<string>",
"page_url": "<string>",
"variants": [
{
"name": "<string>",
"ops": [
{
"selector": "<string>",
"op": "setText",
"value": "<string>",
"nth": 4503599627370495
}
],
"hypothesis": "<string>",
"weight": 5
}
],
"property_id": "<string>",
"goal_id": "<string>",
"hypothesis": "<string>",
"traffic_split": 0.525,
"start": 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: '<string>',
page_url: '<string>',
variants: [
{
name: '<string>',
ops: [
{selector: '<string>', op: 'setText', value: '<string>', nth: 4503599627370495}
],
hypothesis: '<string>',
weight: 5
}
],
property_id: '<string>',
goal_id: '<string>',
hypothesis: '<string>',
traffic_split: 0.525,
start: true
})
};
fetch('https://api.revdesk.com/v1/optimize/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.revdesk.com/v1/optimize/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' => '<string>',
'page_url' => '<string>',
'variants' => [
[
'name' => '<string>',
'ops' => [
[
'selector' => '<string>',
'op' => 'setText',
'value' => '<string>',
'nth' => 4503599627370495
]
],
'hypothesis' => '<string>',
'weight' => 5
]
],
'property_id' => '<string>',
'goal_id' => '<string>',
'hypothesis' => '<string>',
'traffic_split' => 0.525,
'start' => 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.revdesk.com/v1/optimize/tests"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"page_url\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"<string>\",\n \"ops\": [\n {\n \"selector\": \"<string>\",\n \"op\": \"setText\",\n \"value\": \"<string>\",\n \"nth\": 4503599627370495\n }\n ],\n \"hypothesis\": \"<string>\",\n \"weight\": 5\n }\n ],\n \"property_id\": \"<string>\",\n \"goal_id\": \"<string>\",\n \"hypothesis\": \"<string>\",\n \"traffic_split\": 0.525,\n \"start\": true\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.revdesk.com/v1/optimize/tests")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"page_url\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"<string>\",\n \"ops\": [\n {\n \"selector\": \"<string>\",\n \"op\": \"setText\",\n \"value\": \"<string>\",\n \"nth\": 4503599627370495\n }\n ],\n \"hypothesis\": \"<string>\",\n \"weight\": 5\n }\n ],\n \"property_id\": \"<string>\",\n \"goal_id\": \"<string>\",\n \"hypothesis\": \"<string>\",\n \"traffic_split\": 0.525,\n \"start\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.revdesk.com/v1/optimize/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\": \"<string>\",\n \"page_url\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"<string>\",\n \"ops\": [\n {\n \"selector\": \"<string>\",\n \"op\": \"setText\",\n \"value\": \"<string>\",\n \"nth\": 4503599627370495\n }\n ],\n \"hypothesis\": \"<string>\",\n \"weight\": 5\n }\n ],\n \"property_id\": \"<string>\",\n \"goal_id\": \"<string>\",\n \"hypothesis\": \"<string>\",\n \"traffic_split\": 0.525,\n \"start\": true\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"name": "<string>",
"hypothesis": "<string>",
"status": "draft",
"kind": "variation",
"page_url": "<string>",
"url_match_type": "exact",
"goal": {
"id": "<string>",
"type": "form_submit",
"selector": "<string>",
"url_pattern": "<string>"
},
"traffic_split": 123,
"variants": [
{
"id": "<string>",
"name": "<string>",
"is_control": true,
"weight": 123,
"ops": [
{
"selector": "<string>",
"op": "setText",
"value": "<string>",
"nth": 4503599627370495
}
],
"redirect_url": "<string>"
}
],
"started_at": "<string>",
"completed_at": "<string>",
"shipped_at": "<string>",
"winner_variant_id": "<string>",
"created_at": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resolution_hint": "<string>",
"fields": {},
"doc_url": "<string>"
}
}Authorizations
Organization-scoped RevDesk API key. Each operation declares its required permissions in x-required-scopes.
Headers
UUID — when present, deduplicates repeat submissions. See /api-reference/idempotency.
Body
application/json
Required string length:
1 - 120Required string length:
1 - 2048Required array length:
1 - 5 elementsShow child attributes
Show child attributes
Minimum string length:
1Available options:
exact, prefix, regex Show child attributes
Show child attributes
Minimum string length:
1Maximum string length:
400Required range:
0.05 <= x <= 1Response
Success
Show child attributes
Show child attributes