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
Call direction.
inbound_call — test caller dials the agent. outbound_call — agent calls the test number.How the test caller behaves.
silent — stays quiet (tests greeting/opening). scripted — speaks from caller_script.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?"]Phrases that must appear in the transcript. Case-insensitive substring matching.Example:
["Monday through Friday", "9 AM to 5 PM"]Phrases that must NOT appear. Test fails if any are found.Example:
["I don't know", "I'm not sure"]Custom function names that must be called during the conversation.Example:
["book_appointment", "send_confirmation_sms"]Response
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"
}
}