Skip to main content
POST
/
test-cases
Create 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",
  "expected_behaviors": [
    "The weather is sunny."
  ],
  "expected_output_str": "The weather is sunny.",
  "expected_output_json": {},
  "description": "Test case for weather query",
  "input_type": "SCENARIO",
  "simulation_metadata_input": {},
  "metric_input": {},
  "user_notes": "Created for regression testing"
}
'
{
  "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"
  }
}

Authorizations

X-API-Key
string
header
required

Organization API key for authentication

Body

application/json

Request body for creating a test case

input_str
string
required

Input for the test case

Minimum string length: 1
Example:

"What is the weather today?"

test_set_id
string
required

Test set ID (REQUIRED in body, not URL)

Required string length: 8
Example:

"abc12345"

expected_behaviors
string[] | null

Expected behaviors (list of strings). This is the preferred field.

Example:
["The weather is sunny."]
expected_output_str
string | null

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.

Example:

"The weather is sunny."

expected_output_json
object

Expected output as JSON object

description
string | null

Human-readable description

Example:

"Test case for weather query"

input_type
enum<string> | null
default:SCENARIO

Type of input for the test case. Defaults to SCENARIO. When set to SCRIPT, the simulation_metadata_input should contain a script_turns field with ordered persona turn texts.

Available options:
SCENARIO,
TRANSCRIPT,
IVR,
AUDIO,
MANUAL,
SCRIPT
Example:

"SCENARIO"

simulation_metadata_input
object

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.

metric_input
object

Input for metrics

user_notes
string | null

User notes

Example:

"Created for regression testing"

Response

Test case created successfully

test_case
object

Test case resource.