Retell AI - API Setup
Programmatically integrate Retell AI with Vobiz using REST API and curl commands for automated calling.
Prefer visual dashboard?
Check out the Dashboard Setup Guide for a no-code integration method.
Overview
This guide shows how to integrate Retell AI with Vobiz using the API for automated outbound calling. Perfect for developers building applications that trigger AI calls programmatically.
Call flow:
Your App → Retell AI API → Vobiz SIP → Phone Network → AI ConversationPrerequisites
Before starting:
- →Retell AI Account → Sign up
- →Vobiz Account with SIP trunk → Create account
- →Retell AI Agent created → Create in dashboard
- →Phone number from Vobiz (for caller ID)
Get Vobiz Credentials:
- Via Console: Vobiz Console → Trunks
- Via API: Vobiz API Reference
Step 1: Get Your API Key
Via Dashboard:
- Go to Retell Dashboard → Settings → API Keys
- Click Create API Key
- Copy the key (starts with
key_)
⚠️ Keep this secret!
Never commit to git or share publicly. Store securely in environment variables.
Step 2: List Available Agents
Retrieve all agents to get the agent_id you'll use for calls:
curl "https://api.retellai.com/list-agents" \
-H "Authorization: Bearer key_abc123xyz789example"Example Response:
[
{
"agent_id": "agent_abc123example",
"agent_name": "Customer Support Agent",
"voice_id": "11labs-Rachel",
"language": "en-US"
}
]What to extract:
agent_id- Use this when making callsagent_name- Human-readable namevoice_id- Which voice the agent uses
📝 Copy the agent_id for the agent you want to use.
Step 3: Configure Phone Number with SIP Trunk
Add your Vobiz phone number and SIP trunk configuration to Retell:
curl "https://api.retellai.com/create-phone-number" \
-X POST \
-H "Authorization: Bearer key_abc123xyz789example" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+1234567890",
"phone_number_type": "custom",
"nickname": "Vobiz Main Line",
"outbound_agent_id": "agent_abc123example",
"sip_outbound_trunk_config": {
"termination_uri": "abc123.sip.vobiz.ai",
"transport": "TCP",
"auth_username": "your_username",
"auth_password": "your_password"
}
}'Required Fields:
phone_number
Your Vobiz number in E.164 format: +countrycode + number
phone_number_type
Must be "custom" for SIP trunks
outbound_agent_id
Agent ID from Step 2
sip_outbound_trunk_config
termination_uri- Vobiz SIP domain (withoutsip:prefix)transport-"TCP"(recommended)auth_username- Vobiz trunk usernameauth_password- Vobiz trunk password
Get Vobiz credentials:
Vobiz Console → Trunks → Your Trunk
✓ Use this number as from_number when making calls
Step 4: Make an Outbound Call
Trigger an AI call programmatically:
curl "https://api.retellai.com/v2/create-phone-call" \
-X POST \
-H "Authorization: Bearer key_abc123xyz789example" \
-H "Content-Type: application/json" \
-d '{
"from_number": "+1234567890",
"to_number": "+10987654321",
"agent_id": "agent_abc123example"
}'Required Parameters:
from_number
Your configured Vobiz number (caller ID)
to_number
Destination number to call (E.164 format)
agent_id
Which agent to use for the call
Example Response:
{
"call_id": "call_abc123xyz789",
"call_status": "registered",
"from_number": "+1234567890",
"to_number": "+10987654321",
"direction": "outbound"
}What to extract:
call_id- Use this to retrieve call details latercall_status- Tracks call progress:"registered"→ Call initiated"ringing"→ Phone is ringing"ongoing"→ Call connected"ended"→ Call finished
Call initiated!
The destination phone will ring, and when answered, the AI agent will speak.
Troubleshooting
"401 Unauthorized"
Cause: Invalid API key
Fix:
- Verify API key in Retell Dashboard → Settings
- Ensure it starts with
key_
"Phone number not found"
Cause: Phone number not configured in Retell
Fix:
- Run Step 3 to add phone number with SIP trunk
- Verify number format is E.164 (
+countrycode + number)
Call fails immediately
Possible causes:
1. Wrong SIP credentials
- Verify Vobiz username/password at Vobiz Console
2. Wrong transport type
- Try
"UDP"instead of"TCP"in trunk config
3. SIP domain incorrect
- Must be exact Vobiz domain (e.g.,
abc123.sip.vobiz.ai) - Do NOT include
sip:prefix
4. Insufficient balance
- Check Vobiz account has credits at Vobiz Console
- See Balance Documentation
Agent doesn't speak
Cause: Agent not configured or not published
Fix:
- Ensure agent is published in Retell Dashboard → Agents
- Check agent has voice configured
- Verify agent ID matches in phone number config
Quick Reference
API Endpoints
| Endpoint | Method | Purpose |
|---|---|---|
/list-agents | GET | List all agents |
/list-phone-numbers | GET | List configured numbers |
/create-phone-number | POST | Add phone number with SIP trunk |
/v2/create-phone-call | POST | Make outbound call |
/get-call/{call_id} | GET | Get call details |
Base URL: https://api.retellai.com
Authentication: Authorization: Bearer YOUR_API_KEY
Complete Call Flow (curl)
# 1. List agents
curl "https://api.retellai.com/list-agents" \
-H "Authorization: Bearer key_YOUR_KEY_HERE"
# 2. Configure phone number (one-time)
curl "https://api.retellai.com/create-phone-number" \
-X POST \
-H "Authorization: Bearer key_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+1234567890",
"phone_number_type": "custom",
"outbound_agent_id": "agent_YOUR_AGENT_ID",
"sip_outbound_trunk_config": {
"termination_uri": "abc123.sip.vobiz.ai",
"transport": "TCP",
"auth_username": "your_username",
"auth_password": "your_password"
}
}'
# 3. Make a call
curl "https://api.retellai.com/v2/create-phone-call" \
-X POST \
-H "Authorization: Bearer key_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"from_number": "+1234567890",
"to_number": "+10987654321",
"agent_id": "agent_YOUR_AGENT_ID"
}'Support Resources
Integration complete!
Your Retell AI agents can now make outbound calls through Vobiz programmatically. Perfect for automated campaigns and application integrations!