curl --request PUT \
--url https://api.naturalead.ai/api/ab-tests/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"variants": [
{
"agentConfigId": "<string>",
"weight": 50.5
}
]
}
'import requests
url = "https://api.naturalead.ai/api/ab-tests/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"variants": [
{
"agentConfigId": "<string>",
"weight": 50.5
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
variants: [{agentConfigId: '<string>', weight: 50.5}]
})
};
fetch('https://api.naturalead.ai/api/ab-tests/{id}', 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.naturalead.ai/api/ab-tests/{id}",
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([
'name' => '<string>',
'description' => '<string>',
'variants' => [
[
'agentConfigId' => '<string>',
'weight' => 50.5
]
]
]),
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.naturalead.ai/api/ab-tests/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"agentConfigId\": \"<string>\",\n \"weight\": 50.5\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.naturalead.ai/api/ab-tests/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"agentConfigId\": \"<string>\",\n \"weight\": 50.5\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.naturalead.ai/api/ab-tests/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"agentConfigId\": \"<string>\",\n \"weight\": 50.5\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"accountId": "<string>",
"name": "<string>",
"status": "draft",
"variants": [
{
"agentConfigId": "<string>",
"weight": 50.5
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "<string>"
}{
"error": "At least two variants are required"
}{
"error": "A/B test not found"
}{
"error": "Failed to process request"
}Update A/B Test
Updates an existing A/B test. Only tests in draft status can have their
variants modified. Name and description can be updated in any status.
Requires ab_testing:manage permission.
curl --request PUT \
--url https://api.naturalead.ai/api/ab-tests/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"variants": [
{
"agentConfigId": "<string>",
"weight": 50.5
}
]
}
'import requests
url = "https://api.naturalead.ai/api/ab-tests/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"variants": [
{
"agentConfigId": "<string>",
"weight": 50.5
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
variants: [{agentConfigId: '<string>', weight: 50.5}]
})
};
fetch('https://api.naturalead.ai/api/ab-tests/{id}', 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.naturalead.ai/api/ab-tests/{id}",
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([
'name' => '<string>',
'description' => '<string>',
'variants' => [
[
'agentConfigId' => '<string>',
'weight' => 50.5
]
]
]),
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.naturalead.ai/api/ab-tests/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"agentConfigId\": \"<string>\",\n \"weight\": 50.5\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.naturalead.ai/api/ab-tests/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"agentConfigId\": \"<string>\",\n \"weight\": 50.5\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.naturalead.ai/api/ab-tests/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"variants\": [\n {\n \"agentConfigId\": \"<string>\",\n \"weight\": 50.5\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"_id": "<string>",
"accountId": "<string>",
"name": "<string>",
"status": "draft",
"variants": [
{
"agentConfigId": "<string>",
"weight": 50.5
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"description": "<string>"
}{
"error": "At least two variants are required"
}{
"error": "A/B test not found"
}{
"error": "Failed to process request"
}Authorizations
Bearer token using an API key (format: nl_live_* or nl_test_*).
Path Parameters
A/B test ID (MongoDB ObjectId)
"665a1b2c3d4e5f6a7b8c9d0e"
Body
Request body for updating an A/B test. All fields are optional; only provided fields will be updated. Variants can only be modified while the test is in draft status.
Response
A/B test updated successfully
An A/B test comparing multiple agent configurations.
Unique A/B test identifier
Account that owns this A/B test
A/B test display name
Current test lifecycle status
draft, running, paused, completed Agent configuration variants being compared
2Show child attributes
Show child attributes
Optional description of the test hypothesis