curl --request PATCH \
--url https://api.coval.dev/v1/test-cases/{test_case_id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"input_str": "What is the weather today?",
"test_set_id": "newset12",
"expected_behaviors": [
"The weather is sunny."
],
"expected_output_str": "The weather is sunny.",
"expected_output_json": {},
"description": "Updated description",
"input_type": "SCRIPT",
"simulation_metadata_input": {},
"metric_input": {},
"user_notes": "Updated notes"
}
'import requests
url = "https://api.coval.dev/v1/test-cases/{test_case_id}"
payload = {
"input_str": "What is the weather today?",
"test_set_id": "newset12",
"expected_behaviors": ["The weather is sunny."],
"expected_output_str": "The weather is sunny.",
"expected_output_json": {},
"description": "Updated description",
"input_type": "SCRIPT",
"simulation_metadata_input": {},
"metric_input": {},
"user_notes": "Updated notes"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input_str: 'What is the weather today?',
test_set_id: 'newset12',
expected_behaviors: ['The weather is sunny.'],
expected_output_str: 'The weather is sunny.',
expected_output_json: {},
description: 'Updated description',
input_type: 'SCRIPT',
simulation_metadata_input: {},
metric_input: {},
user_notes: 'Updated notes'
})
};
fetch('https://api.coval.dev/v1/test-cases/{test_case_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.coval.dev/v1/test-cases/{test_case_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([
'input_str' => 'What is the weather today?',
'test_set_id' => 'newset12',
'expected_behaviors' => [
'The weather is sunny.'
],
'expected_output_str' => 'The weather is sunny.',
'expected_output_json' => [
],
'description' => 'Updated description',
'input_type' => 'SCRIPT',
'simulation_metadata_input' => [
],
'metric_input' => [
],
'user_notes' => 'Updated notes'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-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.coval.dev/v1/test-cases/{test_case_id}"
payload := strings.NewReader("{\n \"input_str\": \"What is the weather today?\",\n \"test_set_id\": \"newset12\",\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Updated description\",\n \"input_type\": \"SCRIPT\",\n \"simulation_metadata_input\": {},\n \"metric_input\": {},\n \"user_notes\": \"Updated notes\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-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.patch("https://api.coval.dev/v1/test-cases/{test_case_id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"input_str\": \"What is the weather today?\",\n \"test_set_id\": \"newset12\",\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Updated description\",\n \"input_type\": \"SCRIPT\",\n \"simulation_metadata_input\": {},\n \"metric_input\": {},\n \"user_notes\": \"Updated notes\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coval.dev/v1/test-cases/{test_case_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input_str\": \"What is the weather today?\",\n \"test_set_id\": \"newset12\",\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Updated description\",\n \"input_type\": \"SCRIPT\",\n \"simulation_metadata_input\": {},\n \"metric_input\": {},\n \"user_notes\": \"Updated notes\"\n}"
response = http.request(request)
puts response.read_body{
"test_case": {
"name": "test-cases/abc123def456ghi789jklm",
"id": "abc123def456ghi789jklm",
"test_set_id": "abc12345",
"input_str": "What is the weather today?",
"expected_output_str": "The weather is sunny with a high of 75 degrees.",
"expected_output_json": {
"temperature": 75,
"condition": "sunny"
},
"description": "Test case for weather query with sunny conditions",
"input_type": "SCENARIO",
"simulation_metadata_input": {
"script_turns": [
"Hi, I'd like to check my account balance.",
"Yes, my account number is 12345.",
"Thank you, goodbye."
]
},
"metric_input": {
"expected_entities": [
"weather",
"temperature"
]
},
"user_notes": "Added for regression testing weather queries",
"create_time": "2025-10-14T12:00:00Z",
"update_time": "2025-10-15T14:30:00Z"
}
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Invalid request parameters",
"details": [
{
"field": "input_str",
"description": "input_str is required and cannot be empty"
}
]
}
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication failed",
"details": [
{
"field": "X-API-Key",
"description": "Invalid or missing API key"
}
]
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Test case not found",
"details": [
{
"field": "test_case_id",
"description": "Test case 'abc123def456ghi789jklm' not found"
}
]
}
}{
"error": {
"code": "INTERNAL",
"message": "Internal server error",
"details": [
{
"description": "An unexpected error occurred while processing the request"
}
]
}
}Update test case
Update a test case.
curl --request PATCH \
--url https://api.coval.dev/v1/test-cases/{test_case_id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"input_str": "What is the weather today?",
"test_set_id": "newset12",
"expected_behaviors": [
"The weather is sunny."
],
"expected_output_str": "The weather is sunny.",
"expected_output_json": {},
"description": "Updated description",
"input_type": "SCRIPT",
"simulation_metadata_input": {},
"metric_input": {},
"user_notes": "Updated notes"
}
'import requests
url = "https://api.coval.dev/v1/test-cases/{test_case_id}"
payload = {
"input_str": "What is the weather today?",
"test_set_id": "newset12",
"expected_behaviors": ["The weather is sunny."],
"expected_output_str": "The weather is sunny.",
"expected_output_json": {},
"description": "Updated description",
"input_type": "SCRIPT",
"simulation_metadata_input": {},
"metric_input": {},
"user_notes": "Updated notes"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input_str: 'What is the weather today?',
test_set_id: 'newset12',
expected_behaviors: ['The weather is sunny.'],
expected_output_str: 'The weather is sunny.',
expected_output_json: {},
description: 'Updated description',
input_type: 'SCRIPT',
simulation_metadata_input: {},
metric_input: {},
user_notes: 'Updated notes'
})
};
fetch('https://api.coval.dev/v1/test-cases/{test_case_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.coval.dev/v1/test-cases/{test_case_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([
'input_str' => 'What is the weather today?',
'test_set_id' => 'newset12',
'expected_behaviors' => [
'The weather is sunny.'
],
'expected_output_str' => 'The weather is sunny.',
'expected_output_json' => [
],
'description' => 'Updated description',
'input_type' => 'SCRIPT',
'simulation_metadata_input' => [
],
'metric_input' => [
],
'user_notes' => 'Updated notes'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-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.coval.dev/v1/test-cases/{test_case_id}"
payload := strings.NewReader("{\n \"input_str\": \"What is the weather today?\",\n \"test_set_id\": \"newset12\",\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Updated description\",\n \"input_type\": \"SCRIPT\",\n \"simulation_metadata_input\": {},\n \"metric_input\": {},\n \"user_notes\": \"Updated notes\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-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.patch("https://api.coval.dev/v1/test-cases/{test_case_id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"input_str\": \"What is the weather today?\",\n \"test_set_id\": \"newset12\",\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Updated description\",\n \"input_type\": \"SCRIPT\",\n \"simulation_metadata_input\": {},\n \"metric_input\": {},\n \"user_notes\": \"Updated notes\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coval.dev/v1/test-cases/{test_case_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input_str\": \"What is the weather today?\",\n \"test_set_id\": \"newset12\",\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Updated description\",\n \"input_type\": \"SCRIPT\",\n \"simulation_metadata_input\": {},\n \"metric_input\": {},\n \"user_notes\": \"Updated notes\"\n}"
response = http.request(request)
puts response.read_body{
"test_case": {
"name": "test-cases/abc123def456ghi789jklm",
"id": "abc123def456ghi789jklm",
"test_set_id": "abc12345",
"input_str": "What is the weather today?",
"expected_output_str": "The weather is sunny with a high of 75 degrees.",
"expected_output_json": {
"temperature": 75,
"condition": "sunny"
},
"description": "Test case for weather query with sunny conditions",
"input_type": "SCENARIO",
"simulation_metadata_input": {
"script_turns": [
"Hi, I'd like to check my account balance.",
"Yes, my account number is 12345.",
"Thank you, goodbye."
]
},
"metric_input": {
"expected_entities": [
"weather",
"temperature"
]
},
"user_notes": "Added for regression testing weather queries",
"create_time": "2025-10-14T12:00:00Z",
"update_time": "2025-10-15T14:30:00Z"
}
}{
"error": {
"code": "INVALID_ARGUMENT",
"message": "Invalid request parameters",
"details": [
{
"field": "input_str",
"description": "input_str is required and cannot be empty"
}
]
}
}{
"error": {
"code": "UNAUTHENTICATED",
"message": "Authentication failed",
"details": [
{
"field": "X-API-Key",
"description": "Invalid or missing API key"
}
]
}
}{
"error": {
"code": "NOT_FOUND",
"message": "Test case not found",
"details": [
{
"field": "test_case_id",
"description": "Test case 'abc123def456ghi789jklm' not found"
}
]
}
}{
"error": {
"code": "INTERNAL",
"message": "Internal server error",
"details": [
{
"description": "An unexpected error occurred while processing the request"
}
]
}
}Authorizations
Organization API key for authentication
Path Parameters
Test case ID
22Body
Update request. Only provided fields will be updated.
Input for the test case
1"What is the weather today?"
Test set ID (can move to different test set)
8"newset12"
Expected behaviors (list of strings). This is the preferred field.
["The weather is sunny."]DEPRECATED: Use expected_behaviors instead. If provided and expected_behaviors is not, this value will be wrapped in a list and used as expected_behaviors.
"The weather is sunny."
Expected output as JSON object
Human-readable description
"Updated description"
Type of input for the test case. When set to SCRIPT, the simulation_metadata_input should contain a script_turns field with ordered persona turn texts.
SCENARIO, TRANSCRIPT, IVR, AUDIO, MANUAL, SCRIPT "SCRIPT"
Metadata for simulation. Contents vary by input_type. When input_type is SCRIPT, include a script_turns field (array of strings) with the ordered lines for the persona to deliver.
Input for metrics
User notes
"Updated notes"
Response
Test case updated successfully
Test case resource.
Show child attributes
Show child attributes
Was this page helpful?