curl --request POST \
--url https://your-instance.example.com/api/calls/ai/outbound \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contactId": "64f0a1b2c3d4e5f6a7b8c9d0",
"agentId": "64f0a1b2c3d4e5f6a7b8cc00",
"fromNumber": "+14165550100",
"callReason": "Follow up on insurance quote"
}
'import requests
url = "https://your-instance.example.com/api/calls/ai/outbound"
payload = {
"contactId": "64f0a1b2c3d4e5f6a7b8c9d0",
"agentId": "64f0a1b2c3d4e5f6a7b8cc00",
"fromNumber": "+14165550100",
"callReason": "Follow up on insurance quote"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contactId: '64f0a1b2c3d4e5f6a7b8c9d0',
agentId: '64f0a1b2c3d4e5f6a7b8cc00',
fromNumber: '+14165550100',
callReason: 'Follow up on insurance quote'
})
};
fetch('https://your-instance.example.com/api/calls/ai/outbound', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/calls/ai/outbound",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contactId' => '64f0a1b2c3d4e5f6a7b8c9d0',
'agentId' => '64f0a1b2c3d4e5f6a7b8cc00',
'fromNumber' => '+14165550100',
'callReason' => 'Follow up on insurance quote'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/calls/ai/outbound"
payload := strings.NewReader("{\n \"contactId\": \"64f0a1b2c3d4e5f6a7b8c9d0\",\n \"agentId\": \"64f0a1b2c3d4e5f6a7b8cc00\",\n \"fromNumber\": \"+14165550100\",\n \"callReason\": \"Follow up on insurance quote\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/calls/ai/outbound")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contactId\": \"64f0a1b2c3d4e5f6a7b8c9d0\",\n \"agentId\": \"64f0a1b2c3d4e5f6a7b8cc00\",\n \"fromNumber\": \"+14165550100\",\n \"callReason\": \"Follow up on insurance quote\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/calls/ai/outbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contactId\": \"64f0a1b2c3d4e5f6a7b8c9d0\",\n \"agentId\": \"64f0a1b2c3d4e5f6a7b8cc00\",\n \"fromNumber\": \"+14165550100\",\n \"callReason\": \"Follow up on insurance quote\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"conversationId": "eleven-conv-abc123",
"sipCallId": "sip-call-xyz789",
"message": "AI call initiated",
"deduplicated": false
}{
"success": false,
"error": "Call not found"
}{
"success": false,
"error": "Call not found"
}{
"success": false,
"error": "Call not found"
}{
"success": false,
"error": "Call not found"
}{
"success": false,
"error": "Call not found"
}Initiate an outbound AI voice call
Places an outbound call to a contact using the configured AI voice provider (currently ElevenLabs over Sinch EST). Resolves or creates the contact, picks a voice-enabled agent (Prompt), picks an AI-enabled Sinch number to call from, and asks the provider to dial. Guarded by a 30s Redis idempotency lock keyed on user+contact+agent+toNumber; concurrent retries return 429 with OUTBOUND_IN_FLIGHT. Caches conversation context for the post-call webhook.
curl --request POST \
--url https://your-instance.example.com/api/calls/ai/outbound \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contactId": "64f0a1b2c3d4e5f6a7b8c9d0",
"agentId": "64f0a1b2c3d4e5f6a7b8cc00",
"fromNumber": "+14165550100",
"callReason": "Follow up on insurance quote"
}
'import requests
url = "https://your-instance.example.com/api/calls/ai/outbound"
payload = {
"contactId": "64f0a1b2c3d4e5f6a7b8c9d0",
"agentId": "64f0a1b2c3d4e5f6a7b8cc00",
"fromNumber": "+14165550100",
"callReason": "Follow up on insurance quote"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
contactId: '64f0a1b2c3d4e5f6a7b8c9d0',
agentId: '64f0a1b2c3d4e5f6a7b8cc00',
fromNumber: '+14165550100',
callReason: 'Follow up on insurance quote'
})
};
fetch('https://your-instance.example.com/api/calls/ai/outbound', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/calls/ai/outbound",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'contactId' => '64f0a1b2c3d4e5f6a7b8c9d0',
'agentId' => '64f0a1b2c3d4e5f6a7b8cc00',
'fromNumber' => '+14165550100',
'callReason' => 'Follow up on insurance quote'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/calls/ai/outbound"
payload := strings.NewReader("{\n \"contactId\": \"64f0a1b2c3d4e5f6a7b8c9d0\",\n \"agentId\": \"64f0a1b2c3d4e5f6a7b8cc00\",\n \"fromNumber\": \"+14165550100\",\n \"callReason\": \"Follow up on insurance quote\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/calls/ai/outbound")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contactId\": \"64f0a1b2c3d4e5f6a7b8c9d0\",\n \"agentId\": \"64f0a1b2c3d4e5f6a7b8cc00\",\n \"fromNumber\": \"+14165550100\",\n \"callReason\": \"Follow up on insurance quote\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/calls/ai/outbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"contactId\": \"64f0a1b2c3d4e5f6a7b8c9d0\",\n \"agentId\": \"64f0a1b2c3d4e5f6a7b8cc00\",\n \"fromNumber\": \"+14165550100\",\n \"callReason\": \"Follow up on insurance quote\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"conversationId": "eleven-conv-abc123",
"sipCallId": "sip-call-xyz789",
"message": "AI call initiated",
"deduplicated": false
}{
"success": false,
"error": "Call not found"
}{
"success": false,
"error": "Call not found"
}{
"success": false,
"error": "Call not found"
}{
"success": false,
"error": "Call not found"
}{
"success": false,
"error": "Call not found"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Either contactId or phoneNumber must be supplied. phoneNumber will find-or-create a contact.
E.164 phone number (the + prefix will be added if missing).
Prompt._id — ElevenLabs-synced voice agent to use. Defaults to the first voice-enabled agent in the org.
Specific Sinch number to call from. Defaults to the first AI-enabled Sinch number in the user's voicePhoneNumbers.
Free-text context passed to the agent as the call_reason dynamic variable.
Response
AI call initiated