Update an evaluator scenario
Updates the specified evaluator scenario.
PATCH
/
ai
/
tests
/
test_framework
/
v1
/
scenarios
/
{id}
Update an evaluator scenario
curl --request PATCH \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Refund escalation flow - updated",
"instructions": "Call the support line, demand a refund, and mention the damaged packaging.",
"metrics": [
266881,
266882
]
}
'import requests
url = "https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id}"
payload = {
"name": "Refund escalation flow - updated",
"instructions": "Call the support line, demand a refund, and mention the damaged packaging.",
"metrics": [266881, 266882]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Refund escalation flow - updated',
instructions: 'Call the support line, demand a refund, and mention the damaged packaging.',
metrics: [266881, 266882]
})
};
fetch('https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{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.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Refund escalation flow - updated',
'instructions' => 'Call the support line, demand a refund, and mention the damaged packaging.',
'metrics' => [
266881,
266882
]
]),
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.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id}"
payload := strings.NewReader("{\n \"name\": \"Refund escalation flow - updated\",\n \"instructions\": \"Call the support line, demand a refund, and mention the damaged packaging.\",\n \"metrics\": [\n 266881,\n 266882\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Refund escalation flow - updated\",\n \"instructions\": \"Call the support line, demand a refund, and mention the damaged packaging.\",\n \"metrics\": [\n 266881,\n 266882\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Refund escalation flow - updated\",\n \"instructions\": \"Call the support line, demand a refund, and mention the damaged packaging.\",\n \"metrics\": [\n 266881,\n 266882\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 9512,
"name": "Refund escalation flow",
"agent": 1259,
"project": null,
"personality": 4643,
"personality_name": "Interruptive (High)",
"tags": [
"support",
"regression"
],
"tool_ids": [],
"runs": [],
"metrics": [
266881,
266882
],
"metric_names": [
"AI interrupting user",
"Average Pitch (in Hz)"
],
"phone_number": "+13125550188",
"outbound_phone_number_data": null,
"first_message": "Hi, I want a refund.",
"inbound_phone_number": null,
"inbound_phone_number_data": null,
"instructions": "Call the support line and demand a refund for a damaged product.",
"simulation_description": "Simulates an impatient customer demanding a refund.",
"information_fields": null,
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"scenario_language": "en",
"scenario_type": "workflow",
"suite_type": "predefined",
"is_predefined": false,
"test_profile": null,
"test_profile_data": null,
"dynamic_variable_values": null,
"folder_path": null,
"max_duration": null
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The AI Tests service rejected the request."
}
]
}{
"errors": [
{
"code": "10003",
"title": "Unauthorized",
"detail": "The API key is missing or invalid."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Not Found",
"detail": "The requested resource or URL could not be found."
}
]
}{
"errors": [
{
"code": "10018",
"title": "Unprocessable Entity",
"detail": "Validation failed for the request payload."
}
]
}{
"errors": [
{
"code": "10029",
"title": "Too Many Requests",
"detail": "Too many requests; retry later."
}
]
}{
"errors": [
{
"code": "10063",
"title": "Service Unavailable",
"detail": "The test framework service is temporarily unavailable."
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Numeric ID of the evaluator scenario.
Body
application/json
Response
Updated evaluator scenario.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?
Update an evaluator scenario
curl --request PATCH \
--url https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Refund escalation flow - updated",
"instructions": "Call the support line, demand a refund, and mention the damaged packaging.",
"metrics": [
266881,
266882
]
}
'import requests
url = "https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id}"
payload = {
"name": "Refund escalation flow - updated",
"instructions": "Call the support line, demand a refund, and mention the damaged packaging.",
"metrics": [266881, 266882]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Refund escalation flow - updated',
instructions: 'Call the support line, demand a refund, and mention the damaged packaging.',
metrics: [266881, 266882]
})
};
fetch('https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{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.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Refund escalation flow - updated',
'instructions' => 'Call the support line, demand a refund, and mention the damaged packaging.',
'metrics' => [
266881,
266882
]
]),
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.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id}"
payload := strings.NewReader("{\n \"name\": \"Refund escalation flow - updated\",\n \"instructions\": \"Call the support line, demand a refund, and mention the damaged packaging.\",\n \"metrics\": [\n 266881,\n 266882\n ]\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Refund escalation flow - updated\",\n \"instructions\": \"Call the support line, demand a refund, and mention the damaged packaging.\",\n \"metrics\": [\n 266881,\n 266882\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.telnyx.com/v2/ai/tests/test_framework/v1/scenarios/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Refund escalation flow - updated\",\n \"instructions\": \"Call the support line, demand a refund, and mention the damaged packaging.\",\n \"metrics\": [\n 266881,\n 266882\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": 9512,
"name": "Refund escalation flow",
"agent": 1259,
"project": null,
"personality": 4643,
"personality_name": "Interruptive (High)",
"tags": [
"support",
"regression"
],
"tool_ids": [],
"runs": [],
"metrics": [
266881,
266882
],
"metric_names": [
"AI interrupting user",
"Average Pitch (in Hz)"
],
"phone_number": "+13125550188",
"outbound_phone_number_data": null,
"first_message": "Hi, I want a refund.",
"inbound_phone_number": null,
"inbound_phone_number_data": null,
"instructions": "Call the support line and demand a refund for a damaged product.",
"simulation_description": "Simulates an impatient customer demanding a refund.",
"information_fields": null,
"expected_outcome_prompt": "The assistant explains the refund policy and offers escalation.",
"scenario_language": "en",
"scenario_type": "workflow",
"suite_type": "predefined",
"is_predefined": false,
"test_profile": null,
"test_profile_data": null,
"dynamic_variable_values": null,
"folder_path": null,
"max_duration": null
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The AI Tests service rejected the request."
}
]
}{
"errors": [
{
"code": "10003",
"title": "Unauthorized",
"detail": "The API key is missing or invalid."
}
]
}{
"errors": [
{
"code": "10005",
"title": "Not Found",
"detail": "The requested resource or URL could not be found."
}
]
}{
"errors": [
{
"code": "10018",
"title": "Unprocessable Entity",
"detail": "Validation failed for the request payload."
}
]
}{
"errors": [
{
"code": "10029",
"title": "Too Many Requests",
"detail": "Too many requests; retry later."
}
]
}{
"errors": [
{
"code": "10063",
"title": "Service Unavailable",
"detail": "The test framework service is temporarily unavailable."
}
]
}