curl --request POST \
--url https://api.coval.dev/v1/test-cases \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"input_str": "What is the weather today?",
"test_set_id": "abc12345",
"input_type": "SCENARIO",
"simulation_metadata_input": {},
"expected_behaviors": [
"The weather is sunny."
],
"expected_output_str": "The weather is sunny.",
"expected_output_json": {},
"description": "Test case for weather query",
"script_turns": [
"<string>"
],
"metric_input": {},
"user_notes": "Created for regression testing"
}
'import requests
url = "https://api.coval.dev/v1/test-cases"
payload = {
"input_str": "What is the weather today?",
"test_set_id": "abc12345",
"input_type": "SCENARIO",
"simulation_metadata_input": {},
"expected_behaviors": ["The weather is sunny."],
"expected_output_str": "The weather is sunny.",
"expected_output_json": {},
"description": "Test case for weather query",
"script_turns": ["<string>"],
"metric_input": {},
"user_notes": "Created for regression testing"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input_str: 'What is the weather today?',
test_set_id: 'abc12345',
input_type: 'SCENARIO',
simulation_metadata_input: {},
expected_behaviors: ['The weather is sunny.'],
expected_output_str: 'The weather is sunny.',
expected_output_json: {},
description: 'Test case for weather query',
script_turns: ['<string>'],
metric_input: {},
user_notes: 'Created for regression testing'
})
};
fetch('https://api.coval.dev/v1/test-cases', 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",
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([
'input_str' => 'What is the weather today?',
'test_set_id' => 'abc12345',
'input_type' => 'SCENARIO',
'simulation_metadata_input' => [
],
'expected_behaviors' => [
'The weather is sunny.'
],
'expected_output_str' => 'The weather is sunny.',
'expected_output_json' => [
],
'description' => 'Test case for weather query',
'script_turns' => [
'<string>'
],
'metric_input' => [
],
'user_notes' => 'Created for regression testing'
]),
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"
payload := strings.NewReader("{\n \"input_str\": \"What is the weather today?\",\n \"test_set_id\": \"abc12345\",\n \"input_type\": \"SCENARIO\",\n \"simulation_metadata_input\": {},\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Test case for weather query\",\n \"script_turns\": [\n \"<string>\"\n ],\n \"metric_input\": {},\n \"user_notes\": \"Created for regression testing\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.coval.dev/v1/test-cases")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"input_str\": \"What is the weather today?\",\n \"test_set_id\": \"abc12345\",\n \"input_type\": \"SCENARIO\",\n \"simulation_metadata_input\": {},\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Test case for weather query\",\n \"script_turns\": [\n \"<string>\"\n ],\n \"metric_input\": {},\n \"user_notes\": \"Created for regression testing\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coval.dev/v1/test-cases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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\": \"abc12345\",\n \"input_type\": \"SCENARIO\",\n \"simulation_metadata_input\": {},\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Test case for weather query\",\n \"script_turns\": [\n \"<string>\"\n ],\n \"metric_input\": {},\n \"user_notes\": \"Created for regression testing\"\n}"
response = http.request(request)
puts response.read_body{
"test_case": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"name": "test-cases/abc123def456ghi789jklm",
"id": "abc123def456ghi789jklm",
"input_str": "What is the weather today?",
"create_time": "2025-10-14T12:00:00Z",
"test_set_id": "abc12345",
"expected_behaviors": [
"The weather is sunny."
],
"expected_output_json": {
"temperature": 75,
"condition": "sunny"
},
"description": "Test case for weather query with sunny conditions",
"input_type": "SCENARIO",
"script_turns": [
"Hi, I'd like to check my account balance.",
{
"type": "dtmf",
"digits": "12345#"
}
],
"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",
"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": "INVALID_ARGUMENT",
"message": "Invalid request parameters",
"details": [
{
"field": "test_set_id",
"description": "test_set_id is required"
}
]
}
}{
"error": {
"code": "INTERNAL",
"message": "Internal server error",
"details": [
{
"description": "An unexpected error occurred while processing the request"
}
]
}
}Create test case
Create a new test case.
curl --request POST \
--url https://api.coval.dev/v1/test-cases \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"input_str": "What is the weather today?",
"test_set_id": "abc12345",
"input_type": "SCENARIO",
"simulation_metadata_input": {},
"expected_behaviors": [
"The weather is sunny."
],
"expected_output_str": "The weather is sunny.",
"expected_output_json": {},
"description": "Test case for weather query",
"script_turns": [
"<string>"
],
"metric_input": {},
"user_notes": "Created for regression testing"
}
'import requests
url = "https://api.coval.dev/v1/test-cases"
payload = {
"input_str": "What is the weather today?",
"test_set_id": "abc12345",
"input_type": "SCENARIO",
"simulation_metadata_input": {},
"expected_behaviors": ["The weather is sunny."],
"expected_output_str": "The weather is sunny.",
"expected_output_json": {},
"description": "Test case for weather query",
"script_turns": ["<string>"],
"metric_input": {},
"user_notes": "Created for regression testing"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input_str: 'What is the weather today?',
test_set_id: 'abc12345',
input_type: 'SCENARIO',
simulation_metadata_input: {},
expected_behaviors: ['The weather is sunny.'],
expected_output_str: 'The weather is sunny.',
expected_output_json: {},
description: 'Test case for weather query',
script_turns: ['<string>'],
metric_input: {},
user_notes: 'Created for regression testing'
})
};
fetch('https://api.coval.dev/v1/test-cases', 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",
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([
'input_str' => 'What is the weather today?',
'test_set_id' => 'abc12345',
'input_type' => 'SCENARIO',
'simulation_metadata_input' => [
],
'expected_behaviors' => [
'The weather is sunny.'
],
'expected_output_str' => 'The weather is sunny.',
'expected_output_json' => [
],
'description' => 'Test case for weather query',
'script_turns' => [
'<string>'
],
'metric_input' => [
],
'user_notes' => 'Created for regression testing'
]),
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"
payload := strings.NewReader("{\n \"input_str\": \"What is the weather today?\",\n \"test_set_id\": \"abc12345\",\n \"input_type\": \"SCENARIO\",\n \"simulation_metadata_input\": {},\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Test case for weather query\",\n \"script_turns\": [\n \"<string>\"\n ],\n \"metric_input\": {},\n \"user_notes\": \"Created for regression testing\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.coval.dev/v1/test-cases")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"input_str\": \"What is the weather today?\",\n \"test_set_id\": \"abc12345\",\n \"input_type\": \"SCENARIO\",\n \"simulation_metadata_input\": {},\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Test case for weather query\",\n \"script_turns\": [\n \"<string>\"\n ],\n \"metric_input\": {},\n \"user_notes\": \"Created for regression testing\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.coval.dev/v1/test-cases")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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\": \"abc12345\",\n \"input_type\": \"SCENARIO\",\n \"simulation_metadata_input\": {},\n \"expected_behaviors\": [\n \"The weather is sunny.\"\n ],\n \"expected_output_str\": \"The weather is sunny.\",\n \"expected_output_json\": {},\n \"description\": \"Test case for weather query\",\n \"script_turns\": [\n \"<string>\"\n ],\n \"metric_input\": {},\n \"user_notes\": \"Created for regression testing\"\n}"
response = http.request(request)
puts response.read_body{
"test_case": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"name": "test-cases/abc123def456ghi789jklm",
"id": "abc123def456ghi789jklm",
"input_str": "What is the weather today?",
"create_time": "2025-10-14T12:00:00Z",
"test_set_id": "abc12345",
"expected_behaviors": [
"The weather is sunny."
],
"expected_output_json": {
"temperature": 75,
"condition": "sunny"
},
"description": "Test case for weather query with sunny conditions",
"input_type": "SCENARIO",
"script_turns": [
"Hi, I'd like to check my account balance.",
{
"type": "dtmf",
"digits": "12345#"
}
],
"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",
"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": "INVALID_ARGUMENT",
"message": "Invalid request parameters",
"details": [
{
"field": "test_set_id",
"description": "test_set_id is required"
}
]
}
}{
"error": {
"code": "INTERNAL",
"message": "Internal server error",
"details": [
{
"description": "An unexpected error occurred while processing the request"
}
]
}
}Authorizations
Organization API key for authentication
Headers
Workspace that scopes this operation. When omitted, the organization's active default workspace is used when one can be resolved.
1 - 26Body
- Non-SCRIPT test case
- SCRIPT test case with top-level turns
- SCRIPT test case with legacy nested turns
Request body for creating a test case
Input for the test case
1"What is the weather today?"
Test set ID (REQUIRED in body, not URL)
8"abc12345"
Type of input for the test case. SCRIPT requires non-empty script_turns. Changing input_type from SCRIPT to another value clears script_turns. IVR_CRAWL is crawler-managed and cannot be selected through this API.
SCENARIO, TRANSCRIPT, IVR, AUDIO, MANUAL, SCRIPT "SCENARIO"
Legacy simulation metadata. For SCRIPT cases, use the top-level script_turns field. A nested script_turns input remains accepted for backward compatibility but is deprecated.
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
"Test case for weather query"
Ordered persona turns. For new integrations, provide a non-empty top-level array when input_type is SCRIPT and omit it otherwise. Changing input_type away from SCRIPT clears this field. Each entry is either a bare string (spoken text), {"type": "text", "text": ...} (spoken text, explicit form), {"type": "dtmf", "digits": ...} (keypad presses; digits 0-9, *, #, and phone punctuation), or {"type": "skip"} (the persona stays silent for one turn).
Spoken text (legacy bare-string form)
1Input for metrics
User notes
"Created for regression testing"
Response
Test case created successfully
Test case resource.
Show child attributes
Show child attributes
Was this page helpful?