curl --request POST \
--url https://api.example.com/api/call \
--header 'Content-Type: application/json' \
--data '
{
"to_number": "<string>",
"business_description": "<string>",
"scenario": "<string>"
}
'{
"ok": true,
"status": "<string>",
"message": "<string>",
"to_number": "<string>",
"scenario": "<string>",
"call_sid": {},
"conversation_id": {},
"raw": {}
}Initiate an outbound phone call with the AI caller to test your phone flow
curl --request POST \
--url https://api.example.com/api/call \
--header 'Content-Type: application/json' \
--data '
{
"to_number": "<string>",
"business_description": "<string>",
"scenario": "<string>"
}
'{
"ok": true,
"status": "<string>",
"message": "<string>",
"to_number": "<string>",
"scenario": "<string>",
"call_sid": {},
"conversation_id": {},
"raw": {}
}ELEVENLABS_API_KEY - Your ElevenLabs API keyELEVENLABS_AGENT_ID - Your ElevenLabs Conversational AI agent IDELEVENLABS_AGENT_PHONE_NUMBER_ID - Your ElevenLabs phone number ID+15551234567).Validation: Must match the pattern ^\+[1-9]\d{7,14}$+++0/api/context).At least one of these must be provided:business_description parameter/api/contexttrue on success.{
"error": "Provide a business description first."
}
{
"error": "Phone number must be in E.164 format, for example +15551234567."
}
{
"error": "Missing required environment variables: ELEVENLABS_API_KEY, ELEVENLABS_AGENT_ID, ELEVENLABS_AGENT_PHONE_NUMBER_ID"
}
{
"error": "ElevenLabs API error (403): Invalid API key"
}
{
"error": "Could not reach ElevenLabs: [connection error details]"
}
curl -X POST http://localhost:5000/api/call \
-H "Content-Type: application/json" \
-d '{
"to_number": "+15551234567",
"business_description": "We are Pizza Palace, a pizza restaurant that takes orders and handles delivery inquiries.",
"scenario": "order a large pepperoni pizza for delivery to 123 Main St"
}'
{
"ok": true,
"status": "initiated",
"message": "Call initiated.",
"to_number": "+15551234567",
"scenario": "order a large pepperoni pizza for delivery to 123 Main St",
"call_sid": "CA1234567890abcdef1234567890abcdef",
"conversation_id": "conv_abc123xyz789",
"raw": {
"status": "initiated",
"call_sid": "CA1234567890abcdef1234567890abcdef",
"conversation_id": "conv_abc123xyz789"
}
}
/api/context call:
# First, set context
curl -X POST http://localhost:5000/api/context \
-H "Content-Type: application/json" \
-d '{
"description": "We are a tech support helpdesk.",
"scenario": "report a login issue"
}'
# Then initiate call using session context
curl -X POST http://localhost:5000/api/call \
-H "Content-Type: application/json" \
-d '{
"to_number": "+15551234567"
}'
^\+[1-9]\d{7,14}$
+15551234567 (US)+442071234567 (UK)+81312345678 (Japan)5551234567 (missing +)+0551234567 (starts with 0)+1555 (too short)+155512345678901234 (too long)POST {ELEVENLABS_API_BASE}/v1/convai/twilio/outbound-call
{
"agent_id": "<ELEVENLABS_AGENT_ID>",
"agent_phone_number_id": "<ELEVENLABS_AGENT_PHONE_NUMBER_ID>",
"to_number": "+15551234567",
"conversation_initiation_client_data": {
"conversation_config_override": {
"agent": {
"prompt": {
"prompt": "<caller prompt with business description and scenario>"
},
"first_message": "Hi, I'm calling because I'd like to <scenario>."
}
}
}
}
Hi, I'm calling because I'd like to {scenario}.
Hi, I'm calling because I'd like to order a pizza.
“You are simulating a real customer contacting the business below. The other side is the company, an operator, or an IVR. Stay in character as the caller/customer, try to complete the task, and avoid escalating to a human unless the flow requires it. Business description: Caller goal: Speak naturally, ask one thing at a time, and keep each response concise.”