import { SyllableSDK } from "syllable-sdk";
const syllableSDK = new SyllableSDK({
apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});
async function run() {
const result = await syllableSDK.experiments.create({
name: "Shorter greeting",
variants: [
{
name: "b",
weight: 10,
agentId: 1,
},
],
targetId: 1,
});
console.log(result);
}
run();import os
from syllable_sdk import SyllableSDK
with SyllableSDK(
api_key_header=os.getenv("SYLLABLESDK_API_KEY_HEADER", ""),
) as ss_client:
res = ss_client.experiments.create(request={
"name": "Shorter greeting",
"variants": [
{
"name": "b",
"weight": 10,
"agent_id": 1,
},
],
"target_id": 1,
})
# Handle response
print(res)curl --request POST \
--url https://api.syllable.cloud/api/v1/experiments/ \
--header 'Content-Type: application/json' \
--header 'Syllable-API-Key: <api-key>' \
--data '
{
"name": "Shorter greeting",
"target_id": 1,
"description": "<string>",
"variants": [
{
"name": "b",
"weight": 10,
"agent_id": 1,
"is_control": false
}
]
}
'const options = {
method: 'POST',
headers: {'Syllable-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Shorter greeting',
target_id: 1,
description: '<string>',
variants: [{name: 'b', weight: 10, agent_id: 1, is_control: false}]
})
};
fetch('https://api.syllable.cloud/api/v1/experiments/', 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.syllable.cloud/api/v1/experiments/",
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' => 'Shorter greeting',
'target_id' => 1,
'description' => '<string>',
'variants' => [
[
'name' => 'b',
'weight' => 10,
'agent_id' => 1,
'is_control' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Syllable-API-Key: <api-key>"
],
]);
$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.syllable.cloud/api/v1/experiments/"
payload := strings.NewReader("{\n \"name\": \"Shorter greeting\",\n \"target_id\": 1,\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"b\",\n \"weight\": 10,\n \"agent_id\": 1,\n \"is_control\": false\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Syllable-API-Key", "<api-key>")
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.syllable.cloud/api/v1/experiments/")
.header("Syllable-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Shorter greeting\",\n \"target_id\": 1,\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"b\",\n \"weight\": 10,\n \"agent_id\": 1,\n \"is_control\": false\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.syllable.cloud/api/v1/experiments/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Syllable-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Shorter greeting\",\n \"target_id\": 1,\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"b\",\n \"weight\": 10,\n \"agent_id\": 1,\n \"is_control\": false\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"name": "Shorter greeting",
"target_id": 1,
"variants": [
{
"id": 1,
"name": "b",
"weight": 10,
"is_control": true,
"agent_id": 1,
"agent_name": "Front desk"
}
],
"status": "draft",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"last_updated_by": "<string>",
"description": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"stopped_at": "2023-11-07T05:31:56Z",
"target": {
"id": 1,
"target": "+19995551234",
"target_mode": "voice",
"channel_id": 1,
"channel_name": "Main line"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Create Experiment
Create a new experiment.
import { SyllableSDK } from "syllable-sdk";
const syllableSDK = new SyllableSDK({
apiKeyHeader: process.env["SYLLABLESDK_API_KEY_HEADER"] ?? "",
});
async function run() {
const result = await syllableSDK.experiments.create({
name: "Shorter greeting",
variants: [
{
name: "b",
weight: 10,
agentId: 1,
},
],
targetId: 1,
});
console.log(result);
}
run();import os
from syllable_sdk import SyllableSDK
with SyllableSDK(
api_key_header=os.getenv("SYLLABLESDK_API_KEY_HEADER", ""),
) as ss_client:
res = ss_client.experiments.create(request={
"name": "Shorter greeting",
"variants": [
{
"name": "b",
"weight": 10,
"agent_id": 1,
},
],
"target_id": 1,
})
# Handle response
print(res)curl --request POST \
--url https://api.syllable.cloud/api/v1/experiments/ \
--header 'Content-Type: application/json' \
--header 'Syllable-API-Key: <api-key>' \
--data '
{
"name": "Shorter greeting",
"target_id": 1,
"description": "<string>",
"variants": [
{
"name": "b",
"weight": 10,
"agent_id": 1,
"is_control": false
}
]
}
'const options = {
method: 'POST',
headers: {'Syllable-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Shorter greeting',
target_id: 1,
description: '<string>',
variants: [{name: 'b', weight: 10, agent_id: 1, is_control: false}]
})
};
fetch('https://api.syllable.cloud/api/v1/experiments/', 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.syllable.cloud/api/v1/experiments/",
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' => 'Shorter greeting',
'target_id' => 1,
'description' => '<string>',
'variants' => [
[
'name' => 'b',
'weight' => 10,
'agent_id' => 1,
'is_control' => false
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Syllable-API-Key: <api-key>"
],
]);
$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.syllable.cloud/api/v1/experiments/"
payload := strings.NewReader("{\n \"name\": \"Shorter greeting\",\n \"target_id\": 1,\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"b\",\n \"weight\": 10,\n \"agent_id\": 1,\n \"is_control\": false\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Syllable-API-Key", "<api-key>")
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.syllable.cloud/api/v1/experiments/")
.header("Syllable-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Shorter greeting\",\n \"target_id\": 1,\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"b\",\n \"weight\": 10,\n \"agent_id\": 1,\n \"is_control\": false\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.syllable.cloud/api/v1/experiments/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Syllable-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Shorter greeting\",\n \"target_id\": 1,\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"name\": \"b\",\n \"weight\": 10,\n \"agent_id\": 1,\n \"is_control\": false\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 1,
"name": "Shorter greeting",
"target_id": 1,
"variants": [
{
"id": 1,
"name": "b",
"weight": 10,
"is_control": true,
"agent_id": 1,
"agent_name": "Front desk"
}
],
"status": "draft",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"last_updated_by": "<string>",
"description": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"stopped_at": "2023-11-07T05:31:56Z",
"target": {
"id": 1,
"target": "+19995551234",
"target_mode": "voice",
"channel_id": 1,
"channel_name": "Main line"
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Body
Request model to create an experiment.
The name of the experiment
"Shorter greeting"
The channel target being split
1
The hypothesis under test
The variants of the experiment, as a complete set. Two or more, each on a different agent, exactly one of them the control.
Show child attributes
Show child attributes
Response
Successful Response
Response model for experiment operations.
An experiment splits the traffic of one channel target between two or more agents, so that the agents can be compared on the same population. One variant is the control the others are measured against. Each variant is a weighted pointer to the agent that variant runs; the weights are relative and not percentages.
The internal ID of the experiment
1
The name of the experiment
"Shorter greeting"
The channel target being split, or null if that target has since been deleted. A running experiment always has one.
1
The variants of the experiment, in a stable order
Show child attributes
Show child attributes
draft, running, or stopped
draft, running, stopped When the experiment was created
When the experiment was last written
Who last wrote it
The hypothesis under test
When the experiment started
When the experiment stopped
The channel target being split, resolved for display. Null when the target has since been deleted, and when the read did not load it.
Show child attributes
Show child attributes

