curl -X POST "https://api.magpipe.ai/functions/v1/test-cases" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "create_case",
"suite_id": "a1b2c3d4-1234-5678-9abc-def012345678",
"name": "Caller asks about business hours",
"type": "inbound_call",
"caller_mode": "scripted",
"caller_script": ["Hi, what are your business hours?"],
"expected_phrases": ["Monday through Friday", "9 AM"],
"prohibited_phrases": ["I don'\''t know"],
"min_duration_seconds": 10,
"max_duration_seconds": 60
}'
{
"case": {
"id": "b2c3d4e5-2345-6789-abcd-ef0123456789",
"suite_id": "a1b2c3d4-1234-5678-9abc-def012345678",
"name": "Caller asks about business hours",
"description": null,
"type": "inbound_call",
"agent_id": "c72ea2b8-1234-5678-9abc-def012345678",
"caller_mode": "scripted",
"caller_script": ["Hi, what are your business hours?"],
"expected_phrases": ["Monday through Friday", "9 AM"],
"prohibited_phrases": ["I don't know"],
"expected_functions": null,
"min_duration_seconds": 10,
"max_duration_seconds": 60,
"created_at": "2024-01-15T10:05:00.000Z"
}
}
Testing
Create Test Case
Create a test case inside a suite with assertions for phrases, functions, and call duration
POST
/
test-cases
curl -X POST "https://api.magpipe.ai/functions/v1/test-cases" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "create_case",
"suite_id": "a1b2c3d4-1234-5678-9abc-def012345678",
"name": "Caller asks about business hours",
"type": "inbound_call",
"caller_mode": "scripted",
"caller_script": ["Hi, what are your business hours?"],
"expected_phrases": ["Monday through Friday", "9 AM"],
"prohibited_phrases": ["I don'\''t know"],
"min_duration_seconds": 10,
"max_duration_seconds": 60
}'
{
"case": {
"id": "b2c3d4e5-2345-6789-abcd-ef0123456789",
"suite_id": "a1b2c3d4-1234-5678-9abc-def012345678",
"name": "Caller asks about business hours",
"description": null,
"type": "inbound_call",
"agent_id": "c72ea2b8-1234-5678-9abc-def012345678",
"caller_mode": "scripted",
"caller_script": ["Hi, what are your business hours?"],
"expected_phrases": ["Monday through Friday", "9 AM"],
"prohibited_phrases": ["I don't know"],
"expected_functions": null,
"min_duration_seconds": 10,
"max_duration_seconds": 60,
"created_at": "2024-01-15T10:05:00.000Z"
}
}
Creates a test case inside a suite. Test cases define a scenario — the call direction, how the test caller behaves, and what assertions to validate after the call completes.
Body Parameters
string
required
Must be
create_casestring
required
UUID of the test suite this case belongs to.
string
required
Display name for the test case.Example:
"Caller asks about business hours"string
What this test case validates.
string
default:"inbound_call"
Call direction.
inbound_call — test caller dials the agent. outbound_call — agent calls the test number.string
UUID of the agent to test. If omitted, uses the agent associated with the test suite.
string
default:"silent"
How the test caller behaves.
silent — stays quiet (tests greeting/opening). scripted — speaks from caller_script.array
Array of strings the test caller speaks, one per turn. Used when
caller_mode is scripted.Example: ["Hi, what are your hours?", "Can I book for tomorrow?"]array
Phrases that must appear in the transcript. Case-insensitive substring matching.Example:
["Monday through Friday", "9 AM to 5 PM"]array
Phrases that must NOT appear. Test fails if any are found.Example:
["I don't know", "I'm not sure"]array
Custom function names that must be called during the conversation.Example:
["book_appointment", "send_confirmation_sms"]number
Minimum acceptable call duration in seconds.
number
Maximum acceptable call duration in seconds.
Response
object
The created test case object with all configured fields and its new UUID.
curl -X POST "https://api.magpipe.ai/functions/v1/test-cases" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"action": "create_case",
"suite_id": "a1b2c3d4-1234-5678-9abc-def012345678",
"name": "Caller asks about business hours",
"type": "inbound_call",
"caller_mode": "scripted",
"caller_script": ["Hi, what are your business hours?"],
"expected_phrases": ["Monday through Friday", "9 AM"],
"prohibited_phrases": ["I don'\''t know"],
"min_duration_seconds": 10,
"max_duration_seconds": 60
}'
{
"case": {
"id": "b2c3d4e5-2345-6789-abcd-ef0123456789",
"suite_id": "a1b2c3d4-1234-5678-9abc-def012345678",
"name": "Caller asks about business hours",
"description": null,
"type": "inbound_call",
"agent_id": "c72ea2b8-1234-5678-9abc-def012345678",
"caller_mode": "scripted",
"caller_script": ["Hi, what are your business hours?"],
"expected_phrases": ["Monday through Friday", "9 AM"],
"prohibited_phrases": ["I don't know"],
"expected_functions": null,
"min_duration_seconds": 10,
"max_duration_seconds": 60,
"created_at": "2024-01-15T10:05:00.000Z"
}
}