curl --request PUT \
--url https://api.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'cloudchat-instance: <cloudchat-instance>' \
--data '
{
"percentages": {
"short_summary": 20
},
"baselinePercentage": 80
}
'import requests
url = "https://api.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic"
payload = {
"percentages": { "short_summary": 20 },
"baselinePercentage": 80
}
headers = {
"cloudchat-instance": "<cloudchat-instance>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'cloudchat-instance': '<cloudchat-instance>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({percentages: {short_summary: 20}, baselinePercentage: 80})
};
fetch('https://api.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic', 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.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'percentages' => [
'short_summary' => 20
],
'baselinePercentage' => 80
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"cloudchat-instance: <cloudchat-instance>"
],
]);
$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.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic"
payload := strings.NewReader("{\n \"percentages\": {\n \"short_summary\": 20\n },\n \"baselinePercentage\": 80\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("cloudchat-instance", "<cloudchat-instance>")
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.put("https://api.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic")
.header("cloudchat-instance", "<cloudchat-instance>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"percentages\": {\n \"short_summary\": 20\n },\n \"baselinePercentage\": 80\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["cloudchat-instance"] = '<cloudchat-instance>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"percentages\": {\n \"short_summary\": 20\n },\n \"baselinePercentage\": 80\n}"
response = http.request(request)
puts response.read_body{
"baselinePercentage": 80,
"variants": [
{
"key": "short_summary",
"percentage": 20,
"editable": true,
"overrides": {
"summaryPrompt": "Resuma em uma frase."
},
"hiddenOverrideCount": 0
}
]
}{
"error": "The base share does not match the variants' traffic",
"reason": "baseline_mismatch",
"keys": [
"<string>"
],
"expectedBaselinePercentage": 80,
"violations": [
{
"path": "splitLargeMessages.chunkSize",
"ruleId": "value_out_of_range",
"params": {
"min": 1,
"max": 4096
}
}
]
}{
"error": "The base share does not match the variants' traffic",
"reason": "baseline_mismatch",
"keys": [
"<string>"
],
"expectedBaselinePercentage": 80,
"violations": [
{
"path": "splitLargeMessages.chunkSize",
"ruleId": "value_out_of_range",
"params": {
"min": 1,
"max": 4096
}
}
]
}{
"error": "Forbidden: token holds no claim for the requested account"
}{
"error": "The base share does not match the variants' traffic",
"reason": "baseline_mismatch",
"keys": [
"<string>"
],
"expectedBaselinePercentage": 80,
"violations": [
{
"path": "splitLargeMessages.chunkSize",
"ruleId": "value_out_of_range",
"params": {
"min": 1,
"max": 4096
}
}
]
}Split new conversations between the base and the variants
Replaces the whole traffic split: each variant named gets its percentage, any variant left out gets 0, and the rest stays on the base configuration. Send baselinePercentage with what you expect to stay on the base; if it does not match, the call answers 409 with the right number and saves nothing. Setting a variant to 0 pauses it. The split decides only what NEW conversations draw: a conversation keeps the variant it drew until it ends, so pausing a variant does not move the ones already running it. A variant you cannot edit can be kept at its current percentage, never changed.
curl --request PUT \
--url https://api.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'cloudchat-instance: <cloudchat-instance>' \
--data '
{
"percentages": {
"short_summary": 20
},
"baselinePercentage": 80
}
'import requests
url = "https://api.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic"
payload = {
"percentages": { "short_summary": 20 },
"baselinePercentage": 80
}
headers = {
"cloudchat-instance": "<cloudchat-instance>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
'cloudchat-instance': '<cloudchat-instance>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({percentages: {short_summary: 20}, baselinePercentage: 80})
};
fetch('https://api.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic', 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.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'percentages' => [
'short_summary' => 20
],
'baselinePercentage' => 80
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"cloudchat-instance: <cloudchat-instance>"
],
]);
$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.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic"
payload := strings.NewReader("{\n \"percentages\": {\n \"short_summary\": 20\n },\n \"baselinePercentage\": 80\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("cloudchat-instance", "<cloudchat-instance>")
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.put("https://api.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic")
.header("cloudchat-instance", "<cloudchat-instance>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"percentages\": {\n \"short_summary\": 20\n },\n \"baselinePercentage\": 80\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cloudhumans.com/claudia/v1/projects/{project}/ab-test/traffic")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["cloudchat-instance"] = '<cloudchat-instance>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"percentages\": {\n \"short_summary\": 20\n },\n \"baselinePercentage\": 80\n}"
response = http.request(request)
puts response.read_body{
"baselinePercentage": 80,
"variants": [
{
"key": "short_summary",
"percentage": 20,
"editable": true,
"overrides": {
"summaryPrompt": "Resuma em uma frase."
},
"hiddenOverrideCount": 0
}
]
}{
"error": "The base share does not match the variants' traffic",
"reason": "baseline_mismatch",
"keys": [
"<string>"
],
"expectedBaselinePercentage": 80,
"violations": [
{
"path": "splitLargeMessages.chunkSize",
"ruleId": "value_out_of_range",
"params": {
"min": 1,
"max": 4096
}
}
]
}{
"error": "The base share does not match the variants' traffic",
"reason": "baseline_mismatch",
"keys": [
"<string>"
],
"expectedBaselinePercentage": 80,
"violations": [
{
"path": "splitLargeMessages.chunkSize",
"ruleId": "value_out_of_range",
"params": {
"min": 1,
"max": 4096
}
}
]
}{
"error": "Forbidden: token holds no claim for the requested account"
}{
"error": "The base share does not match the variants' traffic",
"reason": "baseline_mismatch",
"keys": [
"<string>"
],
"expectedBaselinePercentage": 80,
"violations": [
{
"path": "splitLargeMessages.chunkSize",
"ruleId": "value_out_of_range",
"params": {
"min": 1,
"max": 4096
}
}
]
}Authorizations
Headers
Path Parameters
Query Parameters
The CloudChat account whose permissions decide what you may read and write here, e.g. 7. It is permission context, not the resource: the project is named in the path. Only unique within an instance, so it is always read together with the cloudchat-instance header — get the pair from listMyCloudChatAccounts. An account your credentials hold no editing claim for answers 403.
Body
The whole traffic split, sent at once. A variant left out receives no traffic.
Response
Saved. The whole A/B test is returned as it now stands.
How this project's conversations are split between its base configuration and each A/B variant. Every new conversation draws once and keeps the variant it drew until it ends, always running that variant's current settings.